PursuitOfDataScience commited on
Commit
20ffed0
·
verified ·
1 Parent(s): 08ed166

Upload Argonne 3.0-instruct (SFT+DPO, 13568 ctx)

Browse files
.gitattributes ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ model-00001-of-00005.safetensors filter=lfs diff=lfs merge=lfs -text
2
+ model-00002-of-00005.safetensors filter=lfs diff=lfs merge=lfs -text
3
+ model-00003-of-00005.safetensors filter=lfs diff=lfs merge=lfs -text
4
+ model-00004-of-00005.safetensors filter=lfs diff=lfs merge=lfs -text
5
+ model-00005-of-00005.safetensors filter=lfs diff=lfs merge=lfs -text
6
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ tags:
7
+ - text-generation
8
+ - causal-lm
9
+ - transformer
10
+ - argonne
11
+ - instruct
12
+ - pretrained
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ # Argonne 3.0-instruct
17
+
18
+ Argonne 3.0-instruct starts from the [Argonne 2.5-base](https://huggingface.co/PursuitOfDataScience/argonne-3.0-base) checkpoint and is tuned in two stages.
19
+
20
+ ## Training pipeline
21
+
22
+ First, supervised fine-tuning (SFT) adapts the base checkpoint on [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) using the `train_sft` split. That stage used NVIDIA H100 NVL hardware with 1,024-token sequences, batch size 24, gradient accumulation 2, learning rate 2e-5, and 100 warmup steps.
23
+
24
+ Second, direct preference optimization (DPO) refines the SFT checkpoint on [KatoHF/chatbot_arena_binarized](https://huggingface.co/datasets/KatoHF/chatbot_arena_binarized) with the `chat_refine_strict` recipe. That stage used NVIDIA H100 PCIe hardware with 1,024-token sequences, batch size 4, gradient accumulation 8, learning rate 5e-6, beta 0.2, and 10 warmup steps.
25
+
26
+ The published checkpoint is stored in bfloat16 and split across 5 safetensor shards for easier loading.
27
+
28
+ ## Training data
29
+
30
+ - Base checkpoint: [Argonne 2.5-base](https://huggingface.co/PursuitOfDataScience/argonne-3.0-base)
31
+ - SFT data: [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) (`train_sft`)
32
+ - DPO data: [KatoHF/chatbot_arena_binarized](https://huggingface.co/datasets/KatoHF/chatbot_arena_binarized) (`chat_refine_strict`)
33
+
34
+ ## Tokenizer
35
+
36
+ This model reuses the Qwen3 tokenizer (vocabulary size 151,669) through the `Qwen2Tokenizer` compatibility class. The tokenizer files are bundled with the checkpoint so no extra download is required.
37
+
38
+ ## Source code
39
+
40
+ The release was built from the GitHub main branch codebase: https://github.com/PursuitOfDataScience/ArgonneAI/tree/main
41
+
42
+ Key scripts:
43
+ - [`sft.py`](https://github.com/PursuitOfDataScience/ArgonneAI/blob/main/sft.py)
44
+ - [`dpo.py`](https://github.com/PursuitOfDataScience/ArgonneAI/blob/main/dpo.py)
45
+ - [`inference.py`](https://github.com/PursuitOfDataScience/ArgonneAI/blob/main/inference.py)
46
+
47
+
48
+ ## Recommended inference config
49
+
50
+ | Item | Value |
51
+ |------|-------|
52
+ | **Context length** | 1,024 tokens |
53
+ | **Temperature** | 0.8 |
54
+ | **Top-p** | 0.9 |
55
+ | **Repetition penalty** | 1.3 |
56
+ | **No-repeat n-gram size** | 4 |
57
+ | **Seed** | 444 |
58
+
59
+ These settings are the recommended defaults for inference.
60
+
61
+
62
+ ## Inference
63
+
64
+ ```python
65
+ from transformers import AutoModelForCausalLM, AutoTokenizer
66
+ import torch
67
+
68
+ model_id = "PursuitOfDataScience/argonne-3.0-instruct"
69
+
70
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
71
+ model = AutoModelForCausalLM.from_pretrained(
72
+ model_id,
73
+ trust_remote_code=True,
74
+ dtype=torch.bfloat16,
75
+ )
76
+
77
+ device = "cuda" if torch.cuda.is_available() else "cpu"
78
+ model = model.to(device)
79
+
80
+ prompt = "Write a short paragraph about scientific computing at Argonne National Laboratory."
81
+ inputs = tokenizer(prompt, return_tensors="pt")
82
+ input_ids = inputs["input_ids"].to(device)
83
+
84
+ seed = 444
85
+ torch.manual_seed(seed)
86
+ if device.startswith("cuda"):
87
+ torch.cuda.manual_seed_all(seed)
88
+
89
+ output_ids = model.generate(
90
+ input_ids,
91
+ max_length=input_ids.shape[1] + 128,
92
+ temperature=0.8,
93
+ top_p=0.9,
94
+ do_sample=True,
95
+ repetition_penalty=1.3,
96
+ no_repeat_ngram_size=4,
97
+ )
98
+ print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
99
+
100
+ ```
101
+
102
+
103
+
104
+ ## Usage notes
105
+
106
+ - Load with `trust_remote_code=True`.
107
+ - The custom `generate` method accepts `repetition_penalty` and `no_repeat_ngram_size`.
108
+ - The sweep-derived repetition controls are available in the repository's custom
109
+ generation loop, not the checkpoint's built-in `generate` method.
110
+ - Weights are published as 5 bf16 safetensor shards.
111
+ - The instruct checkpoint inherits the base tokenizer and chat template.
112
+
113
+ ## Citation
114
+
115
+ ```bibtex
116
+ @misc{argonne25instruct,
117
+ author = {PursuitOfDataScience},
118
+ title = {Argonne 3.0-instruct},
119
+ year = {2026},
120
+ publisher = {Hugging Face},
121
+ url = {https://huggingface.co/PursuitOfDataScience/argonne-3.0-instruct}
122
+ }
123
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_keep_in_fp32_modules": [],
3
+ "architectures": [
4
+ "ArgonneModel"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "block_size": 13568,
9
+ "bos_token_id": null,
10
+ "dtype": "bfloat16",
11
+ "eos_token_id": null,
12
+ "hidden_dropout": 0.0,
13
+ "hidden_size": 3072,
14
+ "interleaved_local_attention": true,
15
+ "intermediate_size": 8192,
16
+ "local_attention_window": 256,
17
+ "logit_softcap": 15.0,
18
+ "max_position_embeddings": 13568,
19
+ "mlp_bias": false,
20
+ "model_type": "argonne2",
21
+ "mtp_horizon": 1,
22
+ "mtp_loss_weight": 0.0,
23
+ "n_embd": 3072,
24
+ "n_head": 12,
25
+ "n_layer": 24,
26
+ "num_attention_heads": 12,
27
+ "num_hidden_layers": 24,
28
+ "num_key_value_heads": 4,
29
+ "pad_token_id": null,
30
+ "qk_norm": true,
31
+ "rms_norm_eps": 1e-06,
32
+ "rope_theta": 1000000.0,
33
+ "sandwich_norm": true,
34
+ "sliding_window": null,
35
+ "tie_word_embeddings": true,
36
+ "transformers_version": "5.6.2",
37
+ "use_cache": false,
38
+ "use_flash_attention": true,
39
+ "use_gradient_checkpointing": false,
40
+ "v_norm": true,
41
+ "vocab_size": 151669,
42
+ "z_loss_weight": 0.0,
43
+ "torch_dtype": "bfloat16"
44
+ }
model-00001-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc46fdbd151af3081c4cc7e2419d852cce2468903978c1995c596c338eceddc2
3
+ size 1152057368
model-00002-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5408b4516e5202af6308232f1bb50876fca6e3a1b974ea7e16a049e5c837f09
3
+ size 1157631912
model-00003-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d328ad19afb0c49701886092095939798118a20389433d2d96763a1d003bda1
3
+ size 1151556152
model-00004-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a4e5cdda0fd18ae868a8439139746f5fc7f0babf76efb606d4fe376c52ec8db
3
+ size 1151557240
model-00005-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07f62624b43cb23d6f0c51ec674b10d6373957a7f3338b254030c01f420d8dd0
3
+ size 1151557336
model.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import importlib.util
3
+ from typing import Optional, Tuple
4
+
5
+ import torch
6
+ import torch.nn as nn
7
+ import torch.nn.functional as F
8
+ from transformers import (
9
+ AutoConfig,
10
+ AutoModel,
11
+ AutoModelForCausalLM,
12
+ PreTrainedModel,
13
+ PretrainedConfig,
14
+ )
15
+ from transformers.modeling_outputs import CausalLMOutput
16
+
17
+
18
+ flash_attn_func = None
19
+ _flash_attn_available = False
20
+ if importlib.util.find_spec("flash_attn") is not None:
21
+ try:
22
+ from flash_attn.flash_attn_interface import flash_attn_func
23
+ _flash_attn_available = True
24
+ except ImportError:
25
+ _flash_attn_available = False
26
+
27
+
28
+ class ArgonneConfig(PretrainedConfig):
29
+ """Configuration for the Argonne v3.0 family of models."""
30
+
31
+ model_type = "argonne2"
32
+
33
+ def __init__(
34
+ self,
35
+ vocab_size: int = 151936,
36
+ hidden_size: int = 3072,
37
+ num_hidden_layers: int = 24,
38
+ num_attention_heads: int = 12,
39
+ num_key_value_heads: Optional[int] = 4,
40
+ intermediate_size: Optional[int] = 8192,
41
+ max_position_embeddings: int = 1024,
42
+ attention_dropout: float = 0.0,
43
+ hidden_dropout: float = 0.0,
44
+ rms_norm_eps: float = 1e-6,
45
+ rope_theta: float = 1000000.0,
46
+ sliding_window: Optional[int] = None,
47
+ use_flash_attention: bool = True,
48
+ use_gradient_checkpointing: bool = False,
49
+ qk_norm: bool = True,
50
+ v_norm: bool = True,
51
+ sandwich_norm: bool = True,
52
+ z_loss_weight: float = 0.0,
53
+ mtp_horizon: int = 1,
54
+ mtp_loss_weight: float = 0.0,
55
+ interleaved_local_attention: bool = True,
56
+ local_attention_window: Optional[int] = 256,
57
+ logit_softcap: float = 15.0,
58
+ tie_word_embeddings: bool = True,
59
+ attention_bias: bool = False,
60
+ mlp_bias: bool = False,
61
+ pad_token_id: Optional[int] = None,
62
+ bos_token_id: Optional[int] = None,
63
+ eos_token_id: Optional[int] = None,
64
+ **kwargs,
65
+ ) -> None:
66
+ pad_token_id = pad_token_id if pad_token_id is not None else kwargs.pop("pad_token_id", None)
67
+ bos_token_id = bos_token_id if bos_token_id is not None else kwargs.pop("bos_token_id", None)
68
+ eos_token_id = eos_token_id if eos_token_id is not None else kwargs.pop("eos_token_id", None)
69
+
70
+ super().__init__(
71
+ pad_token_id=pad_token_id,
72
+ bos_token_id=bos_token_id,
73
+ eos_token_id=eos_token_id,
74
+ **kwargs,
75
+ )
76
+ # Backwards compatibility with Argonne 1.x naming.
77
+ if "n_layer" in kwargs:
78
+ num_hidden_layers = kwargs["n_layer"]
79
+ if "n_head" in kwargs:
80
+ num_attention_heads = kwargs["n_head"]
81
+ if "n_embd" in kwargs:
82
+ hidden_size = kwargs["n_embd"]
83
+ if "block_size" in kwargs:
84
+ max_position_embeddings = kwargs["block_size"]
85
+
86
+ self.vocab_size = vocab_size
87
+ self.hidden_size = hidden_size
88
+ self.num_hidden_layers = num_hidden_layers
89
+ self.num_attention_heads = num_attention_heads
90
+ self.num_key_value_heads = (
91
+ num_key_value_heads if num_key_value_heads is not None else num_attention_heads // 2
92
+ )
93
+ if self.num_key_value_heads < 1:
94
+ self.num_key_value_heads = 1
95
+ if num_attention_heads % self.num_key_value_heads != 0:
96
+ raise ValueError("num_attention_heads must be divisible by num_key_value_heads")
97
+
98
+ if intermediate_size is None:
99
+ width = int(8 * hidden_size / 3)
100
+ self.intermediate_size = ((width + 255) // 256) * 256
101
+ else:
102
+ self.intermediate_size = intermediate_size
103
+
104
+ self.max_position_embeddings = max_position_embeddings
105
+ self.attention_dropout = attention_dropout
106
+ self.hidden_dropout = hidden_dropout
107
+ self.rms_norm_eps = rms_norm_eps
108
+ self.rope_theta = rope_theta
109
+ self.sliding_window = sliding_window
110
+ self.use_flash_attention = use_flash_attention
111
+ self.use_gradient_checkpointing = use_gradient_checkpointing
112
+ self.qk_norm = qk_norm
113
+ self.v_norm = v_norm
114
+ self.sandwich_norm = sandwich_norm
115
+ self.z_loss_weight = z_loss_weight
116
+ self.mtp_horizon = max(1, int(mtp_horizon))
117
+ self.mtp_loss_weight = float(mtp_loss_weight)
118
+ self.interleaved_local_attention = bool(interleaved_local_attention)
119
+ self.local_attention_window = (
120
+ int(local_attention_window) if local_attention_window is not None and int(local_attention_window) > 0 else None
121
+ )
122
+ self.logit_softcap = float(logit_softcap)
123
+ self.tie_word_embeddings = tie_word_embeddings
124
+ self.attention_bias = attention_bias
125
+ self.mlp_bias = mlp_bias
126
+
127
+ if self.pad_token_id is None and self.eos_token_id is not None:
128
+ self.pad_token_id = self.eos_token_id
129
+
130
+ # Backwards compatibility aliases
131
+ self.n_embd = self.hidden_size
132
+ self.n_layer = self.num_hidden_layers
133
+ self.n_head = self.num_attention_heads
134
+ self.block_size = self.max_position_embeddings
135
+
136
+
137
+ class RMSNorm(nn.Module):
138
+ def __init__(self, hidden_size: int, eps: float = 1e-6) -> None:
139
+ super().__init__()
140
+ self.eps = eps
141
+ self.weight = nn.Parameter(torch.ones(hidden_size))
142
+
143
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
144
+ orig_dtype = x.dtype
145
+ x = x.to(torch.float32)
146
+ # Clamp values to prevent overflow in pow(2)
147
+ x = torch.clamp(x, min=-65504.0, max=65504.0)
148
+ variance = x.pow(2).mean(-1, keepdim=True)
149
+ x = x * torch.rsqrt(variance + self.eps)
150
+ return (self.weight * x.to(orig_dtype))
151
+
152
+
153
+ class RotaryEmbedding(nn.Module):
154
+ def __init__(
155
+ self,
156
+ dim: int,
157
+ max_position_embeddings: int = 2048,
158
+ base: float = 10000.0,
159
+ device: Optional[torch.device] = None,
160
+ ) -> None:
161
+ super().__init__()
162
+ self.dim = dim
163
+ self.max_position_embeddings = max_position_embeddings
164
+ self.base = base
165
+
166
+ inv_freq = 1.0 / (
167
+ self.base
168
+ ** (torch.arange(0, dim, 2, dtype=torch.float32, device=device) / dim)
169
+ )
170
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
171
+ self._set_cos_sin_cache(max_position_embeddings, device or inv_freq.device, torch.get_default_dtype())
172
+
173
+ def _set_cos_sin_cache(self, seq_len: int, device: torch.device, dtype: torch.dtype) -> None:
174
+ self.max_seq_len_cached = seq_len
175
+ t = torch.arange(seq_len, device=device, dtype=self.inv_freq.dtype)
176
+ freqs = torch.outer(t, self.inv_freq)
177
+ emb = torch.cat((freqs, freqs), dim=-1)
178
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
179
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
180
+
181
+ def forward(self, x: torch.Tensor, seq_len: int) -> Tuple[torch.Tensor, torch.Tensor]:
182
+ if seq_len > self.max_seq_len_cached:
183
+ self._set_cos_sin_cache(seq_len, x.device, x.dtype)
184
+ return (
185
+ self.cos_cached[:seq_len].to(dtype=x.dtype, device=x.device),
186
+ self.sin_cached[:seq_len].to(dtype=x.dtype, device=x.device),
187
+ )
188
+
189
+
190
+ def rotate_half(x: torch.Tensor) -> torch.Tensor:
191
+ x1 = x[..., : x.shape[-1] // 2]
192
+ x2 = x[..., x.shape[-1] // 2 :]
193
+ return torch.cat((-x2, x1), dim=-1)
194
+
195
+
196
+ def apply_rotary_pos_emb(
197
+ q: torch.Tensor,
198
+ k: torch.Tensor,
199
+ cos: torch.Tensor,
200
+ sin: torch.Tensor,
201
+ position_ids: Optional[torch.Tensor] = None,
202
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
203
+ if position_ids is None:
204
+ cos = cos.unsqueeze(0).unsqueeze(0)
205
+ sin = sin.unsqueeze(0).unsqueeze(0)
206
+ else:
207
+ cos = cos[position_ids].unsqueeze(1)
208
+ sin = sin[position_ids].unsqueeze(1)
209
+
210
+ return (
211
+ (q * cos) + (rotate_half(q) * sin),
212
+ (k * cos) + (rotate_half(k) * sin),
213
+ )
214
+
215
+
216
+ class GroupedQueryAttention(nn.Module):
217
+ def __init__(self, config: ArgonneConfig) -> None:
218
+ super().__init__()
219
+ self.hidden_size = config.hidden_size
220
+ self.num_heads = config.num_attention_heads
221
+ self.num_kv_heads = config.num_key_value_heads
222
+ self.head_dim = self.hidden_size // self.num_heads
223
+ self.num_key_value_groups = self.num_heads // self.num_kv_heads
224
+ self.sliding_window = config.sliding_window
225
+ self.qk_norm = config.qk_norm
226
+ self.v_norm = config.v_norm
227
+
228
+ self.q_proj = nn.Linear(
229
+ self.hidden_size,
230
+ self.num_heads * self.head_dim,
231
+ bias=config.attention_bias,
232
+ )
233
+ self.k_proj = nn.Linear(
234
+ self.hidden_size,
235
+ self.num_kv_heads * self.head_dim,
236
+ bias=config.attention_bias,
237
+ )
238
+ self.v_proj = nn.Linear(
239
+ self.hidden_size,
240
+ self.num_kv_heads * self.head_dim,
241
+ bias=config.attention_bias,
242
+ )
243
+ self.o_proj = nn.Linear(
244
+ self.num_heads * self.head_dim,
245
+ self.hidden_size,
246
+ bias=config.attention_bias,
247
+ )
248
+ self.o_proj._is_residual = True
249
+
250
+ self.attention_dropout = config.attention_dropout
251
+ self.use_flash_attention = config.use_flash_attention
252
+ if self.qk_norm:
253
+ self.q_norm = RMSNorm(self.head_dim, eps=config.rms_norm_eps)
254
+ self.k_norm = RMSNorm(self.head_dim, eps=config.rms_norm_eps)
255
+ if self.v_norm:
256
+ self.v_norm_layer = RMSNorm(self.head_dim, eps=config.rms_norm_eps)
257
+
258
+ def _repeat_kv(self, x: torch.Tensor) -> torch.Tensor:
259
+ if self.num_key_value_groups == 1:
260
+ return x
261
+ bsz, num_kv, seqlen, head_dim = x.shape
262
+ x = x[:, :, None, :, :].expand(bsz, num_kv, self.num_key_value_groups, seqlen, head_dim)
263
+ return x.reshape(bsz, num_kv * self.num_key_value_groups, seqlen, head_dim)
264
+
265
+ def forward(
266
+ self,
267
+ hidden_states: torch.Tensor,
268
+ position_embeddings: Tuple[torch.Tensor, torch.Tensor],
269
+ attention_mask: Optional[torch.Tensor] = None,
270
+ ) -> torch.Tensor:
271
+ bsz, seqlen, _ = hidden_states.shape
272
+
273
+ query = self.q_proj(hidden_states)
274
+ key = self.k_proj(hidden_states)
275
+ value = self.v_proj(hidden_states)
276
+
277
+ query = query.view(bsz, seqlen, self.num_heads, self.head_dim).transpose(1, 2)
278
+ key = key.view(bsz, seqlen, self.num_kv_heads, self.head_dim).transpose(1, 2)
279
+ value = value.view(bsz, seqlen, self.num_kv_heads, self.head_dim).transpose(1, 2)
280
+ if self.qk_norm:
281
+ query = self.q_norm(query)
282
+ key = self.k_norm(key)
283
+ if self.v_norm:
284
+ value = self.v_norm_layer(value)
285
+
286
+ cos, sin = position_embeddings
287
+ query, key = apply_rotary_pos_emb(query, key, cos, sin)
288
+
289
+ key = self._repeat_kv(key)
290
+ value = self._repeat_kv(value)
291
+
292
+ use_flash_attn_2 = (
293
+ _flash_attn_available
294
+ and self.use_flash_attention
295
+ and attention_mask is None
296
+ and query.dtype in (torch.float16, torch.bfloat16)
297
+ and self.head_dim % 4 == 0
298
+ )
299
+ use_scaled_dot = (
300
+ hasattr(F, "scaled_dot_product_attention")
301
+ and self.use_flash_attention
302
+ and query.dtype in (torch.float16, torch.bfloat16)
303
+ and self.head_dim % 4 == 0
304
+ )
305
+
306
+ attn_output = None
307
+ if use_flash_attn_2:
308
+ try:
309
+ flash_dropout = self.attention_dropout if self.training else 0.0
310
+ window = (
311
+ (self.sliding_window, self.sliding_window)
312
+ if self.sliding_window is not None
313
+ else (-1, -1)
314
+ )
315
+ q = query.transpose(1, 2).contiguous()
316
+ k = key.transpose(1, 2).contiguous()
317
+ v = value.transpose(1, 2).contiguous()
318
+ attn_output = flash_attn_func(
319
+ q,
320
+ k,
321
+ v,
322
+ dropout_p=flash_dropout,
323
+ softmax_scale=None,
324
+ causal=True,
325
+ window_size=window,
326
+ ).transpose(1, 2)
327
+ except RuntimeError:
328
+ attn_output = None
329
+
330
+ if attn_output is None and use_scaled_dot:
331
+ try:
332
+ # Use is_causal=True when no attention_mask (faster Flash Attention path)
333
+ # When attention_mask is provided, we need to combine it with causal masking
334
+ if attention_mask is None:
335
+ attn_output = F.scaled_dot_product_attention(
336
+ query,
337
+ key,
338
+ value,
339
+ attn_mask=None,
340
+ dropout_p=self.attention_dropout if self.training else 0.0,
341
+ is_causal=True,
342
+ )
343
+ else:
344
+ # With attention_mask: need to pass it explicitly (slower but correct)
345
+ # attention_mask should be 4D: (bsz, 1, seq, seq) or broadcastable
346
+ attn_output = F.scaled_dot_product_attention(
347
+ query,
348
+ key,
349
+ value,
350
+ attn_mask=attention_mask,
351
+ dropout_p=self.attention_dropout if self.training else 0.0,
352
+ is_causal=False, # Mask already includes causal component
353
+ )
354
+ except RuntimeError:
355
+ # Fallback to math attention when kernels are unavailable
356
+ attn_output = None
357
+
358
+ if attn_output is None:
359
+ scores = torch.matmul(query, key.transpose(2, 3)) / math.sqrt(self.head_dim)
360
+ # Apply causal mask - use large negative instead of -inf for numerical stability
361
+ causal_mask = torch.triu(
362
+ torch.ones(seqlen, seqlen, dtype=torch.bool, device=hidden_states.device),
363
+ diagonal=1,
364
+ )
365
+ mask_value = -65504.0 # Large negative instead of -inf
366
+ scores = scores.masked_fill(causal_mask, mask_value)
367
+ # Apply attention_mask if provided
368
+ if attention_mask is not None:
369
+ scores = scores + attention_mask
370
+ attn_weights = torch.softmax(scores, dim=-1, dtype=torch.float32).to(query.dtype)
371
+ attn_weights = F.dropout(attn_weights, p=self.attention_dropout, training=self.training)
372
+ attn_output = torch.matmul(attn_weights, value)
373
+
374
+ attn_output = (
375
+ attn_output.transpose(1, 2)
376
+ .contiguous()
377
+ .view(bsz, seqlen, self.num_heads * self.head_dim)
378
+ )
379
+ return self.o_proj(attn_output)
380
+
381
+
382
+ class SwiGLUMLP(nn.Module):
383
+ def __init__(self, config: ArgonneConfig) -> None:
384
+ super().__init__()
385
+ self.gate_proj = nn.Linear(
386
+ config.hidden_size,
387
+ config.intermediate_size,
388
+ bias=config.mlp_bias,
389
+ )
390
+ self.up_proj = nn.Linear(
391
+ config.hidden_size,
392
+ config.intermediate_size,
393
+ bias=config.mlp_bias,
394
+ )
395
+ self.down_proj = nn.Linear(
396
+ config.intermediate_size,
397
+ config.hidden_size,
398
+ bias=config.mlp_bias,
399
+ )
400
+ self.down_proj._is_residual = True
401
+ self.dropout = nn.Dropout(config.hidden_dropout)
402
+
403
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
404
+ # Clamp intermediate values to prevent overflow
405
+ gate = self.gate_proj(x)
406
+ gate = torch.clamp(gate, min=-65504.0, max=65504.0)
407
+ up = self.up_proj(x)
408
+ up = torch.clamp(up, min=-65504.0, max=65504.0)
409
+ return self.dropout(self.down_proj(F.silu(gate) * up))
410
+
411
+
412
+ class Block(nn.Module):
413
+ """Transformer block with GQA attention and SwiGLU feed-forward."""
414
+
415
+ def __init__(self, config: ArgonneConfig, layer_idx: int = 0) -> None:
416
+ super().__init__()
417
+ self.layer_idx = layer_idx
418
+ self.attn = GroupedQueryAttention(config)
419
+ self.input_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
420
+ self.post_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
421
+ self.sandwich_norm = config.sandwich_norm
422
+ if self.sandwich_norm:
423
+ self.attn_out_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
424
+ self.mlp_out_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
425
+ self.mlp = SwiGLUMLP(config)
426
+
427
+ def forward(
428
+ self,
429
+ hidden_states: torch.Tensor,
430
+ position_embeddings: Tuple[torch.Tensor, torch.Tensor],
431
+ attention_mask: Optional[torch.Tensor] = None,
432
+ ) -> torch.Tensor:
433
+ residual = hidden_states
434
+ hidden_states = self.input_norm(hidden_states)
435
+ hidden_states = self.attn(hidden_states, position_embeddings, attention_mask)
436
+ if self.sandwich_norm:
437
+ hidden_states = self.attn_out_norm(hidden_states)
438
+ hidden_states = residual + hidden_states
439
+
440
+ residual = hidden_states
441
+ hidden_states = self.post_norm(hidden_states)
442
+ hidden_states = self.mlp(hidden_states)
443
+ if self.sandwich_norm:
444
+ hidden_states = self.mlp_out_norm(hidden_states)
445
+ hidden_states = residual + hidden_states
446
+
447
+ return hidden_states
448
+
449
+
450
+ class ArgonneModel(PreTrainedModel):
451
+ config_class = ArgonneConfig
452
+ _no_split_modules = ["Block"]
453
+ _tied_weights_keys = {"lm_head.weight": "embed_tokens.weight"}
454
+
455
+ def __init__(self, config: ArgonneConfig) -> None:
456
+ super().__init__(config)
457
+ self.config = config
458
+
459
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size)
460
+ self.blocks = nn.ModuleList([Block(config, idx) for idx in range(config.num_hidden_layers)])
461
+ if config.interleaved_local_attention and config.local_attention_window is not None:
462
+ for idx, block in enumerate(self.blocks):
463
+ block.attn.sliding_window = config.local_attention_window if (idx % 2 == 1) else None
464
+ self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
465
+ self.rotary_emb = RotaryEmbedding(
466
+ config.hidden_size // config.num_attention_heads,
467
+ max_position_embeddings=config.max_position_embeddings,
468
+ base=config.rope_theta,
469
+ )
470
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
471
+
472
+ if config.tie_word_embeddings:
473
+ self.lm_head.weight = self.embed_tokens.weight
474
+
475
+ self.gradient_checkpointing = config.use_gradient_checkpointing
476
+ self.post_init()
477
+
478
+ def get_input_embeddings(self) -> nn.Embedding:
479
+ return self.embed_tokens
480
+
481
+ def set_input_embeddings(self, new_embeddings: nn.Embedding) -> None:
482
+ self.embed_tokens = new_embeddings
483
+ self.config.vocab_size = new_embeddings.num_embeddings
484
+ if self.config.tie_word_embeddings:
485
+ self.lm_head.weight = self.embed_tokens.weight
486
+
487
+ def get_output_embeddings(self) -> nn.Module:
488
+ return self.lm_head
489
+
490
+ def set_output_embeddings(self, new_embeddings: nn.Module) -> None:
491
+ self.lm_head = new_embeddings
492
+ if isinstance(new_embeddings, nn.Linear):
493
+ self.config.vocab_size = new_embeddings.out_features
494
+
495
+ def tie_weights(self, **kwargs) -> None:
496
+ if self.config.tie_word_embeddings:
497
+ self.lm_head.weight = self.embed_tokens.weight
498
+
499
+ def _init_weights(self, module: nn.Module) -> None:
500
+ if isinstance(module, nn.Linear):
501
+ std = self.config.hidden_size ** -0.5
502
+ if hasattr(module, "_is_residual"):
503
+ std = (2 * self.config.num_hidden_layers) ** -0.5
504
+ nn.init.normal_(module.weight, mean=0.0, std=std)
505
+ if module.bias is not None:
506
+ nn.init.zeros_(module.bias)
507
+ elif isinstance(module, nn.Embedding):
508
+ nn.init.normal_(module.weight, mean=0.0, std=self.config.hidden_size ** -0.5)
509
+
510
+ def set_gradient_checkpointing(self, enabled: bool = True) -> None:
511
+ self.gradient_checkpointing = enabled
512
+
513
+ def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs=None) -> None:
514
+ self.set_gradient_checkpointing(True)
515
+
516
+ def gradient_checkpointing_disable(self) -> None:
517
+ self.set_gradient_checkpointing(False)
518
+
519
+ def forward(
520
+ self,
521
+ input_ids: torch.LongTensor,
522
+ attention_mask: Optional[torch.Tensor] = None,
523
+ labels: Optional[torch.LongTensor] = None,
524
+ position_ids: Optional[torch.LongTensor] = None,
525
+ **kwargs, # Accept extra args from newer transformers (e.g., num_items_in_batch)
526
+ ) -> CausalLMOutput:
527
+ _, seq_length = input_ids.shape
528
+
529
+ device = self.embed_tokens.weight.device
530
+ if input_ids.device != device:
531
+ input_ids = input_ids.to(device)
532
+ hidden_states = self.embed_tokens(input_ids)
533
+
534
+ # The training path does not use attention masks.
535
+ attention_mask = None
536
+ cos, sin = self.rotary_emb(hidden_states, seq_length)
537
+ rotary = (cos, sin)
538
+
539
+ for layer in self.blocks:
540
+ if self.gradient_checkpointing and self.training:
541
+ hidden_states = torch.utils.checkpoint.checkpoint(
542
+ layer,
543
+ hidden_states,
544
+ rotary,
545
+ attention_mask,
546
+ use_reentrant=False,
547
+ )
548
+ else:
549
+ hidden_states = layer(hidden_states, rotary, attention_mask)
550
+
551
+ hidden_states = self.norm(hidden_states)
552
+ logits = self.lm_head(hidden_states)
553
+ if self.config.logit_softcap > 0:
554
+ cap = self.config.logit_softcap
555
+ logits = torch.tanh(logits / cap) * cap
556
+
557
+ # Check for NaN in logits and handle gracefully
558
+ if torch.isnan(logits).any():
559
+ # Replace NaN with zeros to prevent cascading failures
560
+ logits = torch.nan_to_num(logits, nan=0.0, posinf=65504.0, neginf=-65504.0)
561
+
562
+ loss = None
563
+ if labels is not None:
564
+ if labels.device != logits.device:
565
+ labels = labels.to(logits.device)
566
+ loss = F.cross_entropy(
567
+ logits.view(-1, logits.size(-1)),
568
+ labels.view(-1),
569
+ ignore_index=-100,
570
+ )
571
+ if self.training and self.config.mtp_horizon > 1:
572
+ mtp_terms = []
573
+ max_horizon = min(self.config.mtp_horizon, labels.shape[1])
574
+ for horizon in range(2, max_horizon + 1):
575
+ shift = horizon - 1
576
+ shifted_logits = logits[:, :-shift, :]
577
+ shifted_labels = labels[:, shift:]
578
+ if shifted_logits.numel() == 0:
579
+ continue
580
+ mtp_loss = F.cross_entropy(
581
+ shifted_logits.reshape(-1, shifted_logits.size(-1)),
582
+ shifted_labels.reshape(-1),
583
+ ignore_index=-100,
584
+ )
585
+ mtp_terms.append(mtp_loss / horizon)
586
+ if mtp_terms:
587
+ loss = loss + (self.config.mtp_loss_weight * torch.stack(mtp_terms).mean()).to(loss.dtype)
588
+ if self.config.z_loss_weight > 0:
589
+ z = torch.logsumexp(logits.float(), dim=-1)
590
+ loss = loss + (self.config.z_loss_weight * z.pow(2).mean()).to(loss.dtype)
591
+
592
+ # Handle NaN loss
593
+ if torch.isnan(loss):
594
+ loss = torch.tensor(0.0, device=loss.device, dtype=loss.dtype, requires_grad=True)
595
+
596
+ return CausalLMOutput(logits=logits, loss=loss)
597
+
598
+ @torch.no_grad()
599
+ def generate(
600
+ self,
601
+ input_ids: torch.Tensor,
602
+ max_length: int = 1024,
603
+ temperature: float = 1.0,
604
+ top_k: Optional[int] = None,
605
+ top_p: Optional[float] = None,
606
+ do_sample: bool = True,
607
+ repetition_penalty: float = 1.0,
608
+ no_repeat_ngram_size: int = 0,
609
+ ) -> torch.Tensor:
610
+ self.eval()
611
+ device = self.embed_tokens.weight.device
612
+ input_ids = input_ids.to(device)
613
+ while input_ids.shape[1] < max_length:
614
+ chunk = input_ids[:, -self.config.max_position_embeddings :]
615
+ outputs = self.forward(chunk)
616
+ logits = outputs.logits[:, -1, :] / temperature
617
+
618
+ if repetition_penalty != 1.0:
619
+ for b in range(input_ids.shape[0]):
620
+ seen_tokens = torch.unique(input_ids[b])
621
+ seen_logits = logits[b, seen_tokens]
622
+ adjusted = torch.where(
623
+ seen_logits < 0,
624
+ seen_logits * repetition_penalty,
625
+ seen_logits / repetition_penalty,
626
+ )
627
+ logits[b, seen_tokens] = adjusted
628
+
629
+ if no_repeat_ngram_size > 0 and input_ids.shape[1] + 1 >= no_repeat_ngram_size:
630
+ n = int(no_repeat_ngram_size)
631
+ for b in range(input_ids.shape[0]):
632
+ seq = input_ids[b].tolist()
633
+ ngrams = {}
634
+ for i in range(len(seq) - n + 1):
635
+ prefix = tuple(seq[i : i + n - 1]) if n > 1 else tuple()
636
+ next_token = seq[i + n - 1]
637
+ if prefix not in ngrams:
638
+ ngrams[prefix] = set()
639
+ ngrams[prefix].add(next_token)
640
+ current_prefix = tuple(seq[-(n - 1) :]) if n > 1 else tuple()
641
+ banned = ngrams.get(current_prefix, set())
642
+ if banned:
643
+ logits[b, list(banned)] = float("-inf")
644
+
645
+ if do_sample:
646
+ if top_k is not None:
647
+ top_values, _ = torch.topk(logits, min(top_k, logits.size(-1)))
648
+ logits = logits.masked_fill(logits < top_values[:, [-1]], float("-inf"))
649
+ if top_p is not None:
650
+ sorted_logits, sorted_indices = torch.sort(logits, descending=True)
651
+ cumulative_probs = torch.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1)
652
+ sorted_indices_to_remove = cumulative_probs > top_p
653
+ sorted_indices_to_remove[..., 1:] = sorted_indices_to_remove[..., :-1].clone()
654
+ sorted_indices_to_remove[..., 0] = 0
655
+ indices_to_remove = sorted_indices_to_remove.scatter(1, sorted_indices, sorted_indices_to_remove)
656
+ logits = logits.masked_fill(indices_to_remove, float("-inf"))
657
+ probs = F.softmax(logits, dim=-1)
658
+ next_token = torch.multinomial(probs, num_samples=1)
659
+ else:
660
+ next_token = torch.argmax(logits, dim=-1, keepdim=True)
661
+
662
+ input_ids = torch.cat([input_ids, next_token.to(input_ids.device)], dim=-1)
663
+ if input_ids.shape[1] >= max_length:
664
+ break
665
+ return input_ids.to(device)
666
+
667
+
668
+ AutoConfig.register("argonne2", ArgonneConfig)
669
+ AutoModel.register(ArgonneConfig, ArgonneModel)
670
+ AutoModelForCausalLM.register(ArgonneConfig, ArgonneModel)
671
+
672
+ # Backwards compatibility exports
673
+ CausalSelfAttention = GroupedQueryAttention
674
+ MLP = SwiGLUMLP
model.safetensors.index.json ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 5764325376
4
+ },
5
+ "weight_map": {
6
+ "embed_tokens.weight": "model-00001-of-00005.safetensors",
7
+ "blocks.12.attn.o_proj.weight": "model-00001-of-00005.safetensors",
8
+ "blocks.14.attn.q_proj.weight": "model-00001-of-00005.safetensors",
9
+ "blocks.17.attn.o_proj.weight": "model-00001-of-00005.safetensors",
10
+ "blocks.19.attn.q_proj.weight": "model-00001-of-00005.safetensors",
11
+ "blocks.21.attn.o_proj.weight": "model-00001-of-00005.safetensors",
12
+ "blocks.23.attn.q_proj.weight": "model-00001-of-00005.safetensors",
13
+ "blocks.5.attn.o_proj.weight": "model-00001-of-00005.safetensors",
14
+ "blocks.7.attn.q_proj.weight": "model-00001-of-00005.safetensors",
15
+ "blocks.0.attn.k_proj.weight": "model-00001-of-00005.safetensors",
16
+ "blocks.0.attn.v_proj.weight": "model-00001-of-00005.safetensors",
17
+ "blocks.11.attn.k_proj.weight": "model-00001-of-00005.safetensors",
18
+ "blocks.13.attn.v_proj.weight": "model-00001-of-00005.safetensors",
19
+ "blocks.16.attn.k_proj.weight": "model-00001-of-00005.safetensors",
20
+ "blocks.18.attn.v_proj.weight": "model-00001-of-00005.safetensors",
21
+ "blocks.20.attn.k_proj.weight": "model-00001-of-00005.safetensors",
22
+ "blocks.22.attn.v_proj.weight": "model-00001-of-00005.safetensors",
23
+ "blocks.4.attn.k_proj.weight": "model-00001-of-00005.safetensors",
24
+ "blocks.6.attn.v_proj.weight": "model-00001-of-00005.safetensors",
25
+ "blocks.9.attn.k_proj.weight": "model-00001-of-00005.safetensors",
26
+ "blocks.0.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
27
+ "blocks.1.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
28
+ "blocks.10.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
29
+ "blocks.12.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
30
+ "blocks.13.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
31
+ "blocks.14.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
32
+ "blocks.16.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
33
+ "blocks.17.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
34
+ "blocks.18.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
35
+ "blocks.2.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
36
+ "blocks.20.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
37
+ "blocks.21.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
38
+ "blocks.23.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
39
+ "blocks.3.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
40
+ "blocks.4.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
41
+ "blocks.6.mlp.down_proj.weight": "model-00002-of-00005.safetensors",
42
+ "blocks.7.mlp.gate_proj.weight": "model-00002-of-00005.safetensors",
43
+ "blocks.8.mlp.up_proj.weight": "model-00002-of-00005.safetensors",
44
+ "blocks.0.attn.o_proj.weight": "model-00002-of-00005.safetensors",
45
+ "blocks.10.attn.o_proj.weight": "model-00002-of-00005.safetensors",
46
+ "blocks.12.attn.q_proj.weight": "model-00002-of-00005.safetensors",
47
+ "blocks.15.attn.o_proj.weight": "model-00002-of-00005.safetensors",
48
+ "blocks.17.attn.q_proj.weight": "model-00002-of-00005.safetensors",
49
+ "blocks.2.attn.o_proj.weight": "model-00002-of-00005.safetensors",
50
+ "blocks.21.attn.q_proj.weight": "model-00002-of-00005.safetensors",
51
+ "blocks.3.attn.o_proj.weight": "model-00002-of-00005.safetensors",
52
+ "blocks.5.attn.q_proj.weight": "model-00002-of-00005.safetensors",
53
+ "blocks.8.attn.o_proj.weight": "model-00002-of-00005.safetensors",
54
+ "blocks.1.attn.k_proj.weight": "model-00002-of-00005.safetensors",
55
+ "blocks.11.attn.v_proj.weight": "model-00002-of-00005.safetensors",
56
+ "blocks.14.attn.k_proj.weight": "model-00002-of-00005.safetensors",
57
+ "blocks.16.attn.v_proj.weight": "model-00002-of-00005.safetensors",
58
+ "blocks.19.attn.k_proj.weight": "model-00002-of-00005.safetensors",
59
+ "blocks.20.attn.v_proj.weight": "model-00002-of-00005.safetensors",
60
+ "blocks.23.attn.k_proj.weight": "model-00002-of-00005.safetensors",
61
+ "blocks.4.attn.v_proj.weight": "model-00002-of-00005.safetensors",
62
+ "blocks.7.attn.k_proj.weight": "model-00002-of-00005.safetensors",
63
+ "blocks.9.attn.v_proj.weight": "model-00002-of-00005.safetensors",
64
+ "blocks.0.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
65
+ "blocks.1.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
66
+ "blocks.11.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
67
+ "blocks.12.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
68
+ "blocks.13.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
69
+ "blocks.15.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
70
+ "blocks.16.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
71
+ "blocks.17.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
72
+ "blocks.19.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
73
+ "blocks.2.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
74
+ "blocks.20.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
75
+ "blocks.22.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
76
+ "blocks.23.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
77
+ "blocks.3.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
78
+ "blocks.5.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
79
+ "blocks.6.mlp.gate_proj.weight": "model-00003-of-00005.safetensors",
80
+ "blocks.7.mlp.up_proj.weight": "model-00003-of-00005.safetensors",
81
+ "blocks.9.mlp.down_proj.weight": "model-00003-of-00005.safetensors",
82
+ "blocks.0.attn.q_proj.weight": "model-00003-of-00005.safetensors",
83
+ "blocks.10.attn.q_proj.weight": "model-00003-of-00005.safetensors",
84
+ "blocks.13.attn.o_proj.weight": "model-00003-of-00005.safetensors",
85
+ "blocks.15.attn.q_proj.weight": "model-00003-of-00005.safetensors",
86
+ "blocks.18.attn.o_proj.weight": "model-00003-of-00005.safetensors",
87
+ "blocks.2.attn.q_proj.weight": "model-00003-of-00005.safetensors",
88
+ "blocks.22.attn.o_proj.weight": "model-00003-of-00005.safetensors",
89
+ "blocks.3.attn.q_proj.weight": "model-00003-of-00005.safetensors",
90
+ "blocks.6.attn.o_proj.weight": "model-00003-of-00005.safetensors",
91
+ "blocks.8.attn.q_proj.weight": "model-00003-of-00005.safetensors",
92
+ "blocks.1.attn.v_proj.weight": "model-00003-of-00005.safetensors",
93
+ "blocks.12.attn.k_proj.weight": "model-00003-of-00005.safetensors",
94
+ "blocks.14.attn.v_proj.weight": "model-00003-of-00005.safetensors",
95
+ "blocks.17.attn.k_proj.weight": "model-00003-of-00005.safetensors",
96
+ "blocks.19.attn.v_proj.weight": "model-00003-of-00005.safetensors",
97
+ "blocks.21.attn.k_proj.weight": "model-00003-of-00005.safetensors",
98
+ "blocks.23.attn.v_proj.weight": "model-00003-of-00005.safetensors",
99
+ "blocks.5.attn.k_proj.weight": "model-00003-of-00005.safetensors",
100
+ "blocks.7.attn.v_proj.weight": "model-00003-of-00005.safetensors",
101
+ "blocks.0.attn_out_norm.weight": "model-00003-of-00005.safetensors",
102
+ "blocks.0.post_norm.weight": "model-00003-of-00005.safetensors",
103
+ "blocks.1.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
104
+ "blocks.10.input_norm.weight": "model-00003-of-00005.safetensors",
105
+ "blocks.11.attn_out_norm.weight": "model-00003-of-00005.safetensors",
106
+ "blocks.11.post_norm.weight": "model-00003-of-00005.safetensors",
107
+ "blocks.12.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
108
+ "blocks.13.input_norm.weight": "model-00003-of-00005.safetensors",
109
+ "blocks.14.attn_out_norm.weight": "model-00003-of-00005.safetensors",
110
+ "blocks.14.post_norm.weight": "model-00003-of-00005.safetensors",
111
+ "blocks.15.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
112
+ "blocks.16.input_norm.weight": "model-00003-of-00005.safetensors",
113
+ "blocks.17.attn_out_norm.weight": "model-00003-of-00005.safetensors",
114
+ "blocks.17.post_norm.weight": "model-00003-of-00005.safetensors",
115
+ "blocks.18.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
116
+ "blocks.19.input_norm.weight": "model-00003-of-00005.safetensors",
117
+ "blocks.2.attn_out_norm.weight": "model-00003-of-00005.safetensors",
118
+ "blocks.2.post_norm.weight": "model-00003-of-00005.safetensors",
119
+ "blocks.20.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
120
+ "blocks.21.input_norm.weight": "model-00003-of-00005.safetensors",
121
+ "blocks.22.attn_out_norm.weight": "model-00003-of-00005.safetensors",
122
+ "blocks.22.post_norm.weight": "model-00003-of-00005.safetensors",
123
+ "blocks.23.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
124
+ "blocks.3.input_norm.weight": "model-00003-of-00005.safetensors",
125
+ "blocks.4.attn_out_norm.weight": "model-00003-of-00005.safetensors",
126
+ "blocks.4.post_norm.weight": "model-00003-of-00005.safetensors",
127
+ "blocks.5.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
128
+ "blocks.6.input_norm.weight": "model-00003-of-00005.safetensors",
129
+ "blocks.7.attn_out_norm.weight": "model-00003-of-00005.safetensors",
130
+ "blocks.7.post_norm.weight": "model-00003-of-00005.safetensors",
131
+ "blocks.8.mlp_out_norm.weight": "model-00003-of-00005.safetensors",
132
+ "blocks.9.input_norm.weight": "model-00003-of-00005.safetensors",
133
+ "norm.weight": "model-00003-of-00005.safetensors",
134
+ "blocks.16.attn.k_norm.weight": "model-00003-of-00005.safetensors",
135
+ "blocks.17.attn.k_norm.weight": "model-00003-of-00005.safetensors",
136
+ "blocks.18.attn.k_norm.weight": "model-00003-of-00005.safetensors",
137
+ "blocks.19.attn.k_norm.weight": "model-00003-of-00005.safetensors",
138
+ "blocks.2.attn.k_norm.weight": "model-00003-of-00005.safetensors",
139
+ "blocks.20.attn.k_norm.weight": "model-00003-of-00005.safetensors",
140
+ "blocks.21.attn.k_norm.weight": "model-00003-of-00005.safetensors",
141
+ "blocks.22.attn.k_norm.weight": "model-00003-of-00005.safetensors",
142
+ "blocks.23.attn.k_norm.weight": "model-00003-of-00005.safetensors",
143
+ "blocks.3.attn.k_norm.weight": "model-00003-of-00005.safetensors",
144
+ "blocks.4.attn.k_norm.weight": "model-00003-of-00005.safetensors",
145
+ "blocks.5.attn.k_norm.weight": "model-00003-of-00005.safetensors",
146
+ "blocks.6.attn.k_norm.weight": "model-00003-of-00005.safetensors",
147
+ "blocks.7.attn.k_norm.weight": "model-00003-of-00005.safetensors",
148
+ "blocks.8.attn.k_norm.weight": "model-00003-of-00005.safetensors",
149
+ "blocks.9.attn.k_norm.weight": "model-00003-of-00005.safetensors",
150
+ "blocks.0.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
151
+ "blocks.10.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
152
+ "blocks.11.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
153
+ "blocks.12.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
154
+ "blocks.14.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
155
+ "blocks.15.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
156
+ "blocks.16.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
157
+ "blocks.18.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
158
+ "blocks.19.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
159
+ "blocks.2.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
160
+ "blocks.21.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
161
+ "blocks.22.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
162
+ "blocks.23.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
163
+ "blocks.4.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
164
+ "blocks.5.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
165
+ "blocks.6.mlp.up_proj.weight": "model-00004-of-00005.safetensors",
166
+ "blocks.8.mlp.down_proj.weight": "model-00004-of-00005.safetensors",
167
+ "blocks.9.mlp.gate_proj.weight": "model-00004-of-00005.safetensors",
168
+ "blocks.1.attn.o_proj.weight": "model-00004-of-00005.safetensors",
169
+ "blocks.11.attn.o_proj.weight": "model-00004-of-00005.safetensors",
170
+ "blocks.13.attn.q_proj.weight": "model-00004-of-00005.safetensors",
171
+ "blocks.16.attn.o_proj.weight": "model-00004-of-00005.safetensors",
172
+ "blocks.18.attn.q_proj.weight": "model-00004-of-00005.safetensors",
173
+ "blocks.20.attn.o_proj.weight": "model-00004-of-00005.safetensors",
174
+ "blocks.22.attn.q_proj.weight": "model-00004-of-00005.safetensors",
175
+ "blocks.4.attn.o_proj.weight": "model-00004-of-00005.safetensors",
176
+ "blocks.6.attn.q_proj.weight": "model-00004-of-00005.safetensors",
177
+ "blocks.9.attn.o_proj.weight": "model-00004-of-00005.safetensors",
178
+ "blocks.10.attn.k_proj.weight": "model-00004-of-00005.safetensors",
179
+ "blocks.12.attn.v_proj.weight": "model-00004-of-00005.safetensors",
180
+ "blocks.15.attn.k_proj.weight": "model-00004-of-00005.safetensors",
181
+ "blocks.17.attn.v_proj.weight": "model-00004-of-00005.safetensors",
182
+ "blocks.2.attn.k_proj.weight": "model-00004-of-00005.safetensors",
183
+ "blocks.21.attn.v_proj.weight": "model-00004-of-00005.safetensors",
184
+ "blocks.3.attn.k_proj.weight": "model-00004-of-00005.safetensors",
185
+ "blocks.5.attn.v_proj.weight": "model-00004-of-00005.safetensors",
186
+ "blocks.8.attn.k_proj.weight": "model-00004-of-00005.safetensors",
187
+ "blocks.0.input_norm.weight": "model-00004-of-00005.safetensors",
188
+ "blocks.1.attn_out_norm.weight": "model-00004-of-00005.safetensors",
189
+ "blocks.1.post_norm.weight": "model-00004-of-00005.safetensors",
190
+ "blocks.10.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
191
+ "blocks.11.input_norm.weight": "model-00004-of-00005.safetensors",
192
+ "blocks.12.attn_out_norm.weight": "model-00004-of-00005.safetensors",
193
+ "blocks.12.post_norm.weight": "model-00004-of-00005.safetensors",
194
+ "blocks.13.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
195
+ "blocks.14.input_norm.weight": "model-00004-of-00005.safetensors",
196
+ "blocks.15.attn_out_norm.weight": "model-00004-of-00005.safetensors",
197
+ "blocks.15.post_norm.weight": "model-00004-of-00005.safetensors",
198
+ "blocks.16.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
199
+ "blocks.17.input_norm.weight": "model-00004-of-00005.safetensors",
200
+ "blocks.18.attn_out_norm.weight": "model-00004-of-00005.safetensors",
201
+ "blocks.18.post_norm.weight": "model-00004-of-00005.safetensors",
202
+ "blocks.19.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
203
+ "blocks.2.input_norm.weight": "model-00004-of-00005.safetensors",
204
+ "blocks.20.attn_out_norm.weight": "model-00004-of-00005.safetensors",
205
+ "blocks.20.post_norm.weight": "model-00004-of-00005.safetensors",
206
+ "blocks.21.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
207
+ "blocks.22.input_norm.weight": "model-00004-of-00005.safetensors",
208
+ "blocks.23.attn_out_norm.weight": "model-00004-of-00005.safetensors",
209
+ "blocks.23.post_norm.weight": "model-00004-of-00005.safetensors",
210
+ "blocks.3.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
211
+ "blocks.4.input_norm.weight": "model-00004-of-00005.safetensors",
212
+ "blocks.5.attn_out_norm.weight": "model-00004-of-00005.safetensors",
213
+ "blocks.5.post_norm.weight": "model-00004-of-00005.safetensors",
214
+ "blocks.6.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
215
+ "blocks.7.input_norm.weight": "model-00004-of-00005.safetensors",
216
+ "blocks.8.attn_out_norm.weight": "model-00004-of-00005.safetensors",
217
+ "blocks.8.post_norm.weight": "model-00004-of-00005.safetensors",
218
+ "blocks.9.mlp_out_norm.weight": "model-00004-of-00005.safetensors",
219
+ "blocks.0.attn.k_norm.weight": "model-00004-of-00005.safetensors",
220
+ "blocks.0.attn.v_norm_layer.weight": "model-00004-of-00005.safetensors",
221
+ "blocks.1.attn.q_norm.weight": "model-00004-of-00005.safetensors",
222
+ "blocks.10.attn.k_norm.weight": "model-00004-of-00005.safetensors",
223
+ "blocks.10.attn.v_norm_layer.weight": "model-00004-of-00005.safetensors",
224
+ "blocks.11.attn.q_norm.weight": "model-00004-of-00005.safetensors",
225
+ "blocks.12.attn.k_norm.weight": "model-00004-of-00005.safetensors",
226
+ "blocks.12.attn.v_norm_layer.weight": "model-00004-of-00005.safetensors",
227
+ "blocks.13.attn.q_norm.weight": "model-00004-of-00005.safetensors",
228
+ "blocks.14.attn.k_norm.weight": "model-00004-of-00005.safetensors",
229
+ "blocks.14.attn.v_norm_layer.weight": "model-00004-of-00005.safetensors",
230
+ "blocks.15.attn.q_norm.weight": "model-00004-of-00005.safetensors",
231
+ "blocks.16.attn.q_norm.weight": "model-00004-of-00005.safetensors",
232
+ "blocks.17.attn.q_norm.weight": "model-00004-of-00005.safetensors",
233
+ "blocks.18.attn.q_norm.weight": "model-00004-of-00005.safetensors",
234
+ "blocks.19.attn.q_norm.weight": "model-00004-of-00005.safetensors",
235
+ "blocks.2.attn.q_norm.weight": "model-00004-of-00005.safetensors",
236
+ "blocks.20.attn.q_norm.weight": "model-00004-of-00005.safetensors",
237
+ "blocks.21.attn.q_norm.weight": "model-00004-of-00005.safetensors",
238
+ "blocks.22.attn.q_norm.weight": "model-00004-of-00005.safetensors",
239
+ "blocks.23.attn.q_norm.weight": "model-00004-of-00005.safetensors",
240
+ "blocks.3.attn.q_norm.weight": "model-00004-of-00005.safetensors",
241
+ "blocks.4.attn.q_norm.weight": "model-00004-of-00005.safetensors",
242
+ "blocks.5.attn.q_norm.weight": "model-00004-of-00005.safetensors",
243
+ "blocks.6.attn.q_norm.weight": "model-00004-of-00005.safetensors",
244
+ "blocks.7.attn.q_norm.weight": "model-00004-of-00005.safetensors",
245
+ "blocks.8.attn.q_norm.weight": "model-00004-of-00005.safetensors",
246
+ "blocks.9.attn.q_norm.weight": "model-00004-of-00005.safetensors",
247
+ "blocks.1.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
248
+ "blocks.10.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
249
+ "blocks.11.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
250
+ "blocks.13.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
251
+ "blocks.14.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
252
+ "blocks.15.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
253
+ "blocks.17.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
254
+ "blocks.18.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
255
+ "blocks.19.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
256
+ "blocks.20.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
257
+ "blocks.21.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
258
+ "blocks.22.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
259
+ "blocks.3.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
260
+ "blocks.4.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
261
+ "blocks.5.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
262
+ "blocks.7.mlp.down_proj.weight": "model-00005-of-00005.safetensors",
263
+ "blocks.8.mlp.gate_proj.weight": "model-00005-of-00005.safetensors",
264
+ "blocks.9.mlp.up_proj.weight": "model-00005-of-00005.safetensors",
265
+ "blocks.1.attn.q_proj.weight": "model-00005-of-00005.safetensors",
266
+ "blocks.11.attn.q_proj.weight": "model-00005-of-00005.safetensors",
267
+ "blocks.14.attn.o_proj.weight": "model-00005-of-00005.safetensors",
268
+ "blocks.16.attn.q_proj.weight": "model-00005-of-00005.safetensors",
269
+ "blocks.19.attn.o_proj.weight": "model-00005-of-00005.safetensors",
270
+ "blocks.20.attn.q_proj.weight": "model-00005-of-00005.safetensors",
271
+ "blocks.23.attn.o_proj.weight": "model-00005-of-00005.safetensors",
272
+ "blocks.4.attn.q_proj.weight": "model-00005-of-00005.safetensors",
273
+ "blocks.7.attn.o_proj.weight": "model-00005-of-00005.safetensors",
274
+ "blocks.9.attn.q_proj.weight": "model-00005-of-00005.safetensors",
275
+ "blocks.10.attn.v_proj.weight": "model-00005-of-00005.safetensors",
276
+ "blocks.13.attn.k_proj.weight": "model-00005-of-00005.safetensors",
277
+ "blocks.15.attn.v_proj.weight": "model-00005-of-00005.safetensors",
278
+ "blocks.18.attn.k_proj.weight": "model-00005-of-00005.safetensors",
279
+ "blocks.2.attn.v_proj.weight": "model-00005-of-00005.safetensors",
280
+ "blocks.22.attn.k_proj.weight": "model-00005-of-00005.safetensors",
281
+ "blocks.3.attn.v_proj.weight": "model-00005-of-00005.safetensors",
282
+ "blocks.6.attn.k_proj.weight": "model-00005-of-00005.safetensors",
283
+ "blocks.8.attn.v_proj.weight": "model-00005-of-00005.safetensors",
284
+ "blocks.0.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
285
+ "blocks.1.input_norm.weight": "model-00005-of-00005.safetensors",
286
+ "blocks.10.attn_out_norm.weight": "model-00005-of-00005.safetensors",
287
+ "blocks.10.post_norm.weight": "model-00005-of-00005.safetensors",
288
+ "blocks.11.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
289
+ "blocks.12.input_norm.weight": "model-00005-of-00005.safetensors",
290
+ "blocks.13.attn_out_norm.weight": "model-00005-of-00005.safetensors",
291
+ "blocks.13.post_norm.weight": "model-00005-of-00005.safetensors",
292
+ "blocks.14.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
293
+ "blocks.15.input_norm.weight": "model-00005-of-00005.safetensors",
294
+ "blocks.16.attn_out_norm.weight": "model-00005-of-00005.safetensors",
295
+ "blocks.16.post_norm.weight": "model-00005-of-00005.safetensors",
296
+ "blocks.17.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
297
+ "blocks.18.input_norm.weight": "model-00005-of-00005.safetensors",
298
+ "blocks.19.attn_out_norm.weight": "model-00005-of-00005.safetensors",
299
+ "blocks.19.post_norm.weight": "model-00005-of-00005.safetensors",
300
+ "blocks.2.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
301
+ "blocks.20.input_norm.weight": "model-00005-of-00005.safetensors",
302
+ "blocks.21.attn_out_norm.weight": "model-00005-of-00005.safetensors",
303
+ "blocks.21.post_norm.weight": "model-00005-of-00005.safetensors",
304
+ "blocks.22.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
305
+ "blocks.23.input_norm.weight": "model-00005-of-00005.safetensors",
306
+ "blocks.3.attn_out_norm.weight": "model-00005-of-00005.safetensors",
307
+ "blocks.3.post_norm.weight": "model-00005-of-00005.safetensors",
308
+ "blocks.4.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
309
+ "blocks.5.input_norm.weight": "model-00005-of-00005.safetensors",
310
+ "blocks.6.attn_out_norm.weight": "model-00005-of-00005.safetensors",
311
+ "blocks.6.post_norm.weight": "model-00005-of-00005.safetensors",
312
+ "blocks.7.mlp_out_norm.weight": "model-00005-of-00005.safetensors",
313
+ "blocks.8.input_norm.weight": "model-00005-of-00005.safetensors",
314
+ "blocks.9.attn_out_norm.weight": "model-00005-of-00005.safetensors",
315
+ "blocks.9.post_norm.weight": "model-00005-of-00005.safetensors",
316
+ "blocks.0.attn.q_norm.weight": "model-00005-of-00005.safetensors",
317
+ "blocks.1.attn.k_norm.weight": "model-00005-of-00005.safetensors",
318
+ "blocks.1.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
319
+ "blocks.10.attn.q_norm.weight": "model-00005-of-00005.safetensors",
320
+ "blocks.11.attn.k_norm.weight": "model-00005-of-00005.safetensors",
321
+ "blocks.11.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
322
+ "blocks.12.attn.q_norm.weight": "model-00005-of-00005.safetensors",
323
+ "blocks.13.attn.k_norm.weight": "model-00005-of-00005.safetensors",
324
+ "blocks.13.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
325
+ "blocks.14.attn.q_norm.weight": "model-00005-of-00005.safetensors",
326
+ "blocks.15.attn.k_norm.weight": "model-00005-of-00005.safetensors",
327
+ "blocks.15.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
328
+ "blocks.16.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
329
+ "blocks.17.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
330
+ "blocks.18.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
331
+ "blocks.19.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
332
+ "blocks.2.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
333
+ "blocks.20.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
334
+ "blocks.21.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
335
+ "blocks.22.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
336
+ "blocks.23.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
337
+ "blocks.3.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
338
+ "blocks.4.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
339
+ "blocks.5.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
340
+ "blocks.6.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
341
+ "blocks.7.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
342
+ "blocks.8.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors",
343
+ "blocks.9.attn.v_norm_layer.weight": "model-00005-of-00005.safetensors"
344
+ }
345
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }