Text Generation
Transformers
Safetensors
domynedge
domyn
domyn-edge
teacher
math
grpo
fully-open
conversational
custom_code
Instructions to use domyn/Domyn-Edge-Teacher-Math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use domyn/Domyn-Edge-Teacher-Math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="domyn/Domyn-Edge-Teacher-Math", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("domyn/Domyn-Edge-Teacher-Math", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use domyn/Domyn-Edge-Teacher-Math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "domyn/Domyn-Edge-Teacher-Math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "domyn/Domyn-Edge-Teacher-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/domyn/Domyn-Edge-Teacher-Math
- SGLang
How to use domyn/Domyn-Edge-Teacher-Math with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "domyn/Domyn-Edge-Teacher-Math" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "domyn/Domyn-Edge-Teacher-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "domyn/Domyn-Edge-Teacher-Math" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "domyn/Domyn-Edge-Teacher-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use domyn/Domyn-Edge-Teacher-Math with Docker Model Runner:
docker model run hf.co/domyn/Domyn-Edge-Teacher-Math
Commit ·
137fb7f
0
Parent(s):
Domyn Edge Teacher Math
Browse filesCo-authored-by: llmartin <llmartin@users.noreply.huggingface.co>
- .gitattributes +36 -0
- README.md +172 -0
- __init__.py +0 -0
- chat_template.jinja +159 -0
- config.json +291 -0
- configuration_domynedge.py +141 -0
- generation_config.json +9 -0
- model-00001-of-00001.safetensors +3 -0
- model.safetensors.index.json +441 -0
- modeling_domynedge.py +473 -0
- special_tokens_map.json +46 -0
- tokenizer.json +3 -0
- tokenizer_config.json +144 -0
.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=l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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
base_model: domyn/Domyn-Edge-SFT
|
| 6 |
+
datasets:
|
| 7 |
+
- domyn/Domyn-Edge-Teacher-Math-Mix
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
- it
|
| 11 |
+
- es
|
| 12 |
+
- fr
|
| 13 |
+
- de
|
| 14 |
+
- pt
|
| 15 |
+
- ru
|
| 16 |
+
- zh
|
| 17 |
+
- ja
|
| 18 |
+
- ar
|
| 19 |
+
- nl
|
| 20 |
+
- id
|
| 21 |
+
- tr
|
| 22 |
+
tags:
|
| 23 |
+
- domyn
|
| 24 |
+
- domyn-edge
|
| 25 |
+
- teacher
|
| 26 |
+
- math
|
| 27 |
+
- grpo
|
| 28 |
+
- fully-open
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
<p align="center">
|
| 32 |
+
<picture>
|
| 33 |
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.prod.website-files.com/682dcb35e7fd7a313cae803a/6835cb0fb6bd22a7cba7d645_domyn-logo-payoff-primary-white.svg">
|
| 34 |
+
<img alt="Domyn" src="https://cdn.prod.website-files.com/682dcb35e7fd7a313cae803a/6835ca86622d317630fa3861_domyn-logo-primary.svg" width="400">
|
| 35 |
+
</picture>
|
| 36 |
+
</p>
|
| 37 |
+
|
| 38 |
+
# Domyn Edge Teacher Math
|
| 39 |
+
|
| 40 |
+
> [!IMPORTANT]
|
| 41 |
+
> **Phased release.** Domyn Edge is a rolling release in three bundles. This teacher is part of the
|
| 42 |
+
> second bundle, together with the other domain teachers and their post-training data. See
|
| 43 |
+
> [Open resources](#open-resources) for everything released so far.
|
| 44 |
+
|
| 45 |
+
> [!Note]
|
| 46 |
+
> This repository holds the **math teacher** of Domyn Edge: Domyn Edge SFT after GRPO on math
|
| 47 |
+
> problems with verifiable final answers. It is one of the domain teachers that score the student's
|
| 48 |
+
> rollouts token by token in the multi-teacher on-policy distillation (MOPD) stage of our
|
| 49 |
+
> post-training protocol. It is released for research and reproducibility; it is not a
|
| 50 |
+
> general-purpose assistant.
|
| 51 |
+
|
| 52 |
+
## Table of contents
|
| 53 |
+
|
| 54 |
+
1. [Model summary](#model-summary)
|
| 55 |
+
2. [How to use](#how-to-use)
|
| 56 |
+
3. [Evaluation](#evaluation)
|
| 57 |
+
4. [Limitations](#limitations)
|
| 58 |
+
5. [Open resources](#open-resources)
|
| 59 |
+
6. [License](#license)
|
| 60 |
+
7. [Citation](#citation)
|
| 61 |
+
|
| 62 |
+
## Model summary
|
| 63 |
+
|
| 64 |
+
Domyn Edge Teacher Math is a 4B-parameter dense transformer with the same architecture and tokenizer
|
| 65 |
+
as [Domyn Edge SFT](https://huggingface.co/domyn/Domyn-Edge-SFT). It was trained in one stage on top
|
| 66 |
+
of Domyn Edge SFT:
|
| 67 |
+
|
| 68 |
+
- **GRPO**: asynchronous group relative policy optimization on math problems with a single verifiable final answer. The reward checks the final answer with
|
| 69 |
+
[math-verify](https://github.com/huggingface/Math-Verify): 1 for a correct answer, 0.5 for a
|
| 70 |
+
correct answer not given in the format the prompt asks for, 0 otherwise.
|
| 71 |
+
|
| 72 |
+
The weights are stored in bfloat16.
|
| 73 |
+
|
| 74 |
+
## How to use
|
| 75 |
+
|
| 76 |
+
The model loads and serves exactly like Domyn Edge SFT; see the
|
| 77 |
+
[Domyn Edge SFT card](https://huggingface.co/domyn/Domyn-Edge-SFT#how-to-use) for the recommended
|
| 78 |
+
environment, Transformers and vLLM instructions.
|
| 79 |
+
|
| 80 |
+
**Chat template.** The repository ships the Domyn Edge SFT chat template unchanged; it is the
|
| 81 |
+
template used during GRPO training and in the evaluation below. It opens the system turn with a
|
| 82 |
+
fixed identity line ("You are Domyn Edge, a model trained by Domyn.").
|
| 83 |
+
|
| 84 |
+
**Output format.** The model reasons first and ends with the final answer, usually in `\boxed{}`.
|
| 85 |
+
|
| 86 |
+
## Evaluation
|
| 87 |
+
|
| 88 |
+
### Teacher vs student on the general evaluation suite
|
| 89 |
+
|
| 90 |
+
Scores of this teacher next to those of the student, [Domyn Edge
|
| 91 |
+
SFT](https://huggingface.co/domyn/Domyn-Edge-SFT), with one benchmark per area, to check what the
|
| 92 |
+
teacher keeps outside its training domain. All scores are percentages.
|
| 93 |
+
|
| 94 |
+
| Group | Benchmark | Metric | Domyn Edge SFT | Teacher Math | Δ |
|
| 95 |
+
|---|---|---|---:|---:|---:|
|
| 96 |
+
| Math | AIME 2026 | avg@10 | 61.3 | **79.0** | +17.7 |
|
| 97 |
+
| Multilingual math | MGSM (de, en, es, fr, ru) | accuracy | 85.8 | **87.4** | +1.6 |
|
| 98 |
+
| Knowledge and reasoning | GPQA Diamond | pass@1 | 56.3 | **59.6** | +3.3 |
|
| 99 |
+
| Instruction following | IFBench | prompt strict pass@1 | 24.1 | **25.0** | +0.9 |
|
| 100 |
+
| Function calling | BFCL v4, without web search (overall) | pass@1 | **36.5** | 36.2 | -0.3 |
|
| 101 |
+
| | BFCL v4 (non-live) | pass@1 | 51.9 | **53.3** | +1.4 |
|
| 102 |
+
| | BFCL v4 (live) | pass@1 | **75.9** | 75.1 | -0.8 |
|
| 103 |
+
| | BFCL v4 (multi-turn) | pass@1 | 35.9 | **38.8** | +2.9 |
|
| 104 |
+
| | BFCL v4 (memory) | pass@1 | **27.3** | 21.5 | -5.8 |
|
| 105 |
+
| Agentic | SWE-bench Verified | pass@1 | **33.6** | 29.6 | -4.0 |
|
| 106 |
+
| Code | LiveCodeBench (full set)\* | pass@1 | **73.0** | 72.0 | -1.0 |
|
| 107 |
+
|
| 108 |
+
_\*LiveCodeBench (full set) is all 1,055 problems of LiveCodeBench v6, released between May 2023 and
|
| 109 |
+
April 2025._
|
| 110 |
+
|
| 111 |
+
<details>
|
| 112 |
+
<summary>Evaluation settings</summary>
|
| 113 |
+
|
| 114 |
+
- Served with vLLM in bfloat16, with the chat template shipped in this repository.
|
| 115 |
+
- Thinking on. Sampling: temperature 1.0, top-p 0.95, top-k 20, min-p 0, no presence or
|
| 116 |
+
repetition penalty.
|
| 117 |
+
</details>
|
| 118 |
+
|
| 119 |
+
### Math evaluation suite
|
| 120 |
+
|
| 121 |
+
| Benchmark | Metric | Teacher Math | Qwen3.5 4B | Δ |
|
| 122 |
+
|---|---|---:|---:|---:|
|
| 123 |
+
| AIME 2026 | avg@10 | 79.0 | **82.9** | -3.9 |
|
| 124 |
+
| AIME 2025 | avg@10 | 75.9 | **78.3** | -2.4 |
|
| 125 |
+
| HMMT Feb 2026 | avg@10 | **65.9** | 63.3 | +2.6 |
|
| 126 |
+
| HMMT Feb 2025 | avg@10 | **76.1** | 74.6 | +1.5 |
|
| 127 |
+
| GSM8K | accuracy | 93.8 | **95.0** | -1.2 |
|
| 128 |
+
| MGSM (de, en, es, fr, ru) | accuracy | 87.4 | **89.8** | -2.4 |
|
| 129 |
+
|
| 130 |
+
<details>
|
| 131 |
+
<summary>Evaluation settings</summary>
|
| 132 |
+
|
| 133 |
+
- Served with vLLM in bfloat16 at 128k context, thinking on.
|
| 134 |
+
- Sampling: temperature 1.0, top-p 0.95, top-k 20, min-p 0, no presence, frequency or repetition
|
| 135 |
+
penalty.
|
| 136 |
+
- AIME and HMMT: 10 samples per problem, accuracy averaged over the samples (avg@10).
|
| 137 |
+
|
| 138 |
+
</details>
|
| 139 |
+
|
| 140 |
+
## Limitations
|
| 141 |
+
|
| 142 |
+
**A teacher, not an assistant.** This model is one of the domain teachers of multi-teacher on-policy
|
| 143 |
+
distillation (MOPD), the post-training stage in which the Domyn Edge student generates its own
|
| 144 |
+
responses and each teacher scores them token by token in its own domain. Only math was trained
|
| 145 |
+
beyond Domyn Edge SFT.
|
| 146 |
+
|
| 147 |
+
**Long generations.** On hard problems the model can reason for tens of thousands of tokens.
|
| 148 |
+
Training capped responses at 64k tokens; cap the generation length.
|
| 149 |
+
|
| 150 |
+
**Safety work is incomplete.** No dedicated safety tuning or red teaming was done on this model.
|
| 151 |
+
|
| 152 |
+
## Open resources
|
| 153 |
+
|
| 154 |
+
- **This teacher**: [`domyn/Domyn-Edge-Teacher-Math`](https://huggingface.co/domyn/Domyn-Edge-Teacher-Math)
|
| 155 |
+
- **Its data**: [`domyn/Domyn-Edge-Teacher-Math-Mix`](https://huggingface.co/datasets/domyn/Domyn-Edge-Teacher-Math-Mix)
|
| 156 |
+
- **Student SFT model**: [`domyn/Domyn-Edge-SFT`](https://huggingface.co/domyn/Domyn-Edge-SFT), and its mix [`domyn/Domyn-Edge-SFT-Mix`](https://huggingface.co/datasets/domyn/Domyn-Edge-SFT-Mix)
|
| 157 |
+
- **Collection**: [Domyn Edge](https://huggingface.co/collections/domyn/domyn-edge) on Hugging Face
|
| 158 |
+
|
| 159 |
+
## License
|
| 160 |
+
|
| 161 |
+
This model is released under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
| 162 |
+
|
| 163 |
+
## Citation
|
| 164 |
+
|
| 165 |
+
```bibtex
|
| 166 |
+
@misc{domynedge2026,
|
| 167 |
+
title = {Domyn Edge},
|
| 168 |
+
author = {Domyn},
|
| 169 |
+
year = {2026},
|
| 170 |
+
note = {Technical report, forthcoming in November 2026.},
|
| 171 |
+
}
|
| 172 |
+
```
|
__init__.py
ADDED
|
File without changes
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- set identity = 'You are Domyn Edge, a model trained by Domyn.' %}
|
| 46 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 47 |
+
{{- '<|im_start|>system\n' + identity + '\n\n' }}
|
| 48 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 49 |
+
{%- for tool in tools %}
|
| 50 |
+
{{- "\n" }}
|
| 51 |
+
{{- tool | tojson }}
|
| 52 |
+
{%- endfor %}
|
| 53 |
+
{{- "\n</tools>" }}
|
| 54 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 55 |
+
{%- if messages[0].role == 'system' %}
|
| 56 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 57 |
+
{%- if content %}
|
| 58 |
+
{{- '\n\n' + content }}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{%- endif %}
|
| 61 |
+
{{- '<|im_end|>\n' }}
|
| 62 |
+
{%- else %}
|
| 63 |
+
{{- '<|im_start|>system\n' + identity }}
|
| 64 |
+
{%- if messages[0].role == 'system' %}
|
| 65 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 66 |
+
{%- if content %}
|
| 67 |
+
{{- '\n\n' + content }}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{{- '<|im_end|>\n' }}
|
| 71 |
+
{%- endif %}
|
| 72 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 73 |
+
{%- for message in messages[::-1] %}
|
| 74 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 75 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 76 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 77 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 78 |
+
{%- set ns.multi_step_tool = false %}
|
| 79 |
+
{%- set ns.last_query_index = index %}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- endfor %}
|
| 83 |
+
{%- if ns.multi_step_tool %}
|
| 84 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{%- for message in messages %}
|
| 87 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 88 |
+
{%- if message.role == "system" %}
|
| 89 |
+
{%- if not loop.first %}
|
| 90 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 91 |
+
{%- endif %}
|
| 92 |
+
{%- elif message.role == "user" %}
|
| 93 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 94 |
+
{%- elif message.role == "assistant" %}
|
| 95 |
+
{%- set reasoning_content = '' %}
|
| 96 |
+
{%- if message.reasoning_content is string %}
|
| 97 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 98 |
+
{%- else %}
|
| 99 |
+
{%- if '</think>' in content %}
|
| 100 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 101 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 102 |
+
{%- endif %}
|
| 103 |
+
{%- endif %}
|
| 104 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 105 |
+
{%- if (preserve_thinking is defined and preserve_thinking is true) or (loop.index0 > ns.last_query_index) %}
|
| 106 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 107 |
+
{%- else %}
|
| 108 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 111 |
+
{%- for tool_call in message.tool_calls %}
|
| 112 |
+
{%- if tool_call.function is defined %}
|
| 113 |
+
{%- set tool_call = tool_call.function %}
|
| 114 |
+
{%- endif %}
|
| 115 |
+
{%- if loop.first %}
|
| 116 |
+
{%- if content|trim %}
|
| 117 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- else %}
|
| 119 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 120 |
+
{%- endif %}
|
| 121 |
+
{%- else %}
|
| 122 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 123 |
+
{%- endif %}
|
| 124 |
+
{%- if tool_call.arguments is defined %}
|
| 125 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 126 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 127 |
+
{%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
|
| 128 |
+
{{- args_value }}
|
| 129 |
+
{{- '\n</parameter>\n' }}
|
| 130 |
+
{%- endfor %}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{{- '</function>\n</tool_call>' }}
|
| 133 |
+
{%- endfor %}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '<|im_end|>\n' }}
|
| 136 |
+
{%- elif message.role == "tool" %}
|
| 137 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 138 |
+
{{- '<|im_start|>user' }}
|
| 139 |
+
{%- endif %}
|
| 140 |
+
{{- '\n<tool_response>\n' }}
|
| 141 |
+
{{- content }}
|
| 142 |
+
{{- '\n</tool_response>' }}
|
| 143 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 144 |
+
{{- '<|im_end|>\n' }}
|
| 145 |
+
{%- elif loop.last %}
|
| 146 |
+
{{- '<|im_end|>\n' }}
|
| 147 |
+
{%- endif %}
|
| 148 |
+
{%- else %}
|
| 149 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 150 |
+
{%- endif %}
|
| 151 |
+
{%- endfor %}
|
| 152 |
+
{%- if add_generation_prompt %}
|
| 153 |
+
{{- '<|im_start|>assistant\n' }}
|
| 154 |
+
{%- if enable_thinking is defined and enable_thinking is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|
+
"AutoModel": "modeling_domynedge.DomynEdgeModel",
|
| 9 |
+
"AutoModelForCausalLM": "modeling_domynedge.DomynEdgeForCausalLM"
|
| 10 |
+
},
|
| 11 |
+
"dtype": "bfloat16",
|
| 12 |
+
"hidden_act": "silu",
|
| 13 |
+
"hidden_size": 2560,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 9728,
|
| 16 |
+
"max_position_embeddings": 262144,
|
| 17 |
+
"model_type": "domynedge",
|
| 18 |
+
"num_attention_heads": 32,
|
| 19 |
+
"num_hidden_layers": 36,
|
| 20 |
+
"num_key_value_heads": 8,
|
| 21 |
+
"rms_norm_eps": 1e-06,
|
| 22 |
+
"position_layers": [
|
| 23 |
+
"nope",
|
| 24 |
+
"nope",
|
| 25 |
+
"rope",
|
| 26 |
+
"rope",
|
| 27 |
+
"rope",
|
| 28 |
+
"nope",
|
| 29 |
+
"rope",
|
| 30 |
+
"rope",
|
| 31 |
+
"rope",
|
| 32 |
+
"nope",
|
| 33 |
+
"rope",
|
| 34 |
+
"rope",
|
| 35 |
+
"rope",
|
| 36 |
+
"nope",
|
| 37 |
+
"rope",
|
| 38 |
+
"rope",
|
| 39 |
+
"rope",
|
| 40 |
+
"nope",
|
| 41 |
+
"rope",
|
| 42 |
+
"rope",
|
| 43 |
+
"rope",
|
| 44 |
+
"nope",
|
| 45 |
+
"rope",
|
| 46 |
+
"rope",
|
| 47 |
+
"rope",
|
| 48 |
+
"nope",
|
| 49 |
+
"rope",
|
| 50 |
+
"rope",
|
| 51 |
+
"rope",
|
| 52 |
+
"nope",
|
| 53 |
+
"rope",
|
| 54 |
+
"rope",
|
| 55 |
+
"rope",
|
| 56 |
+
"nope",
|
| 57 |
+
"nope",
|
| 58 |
+
"nope"
|
| 59 |
+
],
|
| 60 |
+
"window_sizes": [
|
| 61 |
+
[
|
| 62 |
+
-1,
|
| 63 |
+
0
|
| 64 |
+
],
|
| 65 |
+
[
|
| 66 |
+
-1,
|
| 67 |
+
0
|
| 68 |
+
],
|
| 69 |
+
[
|
| 70 |
+
1024,
|
| 71 |
+
0
|
| 72 |
+
],
|
| 73 |
+
[
|
| 74 |
+
1024,
|
| 75 |
+
0
|
| 76 |
+
],
|
| 77 |
+
[
|
| 78 |
+
1024,
|
| 79 |
+
0
|
| 80 |
+
],
|
| 81 |
+
[
|
| 82 |
+
-1,
|
| 83 |
+
0
|
| 84 |
+
],
|
| 85 |
+
[
|
| 86 |
+
1024,
|
| 87 |
+
0
|
| 88 |
+
],
|
| 89 |
+
[
|
| 90 |
+
1024,
|
| 91 |
+
0
|
| 92 |
+
],
|
| 93 |
+
[
|
| 94 |
+
1024,
|
| 95 |
+
0
|
| 96 |
+
],
|
| 97 |
+
[
|
| 98 |
+
-1,
|
| 99 |
+
0
|
| 100 |
+
],
|
| 101 |
+
[
|
| 102 |
+
1024,
|
| 103 |
+
0
|
| 104 |
+
],
|
| 105 |
+
[
|
| 106 |
+
1024,
|
| 107 |
+
0
|
| 108 |
+
],
|
| 109 |
+
[
|
| 110 |
+
1024,
|
| 111 |
+
0
|
| 112 |
+
],
|
| 113 |
+
[
|
| 114 |
+
-1,
|
| 115 |
+
0
|
| 116 |
+
],
|
| 117 |
+
[
|
| 118 |
+
1024,
|
| 119 |
+
0
|
| 120 |
+
],
|
| 121 |
+
[
|
| 122 |
+
1024,
|
| 123 |
+
0
|
| 124 |
+
],
|
| 125 |
+
[
|
| 126 |
+
1024,
|
| 127 |
+
0
|
| 128 |
+
],
|
| 129 |
+
[
|
| 130 |
+
-1,
|
| 131 |
+
0
|
| 132 |
+
],
|
| 133 |
+
[
|
| 134 |
+
1024,
|
| 135 |
+
0
|
| 136 |
+
],
|
| 137 |
+
[
|
| 138 |
+
1024,
|
| 139 |
+
0
|
| 140 |
+
],
|
| 141 |
+
[
|
| 142 |
+
1024,
|
| 143 |
+
0
|
| 144 |
+
],
|
| 145 |
+
[
|
| 146 |
+
-1,
|
| 147 |
+
0
|
| 148 |
+
],
|
| 149 |
+
[
|
| 150 |
+
1024,
|
| 151 |
+
0
|
| 152 |
+
],
|
| 153 |
+
[
|
| 154 |
+
1024,
|
| 155 |
+
0
|
| 156 |
+
],
|
| 157 |
+
[
|
| 158 |
+
1024,
|
| 159 |
+
0
|
| 160 |
+
],
|
| 161 |
+
[
|
| 162 |
+
-1,
|
| 163 |
+
0
|
| 164 |
+
],
|
| 165 |
+
[
|
| 166 |
+
1024,
|
| 167 |
+
0
|
| 168 |
+
],
|
| 169 |
+
[
|
| 170 |
+
1024,
|
| 171 |
+
0
|
| 172 |
+
],
|
| 173 |
+
[
|
| 174 |
+
1024,
|
| 175 |
+
0
|
| 176 |
+
],
|
| 177 |
+
[
|
| 178 |
+
-1,
|
| 179 |
+
0
|
| 180 |
+
],
|
| 181 |
+
[
|
| 182 |
+
1024,
|
| 183 |
+
0
|
| 184 |
+
],
|
| 185 |
+
[
|
| 186 |
+
1024,
|
| 187 |
+
0
|
| 188 |
+
],
|
| 189 |
+
[
|
| 190 |
+
1024,
|
| 191 |
+
0
|
| 192 |
+
],
|
| 193 |
+
[
|
| 194 |
+
-1,
|
| 195 |
+
0
|
| 196 |
+
],
|
| 197 |
+
[
|
| 198 |
+
-1,
|
| 199 |
+
0
|
| 200 |
+
],
|
| 201 |
+
[
|
| 202 |
+
-1,
|
| 203 |
+
0
|
| 204 |
+
]
|
| 205 |
+
],
|
| 206 |
+
"layer_types": [
|
| 207 |
+
"full_attention",
|
| 208 |
+
"full_attention",
|
| 209 |
+
"sliding_attention",
|
| 210 |
+
"sliding_attention",
|
| 211 |
+
"sliding_attention",
|
| 212 |
+
"full_attention",
|
| 213 |
+
"sliding_attention",
|
| 214 |
+
"sliding_attention",
|
| 215 |
+
"sliding_attention",
|
| 216 |
+
"full_attention",
|
| 217 |
+
"sliding_attention",
|
| 218 |
+
"sliding_attention",
|
| 219 |
+
"sliding_attention",
|
| 220 |
+
"full_attention",
|
| 221 |
+
"sliding_attention",
|
| 222 |
+
"sliding_attention",
|
| 223 |
+
"sliding_attention",
|
| 224 |
+
"full_attention",
|
| 225 |
+
"sliding_attention",
|
| 226 |
+
"sliding_attention",
|
| 227 |
+
"sliding_attention",
|
| 228 |
+
"full_attention",
|
| 229 |
+
"sliding_attention",
|
| 230 |
+
"sliding_attention",
|
| 231 |
+
"sliding_attention",
|
| 232 |
+
"full_attention",
|
| 233 |
+
"sliding_attention",
|
| 234 |
+
"sliding_attention",
|
| 235 |
+
"sliding_attention",
|
| 236 |
+
"full_attention",
|
| 237 |
+
"sliding_attention",
|
| 238 |
+
"sliding_attention",
|
| 239 |
+
"sliding_attention",
|
| 240 |
+
"full_attention",
|
| 241 |
+
"full_attention",
|
| 242 |
+
"full_attention"
|
| 243 |
+
],
|
| 244 |
+
"sliding_window": 1025,
|
| 245 |
+
"head_sizes": [
|
| 246 |
+
256,
|
| 247 |
+
256,
|
| 248 |
+
64,
|
| 249 |
+
64,
|
| 250 |
+
64,
|
| 251 |
+
256,
|
| 252 |
+
64,
|
| 253 |
+
64,
|
| 254 |
+
64,
|
| 255 |
+
256,
|
| 256 |
+
64,
|
| 257 |
+
64,
|
| 258 |
+
64,
|
| 259 |
+
256,
|
| 260 |
+
64,
|
| 261 |
+
64,
|
| 262 |
+
64,
|
| 263 |
+
256,
|
| 264 |
+
64,
|
| 265 |
+
64,
|
| 266 |
+
64,
|
| 267 |
+
256,
|
| 268 |
+
64,
|
| 269 |
+
64,
|
| 270 |
+
64,
|
| 271 |
+
256,
|
| 272 |
+
64,
|
| 273 |
+
64,
|
| 274 |
+
64,
|
| 275 |
+
256,
|
| 276 |
+
64,
|
| 277 |
+
64,
|
| 278 |
+
64,
|
| 279 |
+
256,
|
| 280 |
+
256,
|
| 281 |
+
256
|
| 282 |
+
],
|
| 283 |
+
"tie_word_embeddings": true,
|
| 284 |
+
"rope_parameters": {
|
| 285 |
+
"rope_type": "default",
|
| 286 |
+
"rope_theta": 10000.0
|
| 287 |
+
},
|
| 288 |
+
"transformers_version": "5.8.1",
|
| 289 |
+
"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|
+
|
| 6 |
+
from transformers.configuration_utils import PreTrainedConfig
|
| 7 |
+
from transformers.modeling_rope_utils import RopeParameters
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class DomynEdgeConfig(PreTrainedConfig):
|
| 11 |
+
"""Configuration of a DomynEdge model, with per-layer position encoding, sliding window and head size."""
|
| 12 |
+
|
| 13 |
+
model_type: typing.ClassVar[str] = "domynedge"
|
| 14 |
+
default_theta: float = 10_000
|
| 15 |
+
|
| 16 |
+
def __init__(
|
| 17 |
+
self,
|
| 18 |
+
vocab_size: int = 115269,
|
| 19 |
+
hidden_size: int = 2560,
|
| 20 |
+
intermediate_size: int = 9728,
|
| 21 |
+
num_hidden_layers: int = 36,
|
| 22 |
+
num_attention_heads: int = 32,
|
| 23 |
+
num_key_value_heads: int = 8,
|
| 24 |
+
max_position_embeddings: int = 8192,
|
| 25 |
+
initializer_range: float = 0.02,
|
| 26 |
+
rms_norm_eps: float = 1e-6,
|
| 27 |
+
*,
|
| 28 |
+
use_cache: bool = True,
|
| 29 |
+
tie_word_embeddings: bool = True,
|
| 30 |
+
rope_parameters: RopeParameters | None = None,
|
| 31 |
+
max_window_layers: int | None = None,
|
| 32 |
+
attention_bias: bool = False,
|
| 33 |
+
attention_dropout: float = 0.0,
|
| 34 |
+
position_layers: list[str] = ["nope", "nope"] + ["rope", "rope", "rope", "nope"] * 8 + ["nope", "nope"],
|
| 35 |
+
layer_types: list[str] = ["full_attention", "full_attention"]
|
| 36 |
+
+ ["sliding_attention", "sliding_attention", "sliding_attention", "full_attention"] * 8
|
| 37 |
+
+ ["full_attention", "full_attention"],
|
| 38 |
+
sliding_window: int | None = 1025,
|
| 39 |
+
head_sizes: list[int] = [256, 256] + [64, 64, 64, 256] * 8 + [256, 256],
|
| 40 |
+
pad_token_id: int | None = None,
|
| 41 |
+
bos_token_id: int | None = None,
|
| 42 |
+
eos_token_id: int | None = None,
|
| 43 |
+
**kwargs,
|
| 44 |
+
):
|
| 45 |
+
"""Initialize and validate the per-layer settings, which must all have `num_hidden_layers` entries."""
|
| 46 |
+
self.vocab_size = vocab_size
|
| 47 |
+
self.max_position_embeddings = max_position_embeddings
|
| 48 |
+
self.hidden_size = hidden_size
|
| 49 |
+
self.intermediate_size = intermediate_size
|
| 50 |
+
self.num_hidden_layers = num_hidden_layers
|
| 51 |
+
self.num_attention_heads = num_attention_heads
|
| 52 |
+
# TODO: remove once vLLM's native DomynEdge no longer requires it. It was used by Qwen2 `max_window_layers`
|
| 53 |
+
# but in Domyn Edge `layer_types` alone decides which layers slide.
|
| 54 |
+
self.max_window_layers = num_hidden_layers if max_window_layers is None else max_window_layers
|
| 55 |
+
|
| 56 |
+
# for backward compatibility
|
| 57 |
+
if num_key_value_heads is None:
|
| 58 |
+
num_key_value_heads = num_attention_heads
|
| 59 |
+
|
| 60 |
+
self.num_key_value_heads = num_key_value_heads
|
| 61 |
+
self.initializer_range = initializer_range
|
| 62 |
+
self.rms_norm_eps = rms_norm_eps
|
| 63 |
+
self.use_cache = use_cache
|
| 64 |
+
self.attention_bias = attention_bias
|
| 65 |
+
self.attention_dropout = attention_dropout
|
| 66 |
+
|
| 67 |
+
self.position_layers = position_layers
|
| 68 |
+
self.layer_types = layer_types
|
| 69 |
+
self.sliding_window = sliding_window
|
| 70 |
+
self.head_sizes = head_sizes
|
| 71 |
+
|
| 72 |
+
# Validate position_layers
|
| 73 |
+
if len(self.position_layers) != self.num_hidden_layers:
|
| 74 |
+
msg = (
|
| 75 |
+
f"Length of position_layers ({len(self.position_layers)}) "
|
| 76 |
+
f"must be equal to num_hidden_layers ({self.num_hidden_layers})"
|
| 77 |
+
)
|
| 78 |
+
raise ValueError(msg)
|
| 79 |
+
if any(pl not in ["rope", "nope"] for pl in self.position_layers):
|
| 80 |
+
msg = f"position_layers must be one of 'rope', 'nope'. Got {self.position_layers}"
|
| 81 |
+
raise ValueError(msg)
|
| 82 |
+
# Validate layer_types and sliding_window
|
| 83 |
+
if len(self.layer_types) != self.num_hidden_layers:
|
| 84 |
+
msg = (
|
| 85 |
+
f"Length of layer_types ({len(self.layer_types)}) "
|
| 86 |
+
f"must be equal to num_hidden_layers ({self.num_hidden_layers})"
|
| 87 |
+
)
|
| 88 |
+
raise ValueError(msg)
|
| 89 |
+
if "sliding_attention" in self.layer_types and self.sliding_window is None:
|
| 90 |
+
msg = "sliding_window must be set when layer_types contains 'sliding_attention'"
|
| 91 |
+
raise ValueError(msg)
|
| 92 |
+
# Validate head_sizes
|
| 93 |
+
if len(head_sizes) != self.num_hidden_layers:
|
| 94 |
+
msg = (
|
| 95 |
+
f"Length of head_sizes ({len(head_sizes)}) "
|
| 96 |
+
f"must be equal to num_hidden_layers ({self.num_hidden_layers})"
|
| 97 |
+
)
|
| 98 |
+
raise ValueError(msg)
|
| 99 |
+
if any(not isinstance(hs, int) for hs in head_sizes):
|
| 100 |
+
msg = f"head_sizes must be a list of integers. Got {head_sizes}"
|
| 101 |
+
raise ValueError(msg)
|
| 102 |
+
# Only one rope dim
|
| 103 |
+
rope_dims = [head_size for rope, head_size in zip(position_layers, head_sizes, strict=True) if rope == "rope"]
|
| 104 |
+
if len(set(rope_dims)) > 1:
|
| 105 |
+
msg = f"All rope layers must have the same head size. Got {rope_dims}"
|
| 106 |
+
raise ValueError(msg)
|
| 107 |
+
|
| 108 |
+
kwargs.pop("rope_dim", None) # derived from rope_dims, never read from config.json. It won't be passed to super
|
| 109 |
+
kwargs.pop("window_sizes", None) # derived from layer_types, see the `window_sizes` property
|
| 110 |
+
self.rope_dim = rope_dims[0]
|
| 111 |
+
|
| 112 |
+
# If None, `super().__init__` calls `RotaryEmbeddingConfigMixin.convert_rope_params_to_dict`, which builds
|
| 113 |
+
# `{"rope_type": "default", "rope_theta": ...}` with the legacy top-level `rope_theta` kwarg if present,
|
| 114 |
+
# else `default_theta`.
|
| 115 |
+
self.rope_parameters = rope_parameters
|
| 116 |
+
|
| 117 |
+
self.pad_token_id = pad_token_id
|
| 118 |
+
self.bos_token_id = bos_token_id
|
| 119 |
+
self.eos_token_id = eos_token_id
|
| 120 |
+
self.tie_word_embeddings = tie_word_embeddings
|
| 121 |
+
|
| 122 |
+
if "per_layer_config" not in kwargs:
|
| 123 |
+
kwargs["per_layer_config"] = {
|
| 124 |
+
layer_idx: {"head_dim": head_size} for layer_idx, head_size in enumerate(head_sizes)
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
super().__init__(**kwargs)
|
| 128 |
+
|
| 129 |
+
@property
|
| 130 |
+
def window_sizes(self) -> list[tuple[int, int]]:
|
| 131 |
+
"""The torchtitan (left, right) attention window of each layer, (-1, 0) for full attention.
|
| 132 |
+
|
| 133 |
+
Legacy implementation to be compatible with vLLM v0.33, to be removed when updated from vLLM side.
|
| 134 |
+
"""
|
| 135 |
+
return [
|
| 136 |
+
(self.sliding_window - 1, 0) if layer_type == "sliding_attention" and self.sliding_window else (-1, 0)
|
| 137 |
+
for layer_type in self.layer_types
|
| 138 |
+
]
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
__all__ = ["DomynEdgeConfig"]
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 115258,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 115259,
|
| 5 |
+
"pad_token_id": 115268,
|
| 6 |
+
"temperature": 1.0,
|
| 7 |
+
"top_k": 20,
|
| 8 |
+
"top_p": 0.95
|
| 9 |
+
}
|
model-00001-of-00001.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2936b785d425136fee84e74e8032d9638b4208f7bc2531e0616816160a032d9
|
| 3 |
+
size 7857626952
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 7857575936
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"model.embed_tokens.weight": "model-00001-of-00001.safetensors",
|
| 7 |
+
"model.layers.0.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 8 |
+
"model.layers.0.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 9 |
+
"model.layers.0.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 10 |
+
"model.layers.0.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 11 |
+
"model.layers.0.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 12 |
+
"model.layers.0.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 13 |
+
"model.layers.0.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 14 |
+
"model.layers.0.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 15 |
+
"model.layers.0.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 16 |
+
"model.layers.0.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 17 |
+
"model.layers.0.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 18 |
+
"model.layers.0.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 19 |
+
"model.layers.1.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 20 |
+
"model.layers.1.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 21 |
+
"model.layers.1.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 22 |
+
"model.layers.1.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 23 |
+
"model.layers.1.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 24 |
+
"model.layers.1.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 25 |
+
"model.layers.1.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 26 |
+
"model.layers.1.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 27 |
+
"model.layers.1.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 28 |
+
"model.layers.1.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 29 |
+
"model.layers.1.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 30 |
+
"model.layers.1.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 31 |
+
"model.layers.10.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 32 |
+
"model.layers.10.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 33 |
+
"model.layers.10.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 34 |
+
"model.layers.10.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 35 |
+
"model.layers.10.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 36 |
+
"model.layers.10.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 37 |
+
"model.layers.10.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 38 |
+
"model.layers.10.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 39 |
+
"model.layers.10.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 40 |
+
"model.layers.10.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 41 |
+
"model.layers.10.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 42 |
+
"model.layers.10.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 43 |
+
"model.layers.11.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 44 |
+
"model.layers.11.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 45 |
+
"model.layers.11.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 46 |
+
"model.layers.11.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 47 |
+
"model.layers.11.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 48 |
+
"model.layers.11.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 49 |
+
"model.layers.11.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 50 |
+
"model.layers.11.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 51 |
+
"model.layers.11.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 52 |
+
"model.layers.11.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 53 |
+
"model.layers.11.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 54 |
+
"model.layers.11.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 55 |
+
"model.layers.12.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 56 |
+
"model.layers.12.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 57 |
+
"model.layers.12.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 58 |
+
"model.layers.12.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 59 |
+
"model.layers.12.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 60 |
+
"model.layers.12.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 61 |
+
"model.layers.12.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 62 |
+
"model.layers.12.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 63 |
+
"model.layers.12.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 64 |
+
"model.layers.12.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 65 |
+
"model.layers.12.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 66 |
+
"model.layers.12.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 67 |
+
"model.layers.13.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 68 |
+
"model.layers.13.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 69 |
+
"model.layers.13.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 70 |
+
"model.layers.13.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 71 |
+
"model.layers.13.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 72 |
+
"model.layers.13.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 73 |
+
"model.layers.13.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 74 |
+
"model.layers.13.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 75 |
+
"model.layers.13.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 76 |
+
"model.layers.13.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 77 |
+
"model.layers.13.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 78 |
+
"model.layers.13.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 79 |
+
"model.layers.14.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 80 |
+
"model.layers.14.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 81 |
+
"model.layers.14.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 82 |
+
"model.layers.14.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 83 |
+
"model.layers.14.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 84 |
+
"model.layers.14.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 85 |
+
"model.layers.14.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 86 |
+
"model.layers.14.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 87 |
+
"model.layers.14.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 88 |
+
"model.layers.14.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 89 |
+
"model.layers.14.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 90 |
+
"model.layers.14.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 91 |
+
"model.layers.15.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 92 |
+
"model.layers.15.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 93 |
+
"model.layers.15.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 94 |
+
"model.layers.15.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 95 |
+
"model.layers.15.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 96 |
+
"model.layers.15.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 97 |
+
"model.layers.15.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 98 |
+
"model.layers.15.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 99 |
+
"model.layers.15.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 100 |
+
"model.layers.15.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 101 |
+
"model.layers.15.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 102 |
+
"model.layers.15.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 103 |
+
"model.layers.16.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 104 |
+
"model.layers.16.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 105 |
+
"model.layers.16.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 106 |
+
"model.layers.16.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 107 |
+
"model.layers.16.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 108 |
+
"model.layers.16.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 109 |
+
"model.layers.16.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 110 |
+
"model.layers.16.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 111 |
+
"model.layers.16.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 112 |
+
"model.layers.16.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 113 |
+
"model.layers.16.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 114 |
+
"model.layers.16.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 115 |
+
"model.layers.17.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 116 |
+
"model.layers.17.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 117 |
+
"model.layers.17.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 118 |
+
"model.layers.17.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 119 |
+
"model.layers.17.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 120 |
+
"model.layers.17.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 121 |
+
"model.layers.17.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 122 |
+
"model.layers.17.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 123 |
+
"model.layers.17.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 124 |
+
"model.layers.17.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 125 |
+
"model.layers.17.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 126 |
+
"model.layers.17.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 127 |
+
"model.layers.18.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 128 |
+
"model.layers.18.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 129 |
+
"model.layers.18.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 130 |
+
"model.layers.18.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 131 |
+
"model.layers.18.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 132 |
+
"model.layers.18.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 133 |
+
"model.layers.18.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 134 |
+
"model.layers.18.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 135 |
+
"model.layers.18.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 136 |
+
"model.layers.18.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 137 |
+
"model.layers.18.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 138 |
+
"model.layers.18.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 139 |
+
"model.layers.19.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 140 |
+
"model.layers.19.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 141 |
+
"model.layers.19.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 142 |
+
"model.layers.19.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 143 |
+
"model.layers.19.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 144 |
+
"model.layers.19.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 145 |
+
"model.layers.19.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 146 |
+
"model.layers.19.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 147 |
+
"model.layers.19.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 148 |
+
"model.layers.19.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 149 |
+
"model.layers.19.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 150 |
+
"model.layers.19.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 151 |
+
"model.layers.2.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 152 |
+
"model.layers.2.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 153 |
+
"model.layers.2.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 154 |
+
"model.layers.2.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 155 |
+
"model.layers.2.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 156 |
+
"model.layers.2.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 157 |
+
"model.layers.2.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 158 |
+
"model.layers.2.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 159 |
+
"model.layers.2.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 160 |
+
"model.layers.2.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 161 |
+
"model.layers.2.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 162 |
+
"model.layers.2.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 163 |
+
"model.layers.20.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 164 |
+
"model.layers.20.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 165 |
+
"model.layers.20.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 166 |
+
"model.layers.20.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 167 |
+
"model.layers.20.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 168 |
+
"model.layers.20.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 169 |
+
"model.layers.20.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 170 |
+
"model.layers.20.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 171 |
+
"model.layers.20.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 172 |
+
"model.layers.20.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 173 |
+
"model.layers.20.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 174 |
+
"model.layers.20.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 175 |
+
"model.layers.21.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 176 |
+
"model.layers.21.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 177 |
+
"model.layers.21.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 178 |
+
"model.layers.21.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 179 |
+
"model.layers.21.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 180 |
+
"model.layers.21.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 181 |
+
"model.layers.21.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 182 |
+
"model.layers.21.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 183 |
+
"model.layers.21.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 184 |
+
"model.layers.21.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 185 |
+
"model.layers.21.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 186 |
+
"model.layers.21.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 187 |
+
"model.layers.22.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 188 |
+
"model.layers.22.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 189 |
+
"model.layers.22.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 190 |
+
"model.layers.22.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 191 |
+
"model.layers.22.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 192 |
+
"model.layers.22.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 193 |
+
"model.layers.22.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 194 |
+
"model.layers.22.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 195 |
+
"model.layers.22.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 196 |
+
"model.layers.22.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 197 |
+
"model.layers.22.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 198 |
+
"model.layers.22.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 199 |
+
"model.layers.23.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 200 |
+
"model.layers.23.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 201 |
+
"model.layers.23.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 202 |
+
"model.layers.23.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 203 |
+
"model.layers.23.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 204 |
+
"model.layers.23.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 205 |
+
"model.layers.23.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 206 |
+
"model.layers.23.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 207 |
+
"model.layers.23.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 208 |
+
"model.layers.23.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 209 |
+
"model.layers.23.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 210 |
+
"model.layers.23.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 211 |
+
"model.layers.24.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 212 |
+
"model.layers.24.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 213 |
+
"model.layers.24.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 214 |
+
"model.layers.24.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 215 |
+
"model.layers.24.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 216 |
+
"model.layers.24.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 217 |
+
"model.layers.24.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 218 |
+
"model.layers.24.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 219 |
+
"model.layers.24.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 220 |
+
"model.layers.24.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 221 |
+
"model.layers.24.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 222 |
+
"model.layers.24.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 223 |
+
"model.layers.25.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 224 |
+
"model.layers.25.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 225 |
+
"model.layers.25.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 226 |
+
"model.layers.25.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 227 |
+
"model.layers.25.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 228 |
+
"model.layers.25.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 229 |
+
"model.layers.25.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 230 |
+
"model.layers.25.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 231 |
+
"model.layers.25.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 232 |
+
"model.layers.25.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 233 |
+
"model.layers.25.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 234 |
+
"model.layers.25.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 235 |
+
"model.layers.26.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 236 |
+
"model.layers.26.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 237 |
+
"model.layers.26.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 238 |
+
"model.layers.26.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 239 |
+
"model.layers.26.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 240 |
+
"model.layers.26.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 241 |
+
"model.layers.26.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 242 |
+
"model.layers.26.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 243 |
+
"model.layers.26.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 244 |
+
"model.layers.26.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 245 |
+
"model.layers.26.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 246 |
+
"model.layers.26.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 247 |
+
"model.layers.27.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 248 |
+
"model.layers.27.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 249 |
+
"model.layers.27.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 250 |
+
"model.layers.27.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 251 |
+
"model.layers.27.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 252 |
+
"model.layers.27.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 253 |
+
"model.layers.27.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 254 |
+
"model.layers.27.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 255 |
+
"model.layers.27.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 256 |
+
"model.layers.27.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 257 |
+
"model.layers.27.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 258 |
+
"model.layers.27.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 259 |
+
"model.layers.28.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 260 |
+
"model.layers.28.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 261 |
+
"model.layers.28.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 262 |
+
"model.layers.28.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 263 |
+
"model.layers.28.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 264 |
+
"model.layers.28.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 265 |
+
"model.layers.28.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 266 |
+
"model.layers.28.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 267 |
+
"model.layers.28.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 268 |
+
"model.layers.28.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 269 |
+
"model.layers.28.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 270 |
+
"model.layers.28.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 271 |
+
"model.layers.29.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 272 |
+
"model.layers.29.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 273 |
+
"model.layers.29.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 274 |
+
"model.layers.29.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 275 |
+
"model.layers.29.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 276 |
+
"model.layers.29.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 277 |
+
"model.layers.29.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 278 |
+
"model.layers.29.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 279 |
+
"model.layers.29.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 280 |
+
"model.layers.29.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 281 |
+
"model.layers.29.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 282 |
+
"model.layers.29.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 283 |
+
"model.layers.3.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 284 |
+
"model.layers.3.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 285 |
+
"model.layers.3.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 286 |
+
"model.layers.3.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 287 |
+
"model.layers.3.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 288 |
+
"model.layers.3.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 289 |
+
"model.layers.3.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 290 |
+
"model.layers.3.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 291 |
+
"model.layers.3.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 292 |
+
"model.layers.3.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 293 |
+
"model.layers.3.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 294 |
+
"model.layers.3.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 295 |
+
"model.layers.30.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 296 |
+
"model.layers.30.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 297 |
+
"model.layers.30.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 298 |
+
"model.layers.30.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 299 |
+
"model.layers.30.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 300 |
+
"model.layers.30.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 301 |
+
"model.layers.30.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 302 |
+
"model.layers.30.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 303 |
+
"model.layers.30.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 304 |
+
"model.layers.30.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 305 |
+
"model.layers.30.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 306 |
+
"model.layers.30.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 307 |
+
"model.layers.31.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 308 |
+
"model.layers.31.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 309 |
+
"model.layers.31.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 310 |
+
"model.layers.31.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 311 |
+
"model.layers.31.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 312 |
+
"model.layers.31.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 313 |
+
"model.layers.31.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 314 |
+
"model.layers.31.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 315 |
+
"model.layers.31.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 316 |
+
"model.layers.31.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 317 |
+
"model.layers.31.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 318 |
+
"model.layers.31.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 319 |
+
"model.layers.32.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 320 |
+
"model.layers.32.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 321 |
+
"model.layers.32.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 322 |
+
"model.layers.32.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 323 |
+
"model.layers.32.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 324 |
+
"model.layers.32.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 325 |
+
"model.layers.32.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 326 |
+
"model.layers.32.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 327 |
+
"model.layers.32.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 328 |
+
"model.layers.32.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 329 |
+
"model.layers.32.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 330 |
+
"model.layers.32.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 331 |
+
"model.layers.33.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 332 |
+
"model.layers.33.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 333 |
+
"model.layers.33.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 334 |
+
"model.layers.33.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 335 |
+
"model.layers.33.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 336 |
+
"model.layers.33.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 337 |
+
"model.layers.33.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 338 |
+
"model.layers.33.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 339 |
+
"model.layers.33.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 340 |
+
"model.layers.33.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 341 |
+
"model.layers.33.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 342 |
+
"model.layers.33.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 343 |
+
"model.layers.34.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 344 |
+
"model.layers.34.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 345 |
+
"model.layers.34.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 346 |
+
"model.layers.34.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 347 |
+
"model.layers.34.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 348 |
+
"model.layers.34.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 349 |
+
"model.layers.34.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 350 |
+
"model.layers.34.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 351 |
+
"model.layers.34.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 352 |
+
"model.layers.34.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 353 |
+
"model.layers.34.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 354 |
+
"model.layers.34.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 355 |
+
"model.layers.35.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 356 |
+
"model.layers.35.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 357 |
+
"model.layers.35.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 358 |
+
"model.layers.35.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 359 |
+
"model.layers.35.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 360 |
+
"model.layers.35.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 361 |
+
"model.layers.35.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 362 |
+
"model.layers.35.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 363 |
+
"model.layers.35.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 364 |
+
"model.layers.35.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 365 |
+
"model.layers.35.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 366 |
+
"model.layers.35.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 367 |
+
"model.layers.4.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 368 |
+
"model.layers.4.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 369 |
+
"model.layers.4.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 370 |
+
"model.layers.4.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 371 |
+
"model.layers.4.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 372 |
+
"model.layers.4.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 373 |
+
"model.layers.4.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 374 |
+
"model.layers.4.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 375 |
+
"model.layers.4.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 376 |
+
"model.layers.4.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 377 |
+
"model.layers.4.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 378 |
+
"model.layers.4.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 379 |
+
"model.layers.5.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 380 |
+
"model.layers.5.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 381 |
+
"model.layers.5.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 382 |
+
"model.layers.5.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 383 |
+
"model.layers.5.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 384 |
+
"model.layers.5.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 385 |
+
"model.layers.5.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 386 |
+
"model.layers.5.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 387 |
+
"model.layers.5.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 388 |
+
"model.layers.5.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 389 |
+
"model.layers.5.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 390 |
+
"model.layers.5.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 391 |
+
"model.layers.6.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 392 |
+
"model.layers.6.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 393 |
+
"model.layers.6.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 394 |
+
"model.layers.6.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 395 |
+
"model.layers.6.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 396 |
+
"model.layers.6.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 397 |
+
"model.layers.6.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 398 |
+
"model.layers.6.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 399 |
+
"model.layers.6.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 400 |
+
"model.layers.6.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 401 |
+
"model.layers.6.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 402 |
+
"model.layers.6.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 403 |
+
"model.layers.7.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 404 |
+
"model.layers.7.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 405 |
+
"model.layers.7.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 406 |
+
"model.layers.7.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 407 |
+
"model.layers.7.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 408 |
+
"model.layers.7.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 409 |
+
"model.layers.7.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 410 |
+
"model.layers.7.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 411 |
+
"model.layers.7.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 412 |
+
"model.layers.7.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 413 |
+
"model.layers.7.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 414 |
+
"model.layers.7.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 415 |
+
"model.layers.8.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 416 |
+
"model.layers.8.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 417 |
+
"model.layers.8.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 418 |
+
"model.layers.8.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 419 |
+
"model.layers.8.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 420 |
+
"model.layers.8.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 421 |
+
"model.layers.8.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 422 |
+
"model.layers.8.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 423 |
+
"model.layers.8.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 424 |
+
"model.layers.8.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 425 |
+
"model.layers.8.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 426 |
+
"model.layers.8.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 427 |
+
"model.layers.9.attention.k_norm.weight": "model-00001-of-00001.safetensors",
|
| 428 |
+
"model.layers.9.attention.k_proj.weight": "model-00001-of-00001.safetensors",
|
| 429 |
+
"model.layers.9.attention.o_proj.weight": "model-00001-of-00001.safetensors",
|
| 430 |
+
"model.layers.9.attention.q_proj.weight": "model-00001-of-00001.safetensors",
|
| 431 |
+
"model.layers.9.attention.v_proj.weight": "model-00001-of-00001.safetensors",
|
| 432 |
+
"model.layers.9.feedforward.down_proj.weight": "model-00001-of-00001.safetensors",
|
| 433 |
+
"model.layers.9.feedforward.gate_proj.weight": "model-00001-of-00001.safetensors",
|
| 434 |
+
"model.layers.9.feedforward.up_proj.weight": "model-00001-of-00001.safetensors",
|
| 435 |
+
"model.layers.9.post_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 436 |
+
"model.layers.9.post_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 437 |
+
"model.layers.9.pre_attention_norm.weight": "model-00001-of-00001.safetensors",
|
| 438 |
+
"model.layers.9.pre_feedforward_norm.weight": "model-00001-of-00001.safetensors",
|
| 439 |
+
"model.norm.weight": "model-00001-of-00001.safetensors"
|
| 440 |
+
}
|
| 441 |
+
}
|
modeling_domynedge.py
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2026 Domyn
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
#
|
| 4 |
+
# This file includes third-party code:
|
| 5 |
+
#
|
| 6 |
+
# - `DomynEdgeRotaryEmbedding.compute_default_rope_parameters` and `apply_rotary_pos_emb` are adapted from
|
| 7 |
+
# HuggingFace transformers
|
| 8 |
+
# (https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py),
|
| 9 |
+
# Copyright The HuggingFace Team, licensed under the Apache License, Version 2.0.
|
| 10 |
+
# Modified for DomynEdge.
|
| 11 |
+
|
| 12 |
+
import typing
|
| 13 |
+
|
| 14 |
+
import torch
|
| 15 |
+
import torch.nn.attention.varlen
|
| 16 |
+
import transformers
|
| 17 |
+
import transformers.modeling_outputs
|
| 18 |
+
from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask, flash_attention_mask
|
| 19 |
+
from transformers.modeling_flash_attention_utils import (
|
| 20 |
+
_is_packed_sequence,
|
| 21 |
+
_pad_input,
|
| 22 |
+
_prepare_from_posids,
|
| 23 |
+
_unpad_input,
|
| 24 |
+
_upad_input,
|
| 25 |
+
)
|
| 26 |
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS
|
| 27 |
+
from transformers.models.llama.modeling_llama import eager_attention_forward, rotate_half
|
| 28 |
+
from transformers.utils.generic import can_return_tuple, merge_with_config_defaults
|
| 29 |
+
from transformers.utils.output_capturing import capture_outputs
|
| 30 |
+
|
| 31 |
+
from .configuration_domynedge import DomynEdgeConfig
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class DomynEdgeFeedForward(torch.nn.Module):
|
| 35 |
+
def __init__(self, config):
|
| 36 |
+
super().__init__()
|
| 37 |
+
self.config = config
|
| 38 |
+
self.hidden_size = config.hidden_size
|
| 39 |
+
self.intermediate_size = config.intermediate_size
|
| 40 |
+
self.gate_proj = torch.nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 41 |
+
self.up_proj = torch.nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 42 |
+
self.down_proj = torch.nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 43 |
+
|
| 44 |
+
def forward(self, x):
|
| 45 |
+
return self.down_proj(torch.nn.functional.silu(self.gate_proj(x)) * self.up_proj(x))
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class DomynEdgeRotaryEmbedding(torch.nn.Module):
|
| 49 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 50 |
+
|
| 51 |
+
def __init__(self, config: DomynEdgeConfig, device=None):
|
| 52 |
+
super().__init__()
|
| 53 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 54 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 55 |
+
|
| 56 |
+
self.config = config
|
| 57 |
+
|
| 58 |
+
assert self.config.rope_parameters is not None
|
| 59 |
+
self.rope_type = self.config.rope_parameters["rope_type"]
|
| 60 |
+
rope_init_fn: typing.Callable = self.compute_default_rope_parameters
|
| 61 |
+
inv_freq, self.attention_scaling = rope_init_fn(self.config, device)
|
| 62 |
+
|
| 63 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 64 |
+
self.register_buffer("original_inv_freq", inv_freq.clone(), persistent=False)
|
| 65 |
+
|
| 66 |
+
@staticmethod
|
| 67 |
+
def compute_default_rope_parameters(
|
| 68 |
+
config: DomynEdgeConfig,
|
| 69 |
+
device: typing.Optional["torch.device"] = None,
|
| 70 |
+
) -> tuple["torch.Tensor", float]:
|
| 71 |
+
"""Computes the inverse frequencies according to the original RoPE implementation.
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
config ([`~transformers.PreTrainedConfig`]):
|
| 75 |
+
The model configuration.
|
| 76 |
+
device (`torch.device`):
|
| 77 |
+
The device to use for initialization of the inverse frequencies.
|
| 78 |
+
|
| 79 |
+
Returns:
|
| 80 |
+
Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
|
| 81 |
+
post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
|
| 82 |
+
"""
|
| 83 |
+
assert config.rope_parameters is not None
|
| 84 |
+
assert config.rope_parameters["rope_theta"] is not None
|
| 85 |
+
|
| 86 |
+
base = config.rope_parameters["rope_theta"]
|
| 87 |
+
dim = config.rope_dim
|
| 88 |
+
|
| 89 |
+
attention_factor = 1.0 # Unused in this type of RoPE
|
| 90 |
+
|
| 91 |
+
# Compute the inverse frequencies
|
| 92 |
+
inv_freq = 1.0 / (
|
| 93 |
+
base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
|
| 94 |
+
)
|
| 95 |
+
return inv_freq, attention_factor
|
| 96 |
+
|
| 97 |
+
@torch.no_grad()
|
| 98 |
+
def forward(self, x, position_ids):
|
| 99 |
+
# Recomputed on the input's device instead of reading the `inv_freq` buffer, to match the training
|
| 100 |
+
# implementation.
|
| 101 |
+
inv_freq, _ = self.compute_default_rope_parameters(self.config, x.device)
|
| 102 |
+
# An elementwise product, not a matmul, so torch.autocast(bfloat16) does not lower it.
|
| 103 |
+
freqs = position_ids[..., None].float() * inv_freq
|
| 104 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 105 |
+
cos = emb.cos() * self.attention_scaling
|
| 106 |
+
sin = emb.sin() * self.attention_scaling
|
| 107 |
+
|
| 108 |
+
return cos, sin
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
|
| 112 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 113 |
+
|
| 114 |
+
Args:
|
| 115 |
+
q (`torch.Tensor`): The query tensor.
|
| 116 |
+
k (`torch.Tensor`): The key tensor.
|
| 117 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 118 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 119 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 120 |
+
The dimension along which to unsqueeze cos and sin so that they broadcast to q and k. Use 1 when q and k
|
| 121 |
+
have the shape [batch_size, heads, seq_len, head_dim], 2 for [batch_size, seq_len, heads, head_dim].
|
| 122 |
+
|
| 123 |
+
Returns:
|
| 124 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 125 |
+
"""
|
| 126 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
| 127 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
| 128 |
+
qf, kf = q.float(), k.float()
|
| 129 |
+
q_embed = (qf * cos) + (rotate_half(qf) * sin)
|
| 130 |
+
k_embed = (kf * cos) + (rotate_half(kf) * sin)
|
| 131 |
+
# Main difference with respect to transformers.models.llama.modeling_llama, llama does not do the upcast
|
| 132 |
+
return q_embed.to(q.dtype), k_embed.to(k.dtype)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def torch_varlen_attention_forward(
|
| 136 |
+
_module: torch.nn.Module,
|
| 137 |
+
query: torch.Tensor,
|
| 138 |
+
key: torch.Tensor,
|
| 139 |
+
value: torch.Tensor,
|
| 140 |
+
attention_mask: torch.Tensor | None,
|
| 141 |
+
scaling: float | None = None,
|
| 142 |
+
sliding_window: int | None = None,
|
| 143 |
+
position_ids: torch.Tensor | None = None,
|
| 144 |
+
**_kwargs,
|
| 145 |
+
) -> tuple[torch.Tensor, None]:
|
| 146 |
+
"""Attention through PyTorch's built-in flash kernel, the one the model is trained with.
|
| 147 |
+
|
| 148 |
+
Selected with `attn_implementation="torch_varlen"`, it needs no `flash_attn` package.
|
| 149 |
+
"""
|
| 150 |
+
batch_size, _, q_len, head_dim = query.shape
|
| 151 |
+
query, key, value = query.transpose(1, 2), key.transpose(1, 2), value.transpose(1, 2)
|
| 152 |
+
indices_q = None
|
| 153 |
+
if attention_mask is not None:
|
| 154 |
+
query, key, value, indices_q, (cu_seq_q, cu_seq_k), (max_q, max_k) = _upad_input(
|
| 155 |
+
query, key, value, attention_mask, q_len, _unpad_input
|
| 156 |
+
)
|
| 157 |
+
elif _is_packed_sequence(position_ids, batch_size):
|
| 158 |
+
query, key, value, (cu_seq_q, cu_seq_k), (max_q, max_k) = _prepare_from_posids(query, key, value, position_ids)
|
| 159 |
+
max_q, max_k = int(max_q), int(max_k)
|
| 160 |
+
else:
|
| 161 |
+
k_len = key.shape[1]
|
| 162 |
+
query, key, value = query.flatten(0, 1), key.flatten(0, 1), value.flatten(0, 1)
|
| 163 |
+
cu_seq_q = torch.arange(0, (batch_size + 1) * q_len, q_len, dtype=torch.int32, device=query.device)
|
| 164 |
+
cu_seq_k = torch.arange(0, (batch_size + 1) * k_len, k_len, dtype=torch.int32, device=query.device)
|
| 165 |
+
max_q, max_k = q_len, k_len
|
| 166 |
+
|
| 167 |
+
output = torch.nn.attention.varlen.varlen_attn(
|
| 168 |
+
query,
|
| 169 |
+
key,
|
| 170 |
+
value,
|
| 171 |
+
cu_seq_q,
|
| 172 |
+
cu_seq_k,
|
| 173 |
+
max_q,
|
| 174 |
+
max_k,
|
| 175 |
+
scale=scaling,
|
| 176 |
+
# transformers' `sliding_window` counts the current token, flash attention's left window does not.
|
| 177 |
+
window_size=(-1 if sliding_window is None else sliding_window - 1, 0),
|
| 178 |
+
enable_gqa=query.shape[1] != key.shape[1],
|
| 179 |
+
)
|
| 180 |
+
assert isinstance(output, torch.Tensor)
|
| 181 |
+
if indices_q is None:
|
| 182 |
+
return output.view(batch_size, q_len, -1, head_dim), None
|
| 183 |
+
return _pad_input(output, indices_q, batch_size, q_len), None
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
transformers.AttentionInterface.register("torch_varlen", torch_varlen_attention_forward)
|
| 187 |
+
# Without a registered mask function, transformers passes no mask at all to a custom implementation, padding included.
|
| 188 |
+
transformers.AttentionMaskInterface.register("torch_varlen", flash_attention_mask)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
class DomynEdgeAttention(torch.nn.Module):
|
| 192 |
+
"""Grouped Query Attention with per-layer head size, optional RoPE and optional sliding window.
|
| 193 |
+
|
| 194 |
+
Attention is dispatched through `ALL_ATTENTION_FUNCTIONS`, so any transformers attention implementation
|
| 195 |
+
(eager, sdpa, flash_attention_2, flex) and vLLM's Transformers backend can serve it.
|
| 196 |
+
"""
|
| 197 |
+
|
| 198 |
+
def __init__(self, config: DomynEdgeConfig, layer_idx: int):
|
| 199 |
+
super().__init__()
|
| 200 |
+
self.config = config
|
| 201 |
+
self.layer_idx = layer_idx
|
| 202 |
+
self.layer_type = config.layer_types[layer_idx]
|
| 203 |
+
self.head_dim = config.per_layer_config[layer_idx].head_dim
|
| 204 |
+
self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
|
| 205 |
+
self.scaling = self.head_dim**-0.5
|
| 206 |
+
self.attention_dropout = config.attention_dropout
|
| 207 |
+
self.is_causal = True
|
| 208 |
+
self.use_rope = config.position_layers[layer_idx] == "rope"
|
| 209 |
+
self.sliding_window = config.sliding_window if self.layer_type == "sliding_attention" else None
|
| 210 |
+
|
| 211 |
+
self.q_proj = torch.nn.Linear(
|
| 212 |
+
config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
|
| 213 |
+
)
|
| 214 |
+
self.k_proj = torch.nn.Linear(
|
| 215 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 216 |
+
)
|
| 217 |
+
self.v_proj = torch.nn.Linear(
|
| 218 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 219 |
+
)
|
| 220 |
+
self.o_proj = torch.nn.Linear(
|
| 221 |
+
config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
|
| 222 |
+
)
|
| 223 |
+
self.q_norm = torch.nn.RMSNorm(self.head_dim, eps=config.rms_norm_eps, elementwise_affine=False)
|
| 224 |
+
self.k_norm = torch.nn.RMSNorm(self.head_dim, eps=config.rms_norm_eps, elementwise_affine=True)
|
| 225 |
+
|
| 226 |
+
def forward(
|
| 227 |
+
self,
|
| 228 |
+
hidden_states: torch.Tensor,
|
| 229 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 230 |
+
attention_mask: torch.Tensor | None,
|
| 231 |
+
past_key_values: transformers.Cache | None = None,
|
| 232 |
+
**kwargs,
|
| 233 |
+
) -> tuple[torch.Tensor, torch.Tensor | None]:
|
| 234 |
+
batch_size, sequence_length, _ = hidden_states.shape
|
| 235 |
+
query_shape = (batch_size, sequence_length, self.config.num_attention_heads, self.head_dim)
|
| 236 |
+
key_value_shape = (batch_size, sequence_length, self.config.num_key_value_heads, self.head_dim)
|
| 237 |
+
|
| 238 |
+
query_states = self.q_norm(self.q_proj(hidden_states).view(query_shape)).transpose(1, 2)
|
| 239 |
+
key_states = self.k_norm(self.k_proj(hidden_states).view(key_value_shape)).transpose(1, 2)
|
| 240 |
+
value_states = self.v_proj(hidden_states).view(key_value_shape).transpose(1, 2)
|
| 241 |
+
|
| 242 |
+
if self.use_rope:
|
| 243 |
+
cos, sin = position_embeddings
|
| 244 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 245 |
+
|
| 246 |
+
if past_key_values is not None:
|
| 247 |
+
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
|
| 248 |
+
|
| 249 |
+
# `get_interface` handles a None implementation, despite its `str` annotation
|
| 250 |
+
attention_interface: typing.Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
|
| 251 |
+
self.config._attn_implementation, # noqa: SLF001 # pyright: ignore[reportArgumentType]
|
| 252 |
+
eager_attention_forward,
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
attn_output, attn_weights = attention_interface(
|
| 256 |
+
self,
|
| 257 |
+
query_states,
|
| 258 |
+
key_states,
|
| 259 |
+
value_states,
|
| 260 |
+
attention_mask,
|
| 261 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 262 |
+
scaling=self.scaling,
|
| 263 |
+
sliding_window=self.sliding_window,
|
| 264 |
+
**kwargs,
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
attn_output = attn_output.reshape(
|
| 268 |
+
batch_size, sequence_length, self.config.num_attention_heads * self.head_dim
|
| 269 |
+
).contiguous()
|
| 270 |
+
attn_output = self.o_proj(attn_output)
|
| 271 |
+
return attn_output, attn_weights
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
class DomynEdgeDecoderLayer(torch.nn.Module):
|
| 275 |
+
def __init__(self, config: DomynEdgeConfig, layer_idx: int):
|
| 276 |
+
super().__init__()
|
| 277 |
+
self.config = config
|
| 278 |
+
|
| 279 |
+
self.attention = DomynEdgeAttention(config=config, layer_idx=layer_idx)
|
| 280 |
+
self.feedforward = DomynEdgeFeedForward(config)
|
| 281 |
+
|
| 282 |
+
self.pre_attention_norm = torch.nn.RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 283 |
+
self.pre_feedforward_norm = torch.nn.RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 284 |
+
self.post_attention_norm = torch.nn.RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 285 |
+
self.post_feedforward_norm = torch.nn.RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 286 |
+
|
| 287 |
+
def forward(
|
| 288 |
+
self,
|
| 289 |
+
hidden_states: torch.Tensor,
|
| 290 |
+
attention_mask: torch.Tensor | None = None,
|
| 291 |
+
past_key_values: transformers.Cache | None = None,
|
| 292 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 293 |
+
**kwargs,
|
| 294 |
+
) -> torch.Tensor:
|
| 295 |
+
# Self Attention
|
| 296 |
+
attn_output, _ = self.attention(
|
| 297 |
+
hidden_states=self.pre_attention_norm(hidden_states),
|
| 298 |
+
attention_mask=attention_mask,
|
| 299 |
+
past_key_values=past_key_values,
|
| 300 |
+
position_embeddings=position_embeddings,
|
| 301 |
+
**kwargs,
|
| 302 |
+
)
|
| 303 |
+
hidden_states = hidden_states + self.post_attention_norm(attn_output)
|
| 304 |
+
|
| 305 |
+
## Fully Connected
|
| 306 |
+
return hidden_states + self.post_feedforward_norm(self.feedforward(self.pre_feedforward_norm(hidden_states)))
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
class DomynEdgePreTrainedModel(transformers.PreTrainedModel):
|
| 310 |
+
"""Base class wiring DomynEdge into the HuggingFace `PreTrainedModel` machinery."""
|
| 311 |
+
|
| 312 |
+
config: DomynEdgeConfig
|
| 313 |
+
base_model_prefix = "model"
|
| 314 |
+
supports_gradient_checkpointing = False
|
| 315 |
+
_no_split_modules = ["DomynEdgeDecoderLayer"]
|
| 316 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 317 |
+
_supports_flash_attn = True
|
| 318 |
+
_supports_sdpa = True
|
| 319 |
+
_supports_flex_attn = True
|
| 320 |
+
|
| 321 |
+
_can_compile_fullgraph = True
|
| 322 |
+
_supports_attention_backend = True
|
| 323 |
+
_can_record_outputs = {
|
| 324 |
+
"hidden_states": DomynEdgeDecoderLayer,
|
| 325 |
+
"attentions": DomynEdgeAttention,
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
class DomynEdgeModel(DomynEdgePreTrainedModel):
|
| 330 |
+
"""DomynEdge decoder stack without the language modeling head."""
|
| 331 |
+
|
| 332 |
+
def __init__(self, config: DomynEdgeConfig):
|
| 333 |
+
"""Build the embeddings, decoder layers, final norm and rotary embedding from `config`."""
|
| 334 |
+
super().__init__(config)
|
| 335 |
+
self.padding_idx = config.pad_token_id
|
| 336 |
+
self.vocab_size = config.vocab_size
|
| 337 |
+
|
| 338 |
+
self.embed_tokens = torch.nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 339 |
+
self.layers = torch.nn.ModuleList(
|
| 340 |
+
[DomynEdgeDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 341 |
+
)
|
| 342 |
+
self.norm = torch.nn.RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 343 |
+
self.rotary_emb = DomynEdgeRotaryEmbedding(config=config)
|
| 344 |
+
self.has_sliding_layers = "sliding_attention" in config.layer_types
|
| 345 |
+
|
| 346 |
+
# Initialize weights and apply final processing
|
| 347 |
+
self.post_init()
|
| 348 |
+
|
| 349 |
+
@merge_with_config_defaults
|
| 350 |
+
@capture_outputs
|
| 351 |
+
def forward(
|
| 352 |
+
self,
|
| 353 |
+
input_ids: torch.LongTensor | None = None,
|
| 354 |
+
attention_mask: torch.Tensor | dict[str, torch.Tensor] | None = None,
|
| 355 |
+
past_key_values: transformers.Cache | None = None,
|
| 356 |
+
inputs_embeds: torch.Tensor | None = None,
|
| 357 |
+
position_ids: torch.Tensor | None = None,
|
| 358 |
+
use_cache: bool | None = None,
|
| 359 |
+
**kwargs,
|
| 360 |
+
) -> transformers.modeling_outputs.BaseModelOutputWithPast:
|
| 361 |
+
"""Run the decoder stack and return the final hidden states (and the cache when `use_cache` is set)."""
|
| 362 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 363 |
+
msg = "You must specify exactly one of input_ids or inputs_embeds"
|
| 364 |
+
raise ValueError(msg)
|
| 365 |
+
|
| 366 |
+
if inputs_embeds is None:
|
| 367 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 368 |
+
assert inputs_embeds is not None
|
| 369 |
+
|
| 370 |
+
if use_cache and past_key_values is None:
|
| 371 |
+
past_key_values = transformers.DynamicCache(config=self.config)
|
| 372 |
+
|
| 373 |
+
if position_ids is None:
|
| 374 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 375 |
+
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
|
| 376 |
+
position_ids = position_ids.unsqueeze(0)
|
| 377 |
+
|
| 378 |
+
# It may already have been prepared by the caller, e.g. `generate`
|
| 379 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 380 |
+
mask_kwargs = {
|
| 381 |
+
"config": self.config,
|
| 382 |
+
"inputs_embeds": inputs_embeds,
|
| 383 |
+
"attention_mask": attention_mask,
|
| 384 |
+
"past_key_values": past_key_values,
|
| 385 |
+
"position_ids": position_ids,
|
| 386 |
+
}
|
| 387 |
+
causal_mask_mapping = {"full_attention": create_causal_mask(**mask_kwargs)}
|
| 388 |
+
if self.has_sliding_layers:
|
| 389 |
+
causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
|
| 390 |
+
|
| 391 |
+
hidden_states = inputs_embeds
|
| 392 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 393 |
+
|
| 394 |
+
for i, decoder_layer in enumerate(self.layers):
|
| 395 |
+
hidden_states = decoder_layer(
|
| 396 |
+
hidden_states,
|
| 397 |
+
attention_mask=causal_mask_mapping[self.config.layer_types[i]],
|
| 398 |
+
position_embeddings=position_embeddings,
|
| 399 |
+
position_ids=position_ids,
|
| 400 |
+
past_key_values=past_key_values,
|
| 401 |
+
**kwargs,
|
| 402 |
+
)
|
| 403 |
+
|
| 404 |
+
hidden_states = self.norm(hidden_states)
|
| 405 |
+
return transformers.modeling_outputs.BaseModelOutputWithPast(
|
| 406 |
+
last_hidden_state=hidden_states,
|
| 407 |
+
past_key_values=past_key_values if use_cache else None,
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
class DomynEdgeForCausalLM(DomynEdgePreTrainedModel, transformers.GenerationMixin):
|
| 412 |
+
"""DomynEdge model with a language modeling head tied to the input embeddings."""
|
| 413 |
+
|
| 414 |
+
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
|
| 415 |
+
|
| 416 |
+
def __init__(self, config):
|
| 417 |
+
"""Build the decoder stack and the language modeling head from `config`."""
|
| 418 |
+
super().__init__(config)
|
| 419 |
+
self.model = DomynEdgeModel(config)
|
| 420 |
+
self.vocab_size = config.vocab_size
|
| 421 |
+
self.lm_head = torch.nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 422 |
+
|
| 423 |
+
# Initialize weights and apply final processing
|
| 424 |
+
self.post_init()
|
| 425 |
+
|
| 426 |
+
@can_return_tuple
|
| 427 |
+
def forward(
|
| 428 |
+
self,
|
| 429 |
+
input_ids: torch.LongTensor | None = None,
|
| 430 |
+
attention_mask: torch.Tensor | None = None,
|
| 431 |
+
position_ids: torch.LongTensor | None = None,
|
| 432 |
+
past_key_values: transformers.Cache | None = None,
|
| 433 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 434 |
+
labels: torch.LongTensor | None = None,
|
| 435 |
+
use_cache: bool | None = None,
|
| 436 |
+
logits_to_keep: int | torch.Tensor = 0,
|
| 437 |
+
**kwargs,
|
| 438 |
+
) -> transformers.modeling_outputs.CausalLMOutputWithPast:
|
| 439 |
+
"""Compute logits for the last `logits_to_keep` positions, plus the loss when `labels` are given."""
|
| 440 |
+
outputs = self.model(
|
| 441 |
+
input_ids=input_ids,
|
| 442 |
+
attention_mask=attention_mask,
|
| 443 |
+
position_ids=position_ids,
|
| 444 |
+
past_key_values=past_key_values,
|
| 445 |
+
inputs_embeds=inputs_embeds,
|
| 446 |
+
use_cache=use_cache,
|
| 447 |
+
**kwargs,
|
| 448 |
+
)
|
| 449 |
+
|
| 450 |
+
hidden_states = outputs.last_hidden_state
|
| 451 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 452 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 453 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 454 |
+
loss = (
|
| 455 |
+
self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
|
| 456 |
+
if labels is not None
|
| 457 |
+
else None
|
| 458 |
+
)
|
| 459 |
+
|
| 460 |
+
return transformers.modeling_outputs.CausalLMOutputWithPast(
|
| 461 |
+
loss=loss,
|
| 462 |
+
logits=logits,
|
| 463 |
+
past_key_values=outputs.past_key_values,
|
| 464 |
+
hidden_states=outputs.hidden_states,
|
| 465 |
+
attentions=outputs.attentions,
|
| 466 |
+
)
|
| 467 |
+
|
| 468 |
+
|
| 469 |
+
__all__ = [
|
| 470 |
+
"DomynEdgeForCausalLM",
|
| 471 |
+
"DomynEdgeModel",
|
| 472 |
+
"DomynEdgePreTrainedModel",
|
| 473 |
+
]
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
{
|
| 4 |
+
"content": "<|fim_prefix|>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"content": "<|fim_suffix|>",
|
| 12 |
+
"lstrip": false,
|
| 13 |
+
"normalized": false,
|
| 14 |
+
"rstrip": false,
|
| 15 |
+
"single_word": false
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"content": "<|fim_middle|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"bos_token": {
|
| 26 |
+
"content": "<|beginoftext|>",
|
| 27 |
+
"lstrip": false,
|
| 28 |
+
"normalized": false,
|
| 29 |
+
"rstrip": false,
|
| 30 |
+
"single_word": false
|
| 31 |
+
},
|
| 32 |
+
"eos_token": {
|
| 33 |
+
"content": "<|endoftext|>",
|
| 34 |
+
"lstrip": false,
|
| 35 |
+
"normalized": false,
|
| 36 |
+
"rstrip": false,
|
| 37 |
+
"single_word": false
|
| 38 |
+
},
|
| 39 |
+
"pad_token": {
|
| 40 |
+
"content": "<|pad|>",
|
| 41 |
+
"lstrip": false,
|
| 42 |
+
"normalized": false,
|
| 43 |
+
"rstrip": false,
|
| 44 |
+
"single_word": false
|
| 45 |
+
}
|
| 46 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b674b69c9a68226dc8ca2a88a161ee1fd917dafc0361c442f8ec3d4073e967d2
|
| 3 |
+
size 15956463
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"115256": {
|
| 4 |
+
"content": "<|beginoftext|>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"115257": {
|
| 12 |
+
"content": "<|endoftext|>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"115258": {
|
| 20 |
+
"content": "<|im_start|>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"115259": {
|
| 28 |
+
"content": "<|im_end|>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"115260": {
|
| 36 |
+
"content": "<tool_call>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"115261": {
|
| 44 |
+
"content": "</tool_call>",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"115262": {
|
| 52 |
+
"content": "<repo_name>",
|
| 53 |
+
"lstrip": false,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
},
|
| 59 |
+
"115263": {
|
| 60 |
+
"content": "<file_sep>",
|
| 61 |
+
"lstrip": false,
|
| 62 |
+
"normalized": false,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"special": true
|
| 66 |
+
},
|
| 67 |
+
"115264": {
|
| 68 |
+
"content": "<tool_response>",
|
| 69 |
+
"lstrip": false,
|
| 70 |
+
"normalized": false,
|
| 71 |
+
"rstrip": false,
|
| 72 |
+
"single_word": false,
|
| 73 |
+
"special": true
|
| 74 |
+
},
|
| 75 |
+
"115265": {
|
| 76 |
+
"content": "</tool_response>",
|
| 77 |
+
"lstrip": false,
|
| 78 |
+
"normalized": false,
|
| 79 |
+
"rstrip": false,
|
| 80 |
+
"single_word": false,
|
| 81 |
+
"special": true
|
| 82 |
+
},
|
| 83 |
+
"115266": {
|
| 84 |
+
"content": "<think>",
|
| 85 |
+
"lstrip": false,
|
| 86 |
+
"normalized": false,
|
| 87 |
+
"rstrip": false,
|
| 88 |
+
"single_word": false,
|
| 89 |
+
"special": false
|
| 90 |
+
},
|
| 91 |
+
"115267": {
|
| 92 |
+
"content": "</think>",
|
| 93 |
+
"lstrip": false,
|
| 94 |
+
"normalized": false,
|
| 95 |
+
"rstrip": false,
|
| 96 |
+
"single_word": false,
|
| 97 |
+
"special": false
|
| 98 |
+
},
|
| 99 |
+
"115268": {
|
| 100 |
+
"content": "<|pad|>",
|
| 101 |
+
"lstrip": false,
|
| 102 |
+
"normalized": false,
|
| 103 |
+
"rstrip": false,
|
| 104 |
+
"single_word": false,
|
| 105 |
+
"special": true
|
| 106 |
+
},
|
| 107 |
+
"115269": {
|
| 108 |
+
"content": "<|fim_prefix|>",
|
| 109 |
+
"lstrip": false,
|
| 110 |
+
"normalized": false,
|
| 111 |
+
"rstrip": false,
|
| 112 |
+
"single_word": false,
|
| 113 |
+
"special": true
|
| 114 |
+
},
|
| 115 |
+
"115270": {
|
| 116 |
+
"content": "<|fim_suffix|>",
|
| 117 |
+
"lstrip": false,
|
| 118 |
+
"normalized": false,
|
| 119 |
+
"rstrip": false,
|
| 120 |
+
"single_word": false,
|
| 121 |
+
"special": true
|
| 122 |
+
},
|
| 123 |
+
"115271": {
|
| 124 |
+
"content": "<|fim_middle|>",
|
| 125 |
+
"lstrip": false,
|
| 126 |
+
"normalized": false,
|
| 127 |
+
"rstrip": false,
|
| 128 |
+
"single_word": false,
|
| 129 |
+
"special": true
|
| 130 |
+
}
|
| 131 |
+
},
|
| 132 |
+
"additional_special_tokens": [
|
| 133 |
+
"<|fim_prefix|>",
|
| 134 |
+
"<|fim_suffix|>",
|
| 135 |
+
"<|fim_middle|>"
|
| 136 |
+
],
|
| 137 |
+
"bos_token": "<|im_start|>",
|
| 138 |
+
"clean_up_tokenization_spaces": false,
|
| 139 |
+
"eos_token": "<|im_end|>",
|
| 140 |
+
"extra_special_tokens": {},
|
| 141 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 142 |
+
"pad_token": "<|pad|>",
|
| 143 |
+
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 144 |
+
}
|