Skip to content

Commit

Permalink
Feature llama 33 (#826)
Browse files Browse the repository at this point in the history
* added llama 3.3 config

* fixed key

* added debug point

* updated model compatibility notebook

* ran format

* removed log point
  • Loading branch information
bryce13950 authored Dec 31, 2024
1 parent d0d0750 commit cc927d7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
5 changes: 3 additions & 2 deletions demos/Colab_Compatibility.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TransformerLens currently supports 205 models out of the box.\n"
"TransformerLens currently supports 206 models out of the box.\n"
]
}
],
Expand Down Expand Up @@ -429,6 +429,7 @@
" \"meta-llama/Llama-2-70b-chat-hf\",\n",
" \"meta-llama/Llama-3.1-70B\",\n",
" \"meta-llama/Llama-3.1-70B-Instruct\",\n",
" \"meta-llama/Llama-3.3-70B-Instruct\",\n",
" \"meta-llama/Meta-Llama-3-70B\",\n",
" \"meta-llama/Meta-Llama-3-70B-Instruct\",\n",
" \"mistralai/Mixtral-8x7B-Instruct-v0.1\",\n",
Expand Down
33 changes: 29 additions & 4 deletions transformer_lens/loading_from_pretrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@
"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",
"meta-llama/Llama-3.1-70B",
"meta-llama/Llama-3.1-8B",
"meta-llama/Llama-3.1-8B-Instruct",
"meta-llama/Llama-3.1-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",
"meta-llama/Llama-3.3-70B-Instruct",
"Baidicoot/Othello-GPT-Transformer-Lens",
"bert-base-cased",
"roneneldan/TinyStories-1M",
Expand Down Expand Up @@ -960,6 +961,30 @@ def convert_hf_model_config(model_name: str, **kwargs):
"NTK_by_parts_high_freq_factor": 4.0,
"NTK_by_parts_factor": 32.0,
}
elif "Llama-3.3-70B" in official_model_name:
cfg_dict = {
"d_model": 8192,
"d_head": 128,
"n_heads": 64,
"d_mlp": 28672,
"n_layers": 80,
"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": 32,
"final_rms": True,
"gated_mlp": True,
"rotary_base": 500000.0,
"use_NTK_by_parts_rope": True,
"NTK_by_parts_low_freq_factor": 1.0,
"NTK_by_parts_high_freq_factor": 4.0,
"NTK_by_parts_factor": 8.0,
}
elif "Llama-3.1-8B" in official_model_name:
cfg_dict = {
"d_model": 4096,
Expand Down

0 comments on commit cc927d7

Please sign in to comment.