Skip to content

Commit

Permalink
Merge pull request #731 from TransformerLensOrg/model-llama-32
Browse files Browse the repository at this point in the history
Model llama 3.2
  • Loading branch information
bryce13950 authored Sep 26, 2024
2 parents 762bb5d + 2f3f1ae commit 4b8321c
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions transformer_lens/loading_from_pretrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
"meta-llama/Meta-Llama-3-8B-Instruct",
"meta-llama/Meta-Llama-3-70B",
"meta-llama/Meta-Llama-3-70B-Instruct",
"meta-llama/Llama-3.2-1B",
"meta-llama/Llama-3.2-3B",
"meta-llama/Llama-3.2-1B-Instruct",
"meta-llama/Llama-3.2-3B-Instruct",
"Baidicoot/Othello-GPT-Transformer-Lens",
"bert-base-cased",
"roneneldan/TinyStories-1M",
Expand Down Expand Up @@ -885,6 +889,82 @@ def convert_hf_model_config(model_name: str, **kwargs):
"final_rms": True,
"gated_mlp": True,
}
elif "Llama-3.2-1B" in official_model_name:
cfg_dict = {
"d_model": 2048,
"d_head": 64,
"n_heads": 32,
"d_mlp": 8192,
"n_layers": 16,
"n_ctx": 2048, # capped due to memory issues
"eps": 1e-5,
"d_vocab": 128256,
"act_fn": "silu",
"n_key_value_heads": 8,
"normalization_type": "RMS",
"positional_embedding_type": "rotary",
"rotary_adjacent_pairs": False,
"rotary_dim": 64,
"final_rms": True,
"gated_mlp": True,
}
elif "Llama-3.2-3B" in official_model_name:
cfg_dict = {
"d_model": 3072,
"d_head": 128,
"n_heads": 24,
"d_mlp": 8192,
"n_layers": 28,
"n_ctx": 2048, # capped due to memory issues
"eps": 1e-5,
"d_vocab": 128256,
"act_fn": "silu",
"n_key_value_heads": 8,
"normalization_type": "RMS",
"positional_embedding_type": "rotary",
"rotary_adjacent_pairs": False,
"rotary_dim": 128,
"final_rms": True,
"gated_mlp": True,
}
elif "Llama-3.2-1B-Instruct" in official_model_name:
cfg_dict = {
"d_model": 2048,
"d_head": 64,
"n_heads": 32,
"d_mlp": 8192,
"n_layers": 16,
"n_ctx": 2048, # capped due to memory issues
"eps": 1e-5,
"d_vocab": 128256,
"act_fn": "silu",
"n_key_value_heads": 8,
"normalization_type": "RMS",
"positional_embedding_type": "rotary",
"rotary_adjacent_pairs": False,
"rotary_dim": 64,
"final_rms": True,
"gated_mlp": True,
}
elif "Llama-3.2-3B-Instruct" in official_model_name:
cfg_dict = {
"d_model": 3072,
"d_head": 128,
"n_heads": 24,
"d_mlp": 8192,
"n_layers": 28,
"n_ctx": 2048, # capped due to memory issues
"eps": 1e-5,
"d_vocab": 128256,
"act_fn": "silu",
"n_key_value_heads": 8,
"normalization_type": "RMS",
"positional_embedding_type": "rotary",
"rotary_adjacent_pairs": False,
"rotary_dim": 128,
"final_rms": True,
"gated_mlp": True,
}
elif architecture == "GPTNeoForCausalLM":
cfg_dict = {
"d_model": hf_config.hidden_size,
Expand Down

0 comments on commit 4b8321c

Please sign in to comment.