Returns the adapter UIDs that were loaded by this call. Note that when an adapter was already loaded before this call, it would not be included in the returned list of UIDs. Lora config of https://huggingface.co/hfl/chinese-alpaca-2-lora-7b. { "base_mod
(
self,
model_dirs: List[str],
model_config: Union["ModelConfig", LoraModelConfig],
uids: Optional[List[str]] = None,
component: Optional[str] = None,
)
| 875 | return new_uids |
| 876 | |
| 877 | def load_from_hf( |
| 878 | self, |
| 879 | model_dirs: List[str], |
| 880 | model_config: Union["ModelConfig", LoraModelConfig], |
| 881 | uids: Optional[List[str]] = None, |
| 882 | component: Optional[str] = None, |
| 883 | ) -> List[str]: |
| 884 | """Returns the adapter UIDs that were loaded by this call. |
| 885 | |
| 886 | Note that when an adapter was already loaded before this call, it would not be |
| 887 | included in the returned list of UIDs. |
| 888 | |
| 889 | Lora config of https://huggingface.co/hfl/chinese-alpaca-2-lora-7b. |
| 890 | |
| 891 | { |
| 892 | "base_model_name_or_path": "/Llama-2-7b-hf", |
| 893 | "bias": "none", |
| 894 | "enable_lora": null, |
| 895 | "fan_in_fan_out": false, |
| 896 | "inference_mode": true, |
| 897 | "lora_alpha": 128.0, |
| 898 | "lora_dropout": 0.05, |
| 899 | "merge_weights": false, |
| 900 | "modules_to_save": [ |
| 901 | "embed_tokens", |
| 902 | "lm_head" |
| 903 | ], |
| 904 | "peft_type": "LORA", |
| 905 | "r": 64, |
| 906 | "target_modules": [ |
| 907 | "q_proj", |
| 908 | "v_proj", |
| 909 | "k_proj", |
| 910 | "o_proj", |
| 911 | "gate_proj", |
| 912 | "down_proj", |
| 913 | "up_proj" |
| 914 | ], |
| 915 | "task_type": "CAUSAL_LM" |
| 916 | |
| 917 | } |
| 918 | |
| 919 | keys in adapter_model.bin: |
| 920 | base_model.model.model.layers.0.self_attn.q_proj.lora_A.weight torch.Size([64, 4096]) |
| 921 | base_model.model.model.layers.0.self_attn.q_proj.lora_B.weight torch.Size([4096, 64]) |
| 922 | base_model.model.model.layers.0.self_attn.k_proj.lora_A.weight torch.Size([64, 4096]) |
| 923 | base_model.model.model.layers.0.self_attn.k_proj.lora_B.weight torch.Size([4096, 64]) |
| 924 | base_model.model.model.layers.0.self_attn.v_proj.lora_A.weight torch.Size([64, 4096]) |
| 925 | base_model.model.model.layers.0.self_attn.v_proj.lora_B.weight torch.Size([4096, 64]) |
| 926 | base_model.model.model.layers.0.self_attn.o_proj.lora_A.weight torch.Size([64, 4096]) |
| 927 | base_model.model.model.layers.0.self_attn.o_proj.lora_B.weight torch.Size([4096, 64]) |
| 928 | base_model.model.model.layers.0.mlp.gate_proj.lora_A.weight torch.Size([64, 4096]) |
| 929 | base_model.model.model.layers.0.mlp.gate_proj.lora_B.weight torch.Size([11008, 64]) |
| 930 | base_model.model.model.layers.0.mlp.up_proj.lora_A.weight torch.Size([64, 4096]) |
| 931 | base_model.model.model.layers.0.mlp.up_proj.lora_B.weight torch.Size([11008, 64]) |
| 932 | base_model.model.model.layers.0.mlp.down_proj.lora_A.weight torch.Size([64, 11008]) |
| 933 | base_model.model.model.layers.0.mlp.down_proj.lora_B.weight torch.Size([4096, 64]) |
| 934 | ... |
no test coverage detected