Text Generation
Transformers
Safetensors
Turkish
erk
turkish
türkçe
ecloud
llm
conversational
text-generation-inference
custom_code
Eval Results (legacy)
Instructions to use ecloudtech/Erk-14B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ecloudtech/Erk-14B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ecloudtech/Erk-14B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ecloudtech/Erk-14B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ecloudtech/Erk-14B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ecloudtech/Erk-14B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecloudtech/Erk-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ecloudtech/Erk-14B
- SGLang
How to use ecloudtech/Erk-14B 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 "ecloudtech/Erk-14B" \ --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": "ecloudtech/Erk-14B", "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 "ecloudtech/Erk-14B" \ --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": "ecloudtech/Erk-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ecloudtech/Erk-14B with Docker Model Runner:
docker model run hf.co/ecloudtech/Erk-14B
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- LICENSE +70 -0
- README.md +98 -0
- config.json +79 -0
- configuration_erk.py +100 -0
- generation_config.json +13 -0
- merges.txt +0 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +451 -0
- modeling_erk.py +538 -0
- tokenizer.json +3 -0
- tokenizer_config.json +238 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* 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
|
|
|
|
|
|
| 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=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
eCloud Açık Topluluk Lisansı v1.0
|
| 2 |
+
eCloud Open Community License v1.0
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2026 eCloud Yazılım Teknolojileri. Tüm hakları saklıdır.
|
| 5 |
+
|
| 6 |
+
================================================================================
|
| 7 |
+
TÜRKÇE
|
| 8 |
+
================================================================================
|
| 9 |
+
|
| 10 |
+
Bu lisans, "Erk" adlı yapay zekâ modeli ve ilgili ağırlıklar, kod ve
|
| 11 |
+
belgeleri ("Materyaller") için geçerlidir.
|
| 12 |
+
|
| 13 |
+
1. VERİLEN İZİNLER (Ücretsiz)
|
| 14 |
+
Aşağıdaki kullanımlar için ücretsiz ve serbest izin verilir:
|
| 15 |
+
a) Materyalleri indirmek, çalıştırmak ve incelemek;
|
| 16 |
+
b) Araştırma, eğitim ve kişisel amaçlarla kullanmak;
|
| 17 |
+
c) Materyaller üzerinde değişiklik yapmak, türev çalışmalar (ince ayar,
|
| 18 |
+
uyarlama vb.) geliştirmek;
|
| 19 |
+
d) Değişiklikleri ve türev çalışmaları, bu lisansın koşullarıyla birlikte
|
| 20 |
+
ve kaynağı (Erk / eCloud Yazılım Teknolojileri) belirterek paylaşmak.
|
| 21 |
+
|
| 22 |
+
2. TİCARİ KULLANIM
|
| 23 |
+
Materyallerin veya türevlerinin ticari bir ürün, hizmet ya da gelir getirici
|
| 24 |
+
faaliyette kullanılması, eCloud Yazılım Teknolojileri'nden önceden yazılı izin
|
| 25 |
+
alınmasını gerektirir. Ticari kullanım için iletişim: info@e-cloud.web.tr
|
| 26 |
+
|
| 27 |
+
3. ATIF
|
| 28 |
+
Materyalleri kullanan tüm çalışmalar, "Erk — eCloud Yazılım Teknolojileri"
|
| 29 |
+
ifadesine ve bu depoya atıfta bulunmalıdır.
|
| 30 |
+
|
| 31 |
+
4. TİCARİ HAKLAR
|
| 32 |
+
Materyallere ilişkin tüm ticari haklar eCloud Yazılım Teknolojileri'ne aittir.
|
| 33 |
+
Bu lisans, marka, ticari unvan veya patent hakkı devri anlamına gelmez.
|
| 34 |
+
|
| 35 |
+
5. GARANTİ REDDİ
|
| 36 |
+
Materyaller "OLDUĞU GİBİ" sağlanır; açık ya da örtük hiçbir garanti verilmez.
|
| 37 |
+
eCloud Yazılım Teknolojileri, kullanımdan doğabilecek zararlardan sorumlu değildir.
|
| 38 |
+
|
| 39 |
+
================================================================================
|
| 40 |
+
ENGLISH
|
| 41 |
+
================================================================================
|
| 42 |
+
|
| 43 |
+
This license applies to the "Erk" AI model and its associated weights, code and
|
| 44 |
+
documentation (the "Materials").
|
| 45 |
+
|
| 46 |
+
1. PERMISSIONS (Free of charge)
|
| 47 |
+
The following uses are permitted free of charge:
|
| 48 |
+
a) downloading, running and studying the Materials;
|
| 49 |
+
b) use for research, educational and personal purposes;
|
| 50 |
+
c) modifying the Materials and creating derivative works (fine-tuning,
|
| 51 |
+
adaptation, etc.);
|
| 52 |
+
d) sharing modifications and derivatives under the terms of this license,
|
| 53 |
+
with attribution to the source (Erk / eCloud Yazılım Teknolojileri).
|
| 54 |
+
|
| 55 |
+
2. COMMERCIAL USE
|
| 56 |
+
Any use of the Materials or their derivatives in a commercial product, service
|
| 57 |
+
or revenue-generating activity requires prior written permission from
|
| 58 |
+
eCloud Yazılım Teknolojileri. For commercial use, contact: info@e-cloud.web.tr
|
| 59 |
+
|
| 60 |
+
3. ATTRIBUTION
|
| 61 |
+
All works using the Materials must credit "Erk — eCloud Yazılım Teknolojileri"
|
| 62 |
+
and reference this repository.
|
| 63 |
+
|
| 64 |
+
4. COMMERCIAL RIGHTS
|
| 65 |
+
All commercial rights to the Materials remain with eCloud Yazılım Teknolojileri.
|
| 66 |
+
This license does not transfer any trademark, trade name or patent rights.
|
| 67 |
+
|
| 68 |
+
5. DISCLAIMER
|
| 69 |
+
The Materials are provided "AS IS", without warranty of any kind. eCloud
|
| 70 |
+
Yazılım Teknolojileri is not liable for any damages arising from their use.
|
README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- tr
|
| 4 |
+
license: other
|
| 5 |
+
license_name: ecloud-open-community-license
|
| 6 |
+
license_link: LICENSE
|
| 7 |
+
library_name: transformers
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- turkish
|
| 11 |
+
- türkçe
|
| 12 |
+
- erk
|
| 13 |
+
- ecloud
|
| 14 |
+
- llm
|
| 15 |
+
- conversational
|
| 16 |
+
model-index:
|
| 17 |
+
- name: Erk
|
| 18 |
+
results:
|
| 19 |
+
- task:
|
| 20 |
+
type: text-generation
|
| 21 |
+
dataset:
|
| 22 |
+
name: TurkishMMLU
|
| 23 |
+
type: turkishmmlu
|
| 24 |
+
metrics:
|
| 25 |
+
- type: accuracy
|
| 26 |
+
value: 69.7
|
| 27 |
+
name: TurkishMMLU (0-shot, 9 ders ort.)
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
<div align="center">
|
| 31 |
+
|
| 32 |
+
# Erk
|
| 33 |
+
|
| 34 |
+
### Türkçe için sıfırdan geliştirilmiş yapay zekâ modeli
|
| 35 |
+
|
| 36 |
+
**TurkishMMLU'da test edilen açık Türkçe modellerin en iyisi — %69,7**
|
| 37 |
+
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
**Erk**, [eCloud Yazılım Teknolojileri](https://www.e-cloud.web.tr) tarafından
|
| 43 |
+
geliştirilen, Türkçe'ye özel bir büyük dil modelidir (14 milyar parametre). Türkçe-native
|
| 44 |
+
tokenizer, Türkçe derlemde ön-eğitim ve gerçek belgelerle beslenen talimat ayarıyla,
|
| 45 |
+
Türkçe'yi kökünden anlar.
|
| 46 |
+
|
| 47 |
+
## 🏆 Değerlendirme — TurkishMMLU
|
| 48 |
+
|
| 49 |
+
| Sıra | Model | Ölçek | TurkishMMLU |
|
| 50 |
+
|:--:|:---|:--:|:--:|
|
| 51 |
+
| 🥇 | **Erk** | 14B | **%69,7** |
|
| 52 |
+
| 2 | Qwen3 | 14B | %63,4 |
|
| 53 |
+
| 3 | Trendyol Asure | 12B | %60,9 |
|
| 54 |
+
| 4 | Turkish-Gemma (YTÜ) | 9B | %60,4 |
|
| 55 |
+
| 5 | Trendyol v4 | 7B | %53,0 |
|
| 56 |
+
| 6 | Kumru (VNGRS) | 2B | %20,1 |
|
| 57 |
+
|
| 58 |
+
Bağımsız, kamuya açık TurkishMMLU (9 ders, 0-shot). Erk'in en güçlü alanları:
|
| 59 |
+
**Coğrafya %85 · Felsefe %85 · Din ve Ahlak %83 · Tarih %76.**
|
| 60 |
+
|
| 61 |
+
## Kullanım
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
+
|
| 66 |
+
tokenizer = AutoTokenizer.from_pretrained("ecloudtech/erk", trust_remote_code=True)
|
| 67 |
+
model = AutoModelForCausalLM.from_pretrained("ecloudtech/erk", trust_remote_code=True)
|
| 68 |
+
|
| 69 |
+
mesaj = [{"role": "user", "content": "Osmanlı Devleti ne zaman kuruldu?"}]
|
| 70 |
+
metin = tokenizer.apply_chat_template(mesaj, tokenize=False, add_generation_prompt=True)
|
| 71 |
+
girdi = tokenizer(metin, return_tensors="pt")
|
| 72 |
+
cikti = model.generate(**girdi, max_new_tokens=256)
|
| 73 |
+
print(tokenizer.decode(cikti[0][girdi.input_ids.shape[1]:], skip_special_tokens=True))
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Model kartı
|
| 77 |
+
|
| 78 |
+
| Özellik | Değer |
|
| 79 |
+
|:---|:---|
|
| 80 |
+
| Geliştirici | eCloud Yazılım Teknolojileri |
|
| 81 |
+
| Parametre | 14 milyar |
|
| 82 |
+
| Dil | Türkçe |
|
| 83 |
+
| Tokenizer | Türkçe-native byte-level BPE (65.536) |
|
| 84 |
+
| Bağlam | 32K token |
|
| 85 |
+
| Bilgi kesim tarihi | Ağustos 2026 |
|
| 86 |
+
| Lisans | eCloud Açık Topluluk Lisansı |
|
| 87 |
+
|
| 88 |
+
## Lisans
|
| 89 |
+
|
| 90 |
+
Erk **açık kaynaklıdır**: herkes indirebilir, çalıştırabilir, inceleyebilir ve üzerine
|
| 91 |
+
türev çalışmalar geliştirebilir. **Ticari kullanım** için eCloud Yazılım
|
| 92 |
+
Teknolojileri'nden izin gereklidir. İletişim: info@e-cloud.web.tr
|
| 93 |
+
|
| 94 |
+
Eğitim reçetesi: [nanosohbet](https://github.com/ecloudtechnology/nanosohbet)
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
*Bir [eCloud Yazılım Teknolojileri](https://www.e-cloud.web.tr) projesidir · Yerli zekâ, küresel ölçek.*
|
config.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"ErkForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 151643,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 151645,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 5120,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 17408,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"full_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"full_attention"
|
| 56 |
+
],
|
| 57 |
+
"max_position_embeddings": 40960,
|
| 58 |
+
"max_window_layers": 40,
|
| 59 |
+
"model_type": "erk",
|
| 60 |
+
"num_attention_heads": 40,
|
| 61 |
+
"num_hidden_layers": 40,
|
| 62 |
+
"num_key_value_heads": 8,
|
| 63 |
+
"pad_token_id": null,
|
| 64 |
+
"rms_norm_eps": 1e-06,
|
| 65 |
+
"rope_parameters": {
|
| 66 |
+
"rope_theta": 1000000,
|
| 67 |
+
"rope_type": "default"
|
| 68 |
+
},
|
| 69 |
+
"sliding_window": null,
|
| 70 |
+
"tie_word_embeddings": false,
|
| 71 |
+
"transformers_version": "5.13.0",
|
| 72 |
+
"use_cache": false,
|
| 73 |
+
"use_sliding_window": false,
|
| 74 |
+
"vocab_size": 151936,
|
| 75 |
+
"auto_map": {
|
| 76 |
+
"AutoConfig": "configuration_erk.ErkConfig",
|
| 77 |
+
"AutoModelForCausalLM": "modeling_erk.ErkForCausalLM"
|
| 78 |
+
}
|
| 79 |
+
}
|
configuration_erk.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026 eCloud Yazılım Teknolojileri. Based on Apache-2.0 licensed transformer architecture.
|
| 2 |
+
#
|
| 3 |
+
# you may not use this file except in compliance with the License.
|
| 4 |
+
# You may obtain a copy of the License at
|
| 5 |
+
#
|
| 6 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 7 |
+
#
|
| 8 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 9 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 10 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 11 |
+
# See the License for the specific language governing permissions and
|
| 12 |
+
# limitations under the License.
|
| 13 |
+
"""Erk model configuration"""
|
| 14 |
+
|
| 15 |
+
from huggingface_hub.dataclasses import strict
|
| 16 |
+
|
| 17 |
+
from transformers.configuration_utils import PreTrainedConfig
|
| 18 |
+
from transformers.modeling_rope_utils import RopeParameters
|
| 19 |
+
from transformers.utils import auto_docstring
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
@auto_docstring(checkpoint="ecloudtech/erk")
|
| 23 |
+
@strict
|
| 24 |
+
class ErkConfig(PreTrainedConfig):
|
| 25 |
+
r"""
|
| 26 |
+
```python
|
| 27 |
+
>>> from transformers import ErkModel, ErkConfig
|
| 28 |
+
|
| 29 |
+
>>> # Initializing a Erk style configuration
|
| 30 |
+
>>> configuration = ErkConfig()
|
| 31 |
+
|
| 32 |
+
>>> # Initializing a model from the Erk-8B style configuration
|
| 33 |
+
>>> model = ErkModel(configuration)
|
| 34 |
+
|
| 35 |
+
>>> # Accessing the model configuration
|
| 36 |
+
>>> configuration = model.config
|
| 37 |
+
```
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
model_type = "erk"
|
| 41 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 42 |
+
|
| 43 |
+
# Default tensor parallel plan for base model `Erk`
|
| 44 |
+
base_model_tp_plan = {
|
| 45 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 46 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 47 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 48 |
+
"layers.*.self_attn.q_norm": "replicated_with_grad_allreduce",
|
| 49 |
+
"layers.*.self_attn.k_norm": "replicated_with_grad_allreduce",
|
| 50 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 51 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 52 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 53 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 54 |
+
}
|
| 55 |
+
base_model_pp_plan = {
|
| 56 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
| 57 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
| 58 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
vocab_size: int = 151936
|
| 62 |
+
hidden_size: int = 4096
|
| 63 |
+
intermediate_size: int = 22016
|
| 64 |
+
num_hidden_layers: int = 32
|
| 65 |
+
num_attention_heads: int = 32
|
| 66 |
+
num_key_value_heads: int | None = 32
|
| 67 |
+
head_dim: int = 128
|
| 68 |
+
hidden_act: str = "silu"
|
| 69 |
+
max_position_embeddings: int = 32768
|
| 70 |
+
initializer_range: float = 0.02
|
| 71 |
+
rms_norm_eps: float = 1e-6
|
| 72 |
+
use_cache: bool = True
|
| 73 |
+
tie_word_embeddings: bool = False
|
| 74 |
+
rope_parameters: RopeParameters | dict | None = None
|
| 75 |
+
attention_bias: bool = False
|
| 76 |
+
use_sliding_window: bool = False
|
| 77 |
+
sliding_window: int | None = 4096
|
| 78 |
+
max_window_layers: int = 28
|
| 79 |
+
layer_types: list[str] | None = None
|
| 80 |
+
attention_dropout: float | int = 0.0
|
| 81 |
+
pad_token_id: int | None = None
|
| 82 |
+
bos_token_id: int | None = None
|
| 83 |
+
eos_token_id: int | list[int] | None = None
|
| 84 |
+
|
| 85 |
+
def __post_init__(self, **kwargs):
|
| 86 |
+
self.sliding_window = self.sliding_window if self.use_sliding_window else None
|
| 87 |
+
if self.num_key_value_heads is None:
|
| 88 |
+
self.num_key_value_heads = self.num_attention_heads
|
| 89 |
+
|
| 90 |
+
if self.layer_types is None:
|
| 91 |
+
self.layer_types = [
|
| 92 |
+
"sliding_attention"
|
| 93 |
+
if self.sliding_window is not None and i >= self.max_window_layers
|
| 94 |
+
else "full_attention"
|
| 95 |
+
for i in range(self.num_hidden_layers)
|
| 96 |
+
]
|
| 97 |
+
super().__post_init__(**kwargs)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
__all__ = ["ErkConfig"]
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"temperature": 0.6,
|
| 10 |
+
"top_k": 20,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.13.0"
|
| 13 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e364e4991c005120c968474056cd26adbc1321c9eeed541af142c2ad37b651e5
|
| 3 |
+
size 49824537208
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d98978bb08e72217fb8fbc654c74e15f07574a0aeeb7eccd7792a0b8d873de35
|
| 3 |
+
size 9248743064
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_parameters": 14768307200,
|
| 4 |
+
"total_size": 59073228800
|
| 5 |
+
},
|
| 6 |
+
"weight_map": {
|
| 7 |
+
"lm_head.weight": "model-00001-of-00002.safetensors",
|
| 8 |
+
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
| 9 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 10 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 11 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 12 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 13 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 14 |
+
"model.layers.0.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 15 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 16 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 17 |
+
"model.layers.0.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 18 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 19 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 20 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 21 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 22 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 23 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 24 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 25 |
+
"model.layers.1.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 26 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 27 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 28 |
+
"model.layers.1.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 29 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 30 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 31 |
+
"model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 32 |
+
"model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 33 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 34 |
+
"model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 35 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 36 |
+
"model.layers.10.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 37 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 38 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 39 |
+
"model.layers.10.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 40 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 41 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 42 |
+
"model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 43 |
+
"model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 44 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 45 |
+
"model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 46 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 47 |
+
"model.layers.11.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 48 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 49 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 50 |
+
"model.layers.11.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 51 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 52 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 53 |
+
"model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 54 |
+
"model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 55 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 56 |
+
"model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 57 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 58 |
+
"model.layers.12.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 59 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 60 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 61 |
+
"model.layers.12.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 62 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 63 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 64 |
+
"model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 65 |
+
"model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 66 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 67 |
+
"model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 68 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 69 |
+
"model.layers.13.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 70 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 71 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 72 |
+
"model.layers.13.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 73 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 74 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 75 |
+
"model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 76 |
+
"model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 77 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 78 |
+
"model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 79 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 80 |
+
"model.layers.14.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 81 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 82 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 83 |
+
"model.layers.14.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 84 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 85 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 86 |
+
"model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 87 |
+
"model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 88 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 89 |
+
"model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 90 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 91 |
+
"model.layers.15.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 92 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 93 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 94 |
+
"model.layers.15.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 95 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 96 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 97 |
+
"model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 98 |
+
"model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 99 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 100 |
+
"model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 101 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 102 |
+
"model.layers.16.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 103 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 104 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 105 |
+
"model.layers.16.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 106 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 107 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 108 |
+
"model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 109 |
+
"model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 110 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 111 |
+
"model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 112 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 113 |
+
"model.layers.17.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 114 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 115 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 116 |
+
"model.layers.17.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 117 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 118 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 119 |
+
"model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 120 |
+
"model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 121 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 122 |
+
"model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 123 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 124 |
+
"model.layers.18.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 125 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 126 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 127 |
+
"model.layers.18.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 128 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 129 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 130 |
+
"model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 131 |
+
"model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 132 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 133 |
+
"model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 134 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 135 |
+
"model.layers.19.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 136 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 137 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 138 |
+
"model.layers.19.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 139 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 140 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 141 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 142 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 143 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 144 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 145 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 146 |
+
"model.layers.2.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 147 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 148 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 149 |
+
"model.layers.2.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 150 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 151 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 152 |
+
"model.layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 153 |
+
"model.layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 154 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 155 |
+
"model.layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 156 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 157 |
+
"model.layers.20.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 158 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 159 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 160 |
+
"model.layers.20.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 161 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 162 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 163 |
+
"model.layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 164 |
+
"model.layers.21.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 165 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 166 |
+
"model.layers.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 167 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 168 |
+
"model.layers.21.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 169 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 170 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 171 |
+
"model.layers.21.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 172 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 173 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 174 |
+
"model.layers.22.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 175 |
+
"model.layers.22.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 176 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 177 |
+
"model.layers.22.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 178 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 179 |
+
"model.layers.22.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 180 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 181 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 182 |
+
"model.layers.22.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 183 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 184 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 185 |
+
"model.layers.23.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 186 |
+
"model.layers.23.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 187 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 188 |
+
"model.layers.23.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 189 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 190 |
+
"model.layers.23.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 191 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 192 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 193 |
+
"model.layers.23.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 194 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 195 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 196 |
+
"model.layers.24.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 197 |
+
"model.layers.24.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 198 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 199 |
+
"model.layers.24.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 200 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 201 |
+
"model.layers.24.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 202 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 203 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 204 |
+
"model.layers.24.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 205 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 206 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 207 |
+
"model.layers.25.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 208 |
+
"model.layers.25.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 209 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 210 |
+
"model.layers.25.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 211 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 212 |
+
"model.layers.25.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 213 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 214 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 215 |
+
"model.layers.25.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 216 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 217 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 218 |
+
"model.layers.26.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 219 |
+
"model.layers.26.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 220 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 221 |
+
"model.layers.26.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 222 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 223 |
+
"model.layers.26.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 224 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 225 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 226 |
+
"model.layers.26.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 227 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 228 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 229 |
+
"model.layers.27.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 230 |
+
"model.layers.27.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 231 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 232 |
+
"model.layers.27.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 233 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 234 |
+
"model.layers.27.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 235 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 236 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 237 |
+
"model.layers.27.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 238 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 239 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 240 |
+
"model.layers.28.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 241 |
+
"model.layers.28.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 242 |
+
"model.layers.28.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 243 |
+
"model.layers.28.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 244 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 245 |
+
"model.layers.28.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 246 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 247 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 248 |
+
"model.layers.28.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 249 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 250 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 251 |
+
"model.layers.29.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 252 |
+
"model.layers.29.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 253 |
+
"model.layers.29.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 254 |
+
"model.layers.29.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 255 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 256 |
+
"model.layers.29.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 257 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 258 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 259 |
+
"model.layers.29.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 260 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 261 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 262 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 263 |
+
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 264 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 265 |
+
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 266 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 267 |
+
"model.layers.3.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 268 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 269 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 270 |
+
"model.layers.3.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 271 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 272 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 273 |
+
"model.layers.30.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 274 |
+
"model.layers.30.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 275 |
+
"model.layers.30.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 276 |
+
"model.layers.30.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 277 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 278 |
+
"model.layers.30.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 279 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 280 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 281 |
+
"model.layers.30.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 282 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 283 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 284 |
+
"model.layers.31.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 285 |
+
"model.layers.31.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 286 |
+
"model.layers.31.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 287 |
+
"model.layers.31.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 288 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 289 |
+
"model.layers.31.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 290 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 291 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 292 |
+
"model.layers.31.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 293 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 294 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 295 |
+
"model.layers.32.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 296 |
+
"model.layers.32.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 297 |
+
"model.layers.32.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 298 |
+
"model.layers.32.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 299 |
+
"model.layers.32.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 300 |
+
"model.layers.32.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 301 |
+
"model.layers.32.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 302 |
+
"model.layers.32.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 303 |
+
"model.layers.32.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 304 |
+
"model.layers.32.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 305 |
+
"model.layers.32.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 306 |
+
"model.layers.33.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 307 |
+
"model.layers.33.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 308 |
+
"model.layers.33.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 309 |
+
"model.layers.33.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 310 |
+
"model.layers.33.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 311 |
+
"model.layers.33.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 312 |
+
"model.layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 313 |
+
"model.layers.33.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 314 |
+
"model.layers.33.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 315 |
+
"model.layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 316 |
+
"model.layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 317 |
+
"model.layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 318 |
+
"model.layers.34.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 319 |
+
"model.layers.34.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 320 |
+
"model.layers.34.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 321 |
+
"model.layers.34.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 322 |
+
"model.layers.34.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 323 |
+
"model.layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 324 |
+
"model.layers.34.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 325 |
+
"model.layers.34.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 326 |
+
"model.layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 327 |
+
"model.layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 328 |
+
"model.layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 329 |
+
"model.layers.35.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 330 |
+
"model.layers.35.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 331 |
+
"model.layers.35.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 332 |
+
"model.layers.35.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 333 |
+
"model.layers.35.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 334 |
+
"model.layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 335 |
+
"model.layers.35.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 336 |
+
"model.layers.35.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 337 |
+
"model.layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 338 |
+
"model.layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 339 |
+
"model.layers.36.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 340 |
+
"model.layers.36.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 341 |
+
"model.layers.36.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 342 |
+
"model.layers.36.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 343 |
+
"model.layers.36.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 344 |
+
"model.layers.36.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 345 |
+
"model.layers.36.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 346 |
+
"model.layers.36.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 347 |
+
"model.layers.36.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 348 |
+
"model.layers.36.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 349 |
+
"model.layers.36.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 350 |
+
"model.layers.37.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 351 |
+
"model.layers.37.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 352 |
+
"model.layers.37.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 353 |
+
"model.layers.37.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 354 |
+
"model.layers.37.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 355 |
+
"model.layers.37.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 356 |
+
"model.layers.37.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 357 |
+
"model.layers.37.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 358 |
+
"model.layers.37.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 359 |
+
"model.layers.37.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 360 |
+
"model.layers.37.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 361 |
+
"model.layers.38.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 362 |
+
"model.layers.38.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 363 |
+
"model.layers.38.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 364 |
+
"model.layers.38.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 365 |
+
"model.layers.38.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 366 |
+
"model.layers.38.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 367 |
+
"model.layers.38.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 368 |
+
"model.layers.38.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 369 |
+
"model.layers.38.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 370 |
+
"model.layers.38.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 371 |
+
"model.layers.38.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 372 |
+
"model.layers.39.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 373 |
+
"model.layers.39.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 374 |
+
"model.layers.39.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 375 |
+
"model.layers.39.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 376 |
+
"model.layers.39.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 377 |
+
"model.layers.39.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
|
| 378 |
+
"model.layers.39.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 379 |
+
"model.layers.39.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 380 |
+
"model.layers.39.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
|
| 381 |
+
"model.layers.39.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 382 |
+
"model.layers.39.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 383 |
+
"model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 384 |
+
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 385 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 386 |
+
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 387 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 388 |
+
"model.layers.4.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 389 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 390 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 391 |
+
"model.layers.4.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 392 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 393 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 394 |
+
"model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 395 |
+
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 396 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 397 |
+
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 398 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 399 |
+
"model.layers.5.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 400 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 401 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 402 |
+
"model.layers.5.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 403 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 404 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 405 |
+
"model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 406 |
+
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 407 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 408 |
+
"model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 409 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 410 |
+
"model.layers.6.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 411 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 412 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 413 |
+
"model.layers.6.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 414 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 415 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 416 |
+
"model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 417 |
+
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 418 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 419 |
+
"model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 420 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 421 |
+
"model.layers.7.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 422 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 423 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 424 |
+
"model.layers.7.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 425 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 426 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 427 |
+
"model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 428 |
+
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 429 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 430 |
+
"model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 431 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 432 |
+
"model.layers.8.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 433 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 434 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 435 |
+
"model.layers.8.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 436 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 437 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 438 |
+
"model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 439 |
+
"model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 440 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 441 |
+
"model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 442 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 443 |
+
"model.layers.9.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
|
| 444 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 445 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 446 |
+
"model.layers.9.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
|
| 447 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 448 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 449 |
+
"model.norm.weight": "model-00002-of-00002.safetensors"
|
| 450 |
+
}
|
| 451 |
+
}
|
modeling_erk.py
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 2 |
+
# This file was automatically generated from src/transformers/models/erk/modular_erk.py.
|
| 3 |
+
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
| 4 |
+
# the file from the modular. If any change should be done, please apply the change to the
|
| 5 |
+
# modular_erk.py file directly. One of our CI enforces this.
|
| 6 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 7 |
+
# Copyright 2026 eCloud Yazılım Teknolojileri. Based on Apache-2.0 licensed transformer architecture.
|
| 8 |
+
#
|
| 9 |
+
# you may not use this file except in compliance with the License.
|
| 10 |
+
# You may obtain a copy of the License at
|
| 11 |
+
#
|
| 12 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 13 |
+
#
|
| 14 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 15 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 16 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 17 |
+
# See the License for the specific language governing permissions and
|
| 18 |
+
# limitations under the License.
|
| 19 |
+
|
| 20 |
+
from collections.abc import Callable
|
| 21 |
+
from typing import Optional
|
| 22 |
+
|
| 23 |
+
import torch
|
| 24 |
+
from torch import nn
|
| 25 |
+
|
| 26 |
+
from transformers.activations import ACT2FN
|
| 27 |
+
from transformers.cache_utils import Cache, DynamicCache
|
| 28 |
+
from transformers.generation import GenerationMixin
|
| 29 |
+
from transformers.integrations import use_kernel_forward_from_hub, use_kernel_func_from_hub, use_kernelized_func
|
| 30 |
+
from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
|
| 31 |
+
from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
|
| 32 |
+
from transformers.modeling_layers import (
|
| 33 |
+
GenericForQuestionAnswering,
|
| 34 |
+
GenericForSequenceClassification,
|
| 35 |
+
GenericForTokenClassification,
|
| 36 |
+
GradientCheckpointingLayer,
|
| 37 |
+
)
|
| 38 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
|
| 39 |
+
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 40 |
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 41 |
+
from transformers.processing_utils import Unpack
|
| 42 |
+
from transformers.utils import TransformersKwargs, auto_docstring, can_return_tuple
|
| 43 |
+
from transformers.utils.generic import maybe_autocast, merge_with_config_defaults
|
| 44 |
+
from transformers.utils.output_capturing import capture_outputs
|
| 45 |
+
from .configuration_erk import ErkConfig
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@use_kernel_forward_from_hub("RMSNorm")
|
| 49 |
+
class ErkRMSNorm(nn.Module):
|
| 50 |
+
def __init__(self, hidden_size, eps: float = 1e-6) -> None:
|
| 51 |
+
"""
|
| 52 |
+
ErkRMSNorm is equivalent to T5LayerNorm
|
| 53 |
+
"""
|
| 54 |
+
super().__init__()
|
| 55 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 56 |
+
self.variance_epsilon = eps
|
| 57 |
+
|
| 58 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 59 |
+
input_dtype = hidden_states.dtype
|
| 60 |
+
hidden_states = hidden_states.to(torch.float32)
|
| 61 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
| 62 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
| 63 |
+
return self.weight * hidden_states.to(input_dtype)
|
| 64 |
+
|
| 65 |
+
def extra_repr(self):
|
| 66 |
+
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class ErkMLP(nn.Module):
|
| 70 |
+
def __init__(self, config):
|
| 71 |
+
super().__init__()
|
| 72 |
+
self.config = config
|
| 73 |
+
self.hidden_size = config.hidden_size
|
| 74 |
+
self.intermediate_size = config.intermediate_size
|
| 75 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 76 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 77 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 78 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 79 |
+
|
| 80 |
+
def forward(self, x):
|
| 81 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
| 82 |
+
return down_proj
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class ErkRotaryEmbedding(nn.Module):
|
| 86 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 87 |
+
|
| 88 |
+
def __init__(self, config: ErkConfig, device=None):
|
| 89 |
+
super().__init__()
|
| 90 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 91 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 92 |
+
|
| 93 |
+
self.config = config
|
| 94 |
+
|
| 95 |
+
self.rope_type = self.config.rope_parameters["rope_type"]
|
| 96 |
+
rope_init_fn: Callable = self.compute_default_rope_parameters
|
| 97 |
+
if self.rope_type != "default":
|
| 98 |
+
rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
|
| 99 |
+
inv_freq, self.attention_scaling = rope_init_fn(self.config, device)
|
| 100 |
+
|
| 101 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 102 |
+
self.register_buffer("original_inv_freq", inv_freq.clone(), persistent=False)
|
| 103 |
+
|
| 104 |
+
@staticmethod
|
| 105 |
+
def compute_default_rope_parameters(
|
| 106 |
+
config: ErkConfig | None = None,
|
| 107 |
+
device: Optional["torch.device"] = None,
|
| 108 |
+
seq_len: int | None = None,
|
| 109 |
+
) -> tuple["torch.Tensor", float]:
|
| 110 |
+
"""
|
| 111 |
+
Computes the inverse frequencies according to the original RoPE implementation
|
| 112 |
+
Args:
|
| 113 |
+
config ([`~transformers.PreTrainedConfig`]):
|
| 114 |
+
The model configuration.
|
| 115 |
+
device (`torch.device`):
|
| 116 |
+
The device to use for initialization of the inverse frequencies.
|
| 117 |
+
seq_len (`int`, *optional*):
|
| 118 |
+
The current sequence length. Unused for this type of RoPE.
|
| 119 |
+
Returns:
|
| 120 |
+
Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
|
| 121 |
+
post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
|
| 122 |
+
"""
|
| 123 |
+
base = config.rope_parameters["rope_theta"]
|
| 124 |
+
dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
|
| 125 |
+
|
| 126 |
+
attention_factor = 1.0 # Unused in this type of RoPE
|
| 127 |
+
|
| 128 |
+
# Compute the inverse frequencies
|
| 129 |
+
inv_freq = 1.0 / (
|
| 130 |
+
base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
|
| 131 |
+
)
|
| 132 |
+
return inv_freq, attention_factor
|
| 133 |
+
|
| 134 |
+
@torch.no_grad()
|
| 135 |
+
@dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
|
| 136 |
+
def forward(self, x, position_ids):
|
| 137 |
+
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
|
| 138 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
| 139 |
+
|
| 140 |
+
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
| 141 |
+
with maybe_autocast(device_type=device_type, enabled=False): # Force float32
|
| 142 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
| 143 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 144 |
+
cos = emb.cos() * self.attention_scaling
|
| 145 |
+
sin = emb.sin() * self.attention_scaling
|
| 146 |
+
|
| 147 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def rotate_half(x):
|
| 151 |
+
"""Rotates half the hidden dims of the input."""
|
| 152 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 153 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 154 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@use_kernel_func_from_hub("rotary_pos_emb")
|
| 158 |
+
def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
|
| 159 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 160 |
+
|
| 161 |
+
Args:
|
| 162 |
+
q (`torch.Tensor`): The query tensor.
|
| 163 |
+
k (`torch.Tensor`): The key tensor.
|
| 164 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 165 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 166 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 167 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
| 168 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
| 169 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
| 170 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
| 171 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
| 172 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
| 173 |
+
Returns:
|
| 174 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 175 |
+
"""
|
| 176 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
| 177 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
| 178 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 179 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 180 |
+
return q_embed, k_embed
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 184 |
+
"""
|
| 185 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 186 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 187 |
+
"""
|
| 188 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 189 |
+
if n_rep == 1:
|
| 190 |
+
return hidden_states
|
| 191 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 192 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def eager_attention_forward(
|
| 196 |
+
module: nn.Module,
|
| 197 |
+
query: torch.Tensor,
|
| 198 |
+
key: torch.Tensor,
|
| 199 |
+
value: torch.Tensor,
|
| 200 |
+
attention_mask: torch.Tensor | None,
|
| 201 |
+
scaling: float,
|
| 202 |
+
dropout: float = 0.0,
|
| 203 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 204 |
+
):
|
| 205 |
+
key_states = repeat_kv(key, module.num_key_value_groups)
|
| 206 |
+
value_states = repeat_kv(value, module.num_key_value_groups)
|
| 207 |
+
|
| 208 |
+
attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
|
| 209 |
+
if attention_mask is not None:
|
| 210 |
+
attn_weights = attn_weights + attention_mask
|
| 211 |
+
|
| 212 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
|
| 213 |
+
attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
|
| 214 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 215 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 216 |
+
|
| 217 |
+
return attn_output, attn_weights
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
@use_kernelized_func(apply_rotary_pos_emb)
|
| 221 |
+
class ErkAttention(nn.Module):
|
| 222 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
| 223 |
+
|
| 224 |
+
def __init__(self, config: ErkConfig, layer_idx: int):
|
| 225 |
+
super().__init__()
|
| 226 |
+
self.layer_type = config.layer_types[layer_idx] if hasattr(config, "layer_types") else None
|
| 227 |
+
self.config = config
|
| 228 |
+
self.layer_idx = layer_idx
|
| 229 |
+
self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
|
| 230 |
+
self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
|
| 231 |
+
self.scaling = self.head_dim**-0.5
|
| 232 |
+
self.attention_dropout = config.attention_dropout
|
| 233 |
+
self.is_causal = True
|
| 234 |
+
|
| 235 |
+
self.q_proj = nn.Linear(
|
| 236 |
+
config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
|
| 237 |
+
)
|
| 238 |
+
self.k_proj = nn.Linear(
|
| 239 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 240 |
+
)
|
| 241 |
+
self.v_proj = nn.Linear(
|
| 242 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 243 |
+
)
|
| 244 |
+
self.o_proj = nn.Linear(
|
| 245 |
+
config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
|
| 246 |
+
)
|
| 247 |
+
self.q_norm = ErkRMSNorm(self.head_dim, eps=config.rms_norm_eps) # unlike olmo, only on the head dim!
|
| 248 |
+
self.k_norm = ErkRMSNorm(self.head_dim, eps=config.rms_norm_eps) # thus post q_norm does not need reshape
|
| 249 |
+
self.sliding_window = config.sliding_window if self.layer_type == "sliding_attention" else None
|
| 250 |
+
|
| 251 |
+
def forward(
|
| 252 |
+
self,
|
| 253 |
+
hidden_states: torch.Tensor,
|
| 254 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 255 |
+
attention_mask: torch.Tensor | None,
|
| 256 |
+
past_key_values: Cache | None = None,
|
| 257 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 258 |
+
) -> tuple[torch.Tensor, torch.Tensor | None]:
|
| 259 |
+
input_shape = hidden_states.shape[:-1]
|
| 260 |
+
hidden_shape = (*input_shape, -1, self.head_dim)
|
| 261 |
+
|
| 262 |
+
query_states = self.q_norm(self.q_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
|
| 263 |
+
key_states = self.k_norm(self.k_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
|
| 264 |
+
value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
|
| 265 |
+
|
| 266 |
+
cos, sin = position_embeddings
|
| 267 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 268 |
+
|
| 269 |
+
if past_key_values is not None:
|
| 270 |
+
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
|
| 271 |
+
|
| 272 |
+
attention_interface: Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
|
| 273 |
+
self.config._attn_implementation, eager_attention_forward
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
attn_output, attn_weights = attention_interface(
|
| 277 |
+
self,
|
| 278 |
+
query_states,
|
| 279 |
+
key_states,
|
| 280 |
+
value_states,
|
| 281 |
+
attention_mask,
|
| 282 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 283 |
+
scaling=self.scaling,
|
| 284 |
+
sliding_window=self.sliding_window, # diff with Llama
|
| 285 |
+
**kwargs,
|
| 286 |
+
)
|
| 287 |
+
|
| 288 |
+
attn_output = attn_output.reshape(*input_shape, -1).contiguous()
|
| 289 |
+
attn_output = self.o_proj(attn_output)
|
| 290 |
+
return attn_output, attn_weights
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
class ErkDecoderLayer(GradientCheckpointingLayer):
|
| 294 |
+
def __init__(self, config: ErkConfig, layer_idx: int):
|
| 295 |
+
super().__init__()
|
| 296 |
+
self.hidden_size = config.hidden_size
|
| 297 |
+
|
| 298 |
+
self.self_attn = ErkAttention(config=config, layer_idx=layer_idx)
|
| 299 |
+
|
| 300 |
+
self.mlp = ErkMLP(config)
|
| 301 |
+
self.input_layernorm = ErkRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 302 |
+
self.post_attention_layernorm = ErkRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 303 |
+
|
| 304 |
+
def forward(
|
| 305 |
+
self,
|
| 306 |
+
hidden_states: torch.Tensor,
|
| 307 |
+
attention_mask: torch.Tensor | None = None,
|
| 308 |
+
position_ids: torch.LongTensor | None = None,
|
| 309 |
+
past_key_values: Cache | None = None,
|
| 310 |
+
use_cache: bool | None = False,
|
| 311 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 312 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 313 |
+
) -> torch.Tensor:
|
| 314 |
+
residual = hidden_states
|
| 315 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 316 |
+
# Self Attention
|
| 317 |
+
hidden_states, _ = self.self_attn(
|
| 318 |
+
hidden_states=hidden_states,
|
| 319 |
+
attention_mask=attention_mask,
|
| 320 |
+
position_ids=position_ids,
|
| 321 |
+
past_key_values=past_key_values,
|
| 322 |
+
use_cache=use_cache,
|
| 323 |
+
position_embeddings=position_embeddings,
|
| 324 |
+
**kwargs,
|
| 325 |
+
)
|
| 326 |
+
hidden_states = residual + hidden_states
|
| 327 |
+
|
| 328 |
+
# Fully Connected
|
| 329 |
+
residual = hidden_states
|
| 330 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 331 |
+
hidden_states = self.mlp(hidden_states)
|
| 332 |
+
hidden_states = residual + hidden_states
|
| 333 |
+
return hidden_states
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
@auto_docstring
|
| 337 |
+
class ErkPreTrainedModel(PreTrainedModel):
|
| 338 |
+
config: ErkConfig
|
| 339 |
+
base_model_prefix = "model"
|
| 340 |
+
supports_gradient_checkpointing = True
|
| 341 |
+
_no_split_modules = ["ErkDecoderLayer"]
|
| 342 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 343 |
+
_supports_flash_attn = True
|
| 344 |
+
_supports_sdpa = True
|
| 345 |
+
_supports_flex_attn = True
|
| 346 |
+
|
| 347 |
+
_can_compile_fullgraph = True
|
| 348 |
+
_supports_attention_backend = True
|
| 349 |
+
_can_record_outputs = {
|
| 350 |
+
"hidden_states": ErkDecoderLayer,
|
| 351 |
+
"attentions": ErkAttention,
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
@auto_docstring
|
| 356 |
+
class ErkModel(ErkPreTrainedModel):
|
| 357 |
+
def __init__(self, config: ErkConfig):
|
| 358 |
+
super().__init__(config)
|
| 359 |
+
self.padding_idx = config.pad_token_id
|
| 360 |
+
self.vocab_size = config.vocab_size
|
| 361 |
+
|
| 362 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 363 |
+
self.layers = nn.ModuleList(
|
| 364 |
+
[ErkDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 365 |
+
)
|
| 366 |
+
self.norm = ErkRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 367 |
+
self.rotary_emb = ErkRotaryEmbedding(config=config)
|
| 368 |
+
self.gradient_checkpointing = False
|
| 369 |
+
self.has_sliding_layers = "sliding_attention" in self.config.layer_types
|
| 370 |
+
|
| 371 |
+
# Initialize weights and apply final processing
|
| 372 |
+
self.post_init()
|
| 373 |
+
|
| 374 |
+
@merge_with_config_defaults
|
| 375 |
+
@capture_outputs
|
| 376 |
+
@auto_docstring
|
| 377 |
+
def forward(
|
| 378 |
+
self,
|
| 379 |
+
input_ids: torch.LongTensor | None = None,
|
| 380 |
+
attention_mask: torch.Tensor | None = None,
|
| 381 |
+
position_ids: torch.LongTensor | None = None,
|
| 382 |
+
past_key_values: Cache | None = None,
|
| 383 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 384 |
+
use_cache: bool | None = None,
|
| 385 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 386 |
+
) -> BaseModelOutputWithPast:
|
| 387 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 388 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 389 |
+
|
| 390 |
+
if inputs_embeds is None:
|
| 391 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 392 |
+
|
| 393 |
+
if use_cache and past_key_values is None:
|
| 394 |
+
past_key_values = DynamicCache(config=self.config)
|
| 395 |
+
|
| 396 |
+
if position_ids is None:
|
| 397 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 398 |
+
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
|
| 399 |
+
position_ids = position_ids.unsqueeze(0)
|
| 400 |
+
|
| 401 |
+
# It may already have been prepared by e.g. `generate`
|
| 402 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 403 |
+
# Prepare mask arguments
|
| 404 |
+
mask_kwargs = {
|
| 405 |
+
"config": self.config,
|
| 406 |
+
"inputs_embeds": inputs_embeds,
|
| 407 |
+
"attention_mask": attention_mask,
|
| 408 |
+
"past_key_values": past_key_values,
|
| 409 |
+
"position_ids": position_ids,
|
| 410 |
+
}
|
| 411 |
+
# Create the masks
|
| 412 |
+
causal_mask_mapping = {
|
| 413 |
+
"full_attention": create_causal_mask(**mask_kwargs),
|
| 414 |
+
}
|
| 415 |
+
# The sliding window alternating layers are not always activated depending on the config
|
| 416 |
+
if self.has_sliding_layers:
|
| 417 |
+
causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
|
| 418 |
+
|
| 419 |
+
hidden_states = inputs_embeds
|
| 420 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 421 |
+
|
| 422 |
+
for i, decoder_layer in enumerate(self.layers[: self.config.num_hidden_layers]):
|
| 423 |
+
hidden_states = decoder_layer(
|
| 424 |
+
hidden_states,
|
| 425 |
+
attention_mask=causal_mask_mapping[self.config.layer_types[i]],
|
| 426 |
+
position_embeddings=position_embeddings,
|
| 427 |
+
position_ids=position_ids,
|
| 428 |
+
past_key_values=past_key_values,
|
| 429 |
+
use_cache=use_cache,
|
| 430 |
+
**kwargs,
|
| 431 |
+
)
|
| 432 |
+
|
| 433 |
+
hidden_states = self.norm(hidden_states)
|
| 434 |
+
return BaseModelOutputWithPast(
|
| 435 |
+
last_hidden_state=hidden_states,
|
| 436 |
+
past_key_values=past_key_values if use_cache else None,
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
@auto_docstring
|
| 441 |
+
class ErkForCausalLM(ErkPreTrainedModel, GenerationMixin):
|
| 442 |
+
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
|
| 443 |
+
_tp_plan = {"lm_head": "colwise_gather_output"}
|
| 444 |
+
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
|
| 445 |
+
|
| 446 |
+
def __init__(self, config):
|
| 447 |
+
super().__init__(config)
|
| 448 |
+
self.model = ErkModel(config)
|
| 449 |
+
self.vocab_size = config.vocab_size
|
| 450 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 451 |
+
|
| 452 |
+
# Initialize weights and apply final processing
|
| 453 |
+
self.post_init()
|
| 454 |
+
|
| 455 |
+
@can_return_tuple
|
| 456 |
+
@auto_docstring
|
| 457 |
+
def forward(
|
| 458 |
+
self,
|
| 459 |
+
input_ids: torch.LongTensor | None = None,
|
| 460 |
+
attention_mask: torch.Tensor | None = None,
|
| 461 |
+
position_ids: torch.LongTensor | None = None,
|
| 462 |
+
past_key_values: Cache | None = None,
|
| 463 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 464 |
+
labels: torch.LongTensor | None = None,
|
| 465 |
+
use_cache: bool | None = None,
|
| 466 |
+
logits_to_keep: int | torch.Tensor = 0,
|
| 467 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 468 |
+
) -> CausalLMOutputWithPast:
|
| 469 |
+
r"""
|
| 470 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 471 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 472 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 473 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 474 |
+
|
| 475 |
+
Example:
|
| 476 |
+
|
| 477 |
+
```python
|
| 478 |
+
>>> from transformers import AutoTokenizer, ErkForCausalLM
|
| 479 |
+
|
| 480 |
+
>>> model = ErkForCausalLM.from_pretrained("ecloudtech/erk")
|
| 481 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("ecloudtech/erk")
|
| 482 |
+
|
| 483 |
+
>>> prompt = "Hey, are you conscious? Can you talk to me?"
|
| 484 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
| 485 |
+
|
| 486 |
+
>>> # Generate
|
| 487 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
| 488 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 489 |
+
"Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
|
| 490 |
+
```"""
|
| 491 |
+
outputs: BaseModelOutputWithPast = self.model(
|
| 492 |
+
input_ids=input_ids,
|
| 493 |
+
attention_mask=attention_mask,
|
| 494 |
+
position_ids=position_ids,
|
| 495 |
+
past_key_values=past_key_values,
|
| 496 |
+
inputs_embeds=inputs_embeds,
|
| 497 |
+
use_cache=use_cache,
|
| 498 |
+
**kwargs,
|
| 499 |
+
)
|
| 500 |
+
|
| 501 |
+
hidden_states = outputs.last_hidden_state
|
| 502 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 503 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 504 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 505 |
+
|
| 506 |
+
loss = None
|
| 507 |
+
if labels is not None:
|
| 508 |
+
loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
|
| 509 |
+
|
| 510 |
+
return CausalLMOutputWithPast(
|
| 511 |
+
loss=loss,
|
| 512 |
+
logits=logits,
|
| 513 |
+
past_key_values=outputs.past_key_values,
|
| 514 |
+
hidden_states=outputs.hidden_states,
|
| 515 |
+
attentions=outputs.attentions,
|
| 516 |
+
)
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
class ErkForSequenceClassification(GenericForSequenceClassification, ErkPreTrainedModel):
|
| 520 |
+
pass
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
class ErkForTokenClassification(GenericForTokenClassification, ErkPreTrainedModel):
|
| 524 |
+
pass
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
class ErkForQuestionAnswering(GenericForQuestionAnswering, ErkPreTrainedModel):
|
| 528 |
+
base_model_prefix = "transformer" # For BC, where `transformer` was used instead of `model`
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
__all__ = [
|
| 532 |
+
"ErkForCausalLM",
|
| 533 |
+
"ErkForQuestionAnswering",
|
| 534 |
+
"ErkPreTrainedModel",
|
| 535 |
+
"ErkModel",
|
| 536 |
+
"ErkForSequenceClassification",
|
| 537 |
+
"ErkForTokenClassification",
|
| 538 |
+
]
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
|
| 3 |
+
size 11422654
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151665": {
|
| 182 |
+
"content": "<tool_response>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": false
|
| 188 |
+
},
|
| 189 |
+
"151666": {
|
| 190 |
+
"content": "</tool_response>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": false
|
| 196 |
+
},
|
| 197 |
+
"151667": {
|
| 198 |
+
"content": "<think>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": false
|
| 204 |
+
},
|
| 205 |
+
"151668": {
|
| 206 |
+
"content": "</think>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": false
|
| 212 |
+
}
|
| 213 |
+
},
|
| 214 |
+
"additional_special_tokens": [
|
| 215 |
+
"<|im_start|>",
|
| 216 |
+
"<|im_end|>",
|
| 217 |
+
"<|object_ref_start|>",
|
| 218 |
+
"<|object_ref_end|>",
|
| 219 |
+
"<|box_start|>",
|
| 220 |
+
"<|box_end|>",
|
| 221 |
+
"<|quad_start|>",
|
| 222 |
+
"<|quad_end|>",
|
| 223 |
+
"<|vision_start|>",
|
| 224 |
+
"<|vision_end|>",
|
| 225 |
+
"<|vision_pad|>",
|
| 226 |
+
"<|image_pad|>",
|
| 227 |
+
"<|video_pad|>"
|
| 228 |
+
],
|
| 229 |
+
"bos_token": null,
|
| 230 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
|
| 231 |
+
"clean_up_tokenization_spaces": false,
|
| 232 |
+
"eos_token": "<|im_end|>",
|
| 233 |
+
"errors": "replace",
|
| 234 |
+
"model_max_length": 131072,
|
| 235 |
+
"pad_token": "<|endoftext|>",
|
| 236 |
+
"split_special_tokens": false,
|
| 237 |
+
"unk_token": null
|
| 238 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|