Created
January 12, 2025 15:52
-
-
Save EvilFreelancer/1fdf86f3de654120f032b51d5f3f6bcf to your computer and use it in GitHub Desktop.
Qwen2.5 Peft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# peft_model = AutoPeftModelForCausalLM.from_pretrained(output_dir, device_map={"": "cpu"}).to("cpu") | |
# print(peft_model) | |
PeftModelForCausalLM( | |
(base_model): LoraModel( | |
(model): Qwen2ForCausalLM( | |
(model): Qwen2Model( | |
(embed_tokens): Embedding(151665, 3584, padding_idx=151643) | |
(layers): ModuleList( | |
(0-27): 28 x Qwen2DecoderLayer( | |
(self_attn): Qwen2SdpaAttention( | |
(q_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=3584, bias=True) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=3584, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(k_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=512, bias=True) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=512, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(v_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=512, bias=True) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=512, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(o_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=3584, bias=False) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=3584, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(rotary_emb): Qwen2RotaryEmbedding() | |
) | |
(mlp): Qwen2MLP( | |
(gate_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=18944, bias=False) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=18944, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(up_proj): lora.Linear( | |
(base_layer): Linear(in_features=3584, out_features=18944, bias=False) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=3584, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=18944, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(down_proj): lora.Linear( | |
(base_layer): Linear(in_features=18944, out_features=3584, bias=False) | |
(lora_dropout): ModuleDict( | |
(default): Identity() | |
) | |
(lora_A): ModuleDict( | |
(default): Linear(in_features=18944, out_features=16, bias=False) | |
) | |
(lora_B): ModuleDict( | |
(default): Linear(in_features=16, out_features=3584, bias=False) | |
) | |
(lora_embedding_A): ParameterDict() | |
(lora_embedding_B): ParameterDict() | |
(lora_magnitude_vector): ModuleDict() | |
) | |
(act_fn): SiLU() | |
) | |
(input_layernorm): Qwen2RMSNorm((3584,), eps=1e-06) | |
(post_attention_layernorm): Qwen2RMSNorm((3584,), eps=1e-06) | |
) | |
) | |
(norm): Qwen2RMSNorm((3584,), eps=1e-06) | |
(rotary_emb): Qwen2RotaryEmbedding() | |
) | |
(lm_head): Linear(in_features=3584, out_features=151665, bias=False) | |
) | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# model_processed = peft_model.merge_and_unload() | |
# print(model_processed) | |
Qwen2ForCausalLM( | |
(model): Qwen2Model( | |
(embed_tokens): Embedding(151665, 3584, padding_idx=151643) | |
(layers): ModuleList( | |
(0-27): 28 x Qwen2DecoderLayer( | |
(self_attn): Qwen2SdpaAttention( | |
(q_proj): Linear(in_features=3584, out_features=3584, bias=True) | |
(k_proj): Linear(in_features=3584, out_features=512, bias=True) | |
(v_proj): Linear(in_features=3584, out_features=512, bias=True) | |
(o_proj): Linear(in_features=3584, out_features=3584, bias=False) | |
(rotary_emb): Qwen2RotaryEmbedding() | |
) | |
(mlp): Qwen2MLP( | |
(gate_proj): Linear(in_features=3584, out_features=18944, bias=False) | |
(up_proj): Linear(in_features=3584, out_features=18944, bias=False) | |
(down_proj): Linear(in_features=18944, out_features=3584, bias=False) | |
(act_fn): SiLU() | |
) | |
(input_layernorm): Qwen2RMSNorm((3584,), eps=1e-06) | |
(post_attention_layernorm): Qwen2RMSNorm((3584,), eps=1e-06) | |
) | |
) | |
(norm): Qwen2RMSNorm((3584,), eps=1e-06) | |
(rotary_emb): Qwen2RotaryEmbedding() | |
) | |
(lm_head): Linear(in_features=3584, out_features=151665, bias=False) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment