FremyCompany
commited on
Commit
•
ec56309
1
Parent(s):
2d010c3
Initial upload of the model
Browse files- .gitignore +1 -0
- README.md +117 -0
- config.json +39 -0
- generation_config.json +7 -0
- model-00001-of-00006.safetensors +3 -0
- model-00002-of-00006.safetensors +3 -0
- model-00003-of-00006.safetensors +3 -0
- model-00004-of-00006.safetensors +3 -0
- model-00005-of-00006.safetensors +3 -0
- model-00006-of-00006.safetensors +3 -0
- model.safetensors.index.json +298 -0
- modeling_llama_hydra.py +227 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +41 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.ipynb_checkpoints
|
README.md
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: Unbabel/TowerInstruct-7B-v0.1
|
3 |
+
license: cc-by-nc-4.0
|
4 |
+
language:
|
5 |
+
- tt
|
6 |
+
- en
|
7 |
+
- de
|
8 |
+
- fr
|
9 |
+
- zh
|
10 |
+
- pt
|
11 |
+
- nl
|
12 |
+
- ru
|
13 |
+
- ko
|
14 |
+
- it
|
15 |
+
- es
|
16 |
+
tags:
|
17 |
+
- tweety
|
18 |
+
datasets:
|
19 |
+
- oscar-corpus/OSCAR-2301
|
20 |
+
---
|
21 |
+
|
22 |
+
<img align="right" src="https://huggingface.co/Tweeties/tweety-tatar-base-7b-2024-v1/resolve/main/TweetyTatar.png?download=true" alt="Tweety-Tatar-7B: A Tatar Large Language Model" width="20%">
|
23 |
+
|
24 |
+
# Tweety Tatar / Hydra-MT 7b / 2024-v1
|
25 |
+
|
26 |
+
## Model description
|
27 |
+
This model is our Hydra LLM for the [Tatar language](https://en.wikipedia.org/wiki/Tatar_language), converted from the [TowerInstruct-7b-v0.1](https://huggingface.co/Unbabel/TowerInstruct-7B-v0.1) model trained by Unbabel, via [our Hydra-Base model](https://huggingface.co/Tweeties/tweety-tatar-hydra-base-7b-2024-v1).
|
28 |
+
Hydra LLMs are trans-tokenized language models finetuned to produce output in a particular language, while accepting input encoded using either their own tokenizer, the one of their base model, or a mix of both.
|
29 |
+
This enables them to receive code-switched input in both their native language and other languages, which is an ideal setup for translation tasks, or retrieval-augmented generation (RAG) in cross-lingual scenarios (see [our Hydra-Base model](https://huggingface.co/Tweeties/tweety-tatar-hydra-base-7b-2024-v1)).
|
30 |
+
|
31 |
+
- **Developed by:** [François Remy](https://huggingface.co/FremyCompany) (UGent), [Alfiya Khabibullina](https://huggingface.co/justalphie) (BeCode), [et al.](#citation)
|
32 |
+
- **Funded by:** IDLab / GPULab
|
33 |
+
- **Model type:** Foundation model using the mistral architecture
|
34 |
+
- **Language(s) (NLP):** Tatar
|
35 |
+
- **License:** Creative Commons Attribution Non Commercial 4.0
|
36 |
+
|
37 |
+
## In-scope usage
|
38 |
+
This model can be used as-is or finetuned into a machine translation system from one of the 10 languages supported by TowerInstruct into the Tatar language.
|
39 |
+
This list of languages nobably includes English and Russian.
|
40 |
+
The model performs best when translating sentences or small paragraphs, and is not suited for document translation tasks.
|
41 |
+
This model should not be used in the reverse direction, to translate Tatar into English.
|
42 |
+
While the system is finetuned for translation, enabling beam search provides better results.
|
43 |
+
Take note of the non-commercial license imposed by Unbabel on the base model, which also applies to this model.
|
44 |
+
|
45 |
+
## Usage instructions
|
46 |
+
Using this model usually requires building the prompts by mixing tokens from two tokenizers, the original TowerInstruct tokenizer for input in the source language, and the new Tatar tokenizer for the prompt and output, as described in the examples below:
|
47 |
+
|
48 |
+
```py
|
49 |
+
import re
|
50 |
+
import torch
|
51 |
+
import torch.nn as nn
|
52 |
+
import transformers
|
53 |
+
|
54 |
+
MODEL_NAME = "Tweeties/tweety-tatar-hydra-mt-7b-2024-v1"
|
55 |
+
MAIN_TOKENIZER_NAME = "Tweeties/tweety-tatar-hydra-mt-7b-2024-v1"
|
56 |
+
UTIL_TOKENIZER_NAME = "Unbabel/TowerInstruct-7B-v0.1"
|
57 |
+
|
58 |
+
model = transformers.AutoModelForCausalLM.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
59 |
+
main_tokenizer = transformers.LlamaTokenizerFast.from_pretrained(MAIN_TOKENIZER_NAME)
|
60 |
+
util_tokenizer = transformers.LlamaTokenizerFast.from_pretrained(UTIL_TOKENIZER_NAME)
|
61 |
+
|
62 |
+
main_tokenizer_len = len(main_tokenizer)
|
63 |
+
```
|
64 |
+
|
65 |
+
### Machine Translation
|
66 |
+
|
67 |
+
```py
|
68 |
+
def translate_english_text(english_text: str) -> str:
|
69 |
+
|
70 |
+
# craft the input
|
71 |
+
input_ids = torch.concat([
|
72 |
+
main_tokenizer.encode(f"Түбәндәге текстны инглиз теленнән татар теленә тәрҗемә итегез:\n", return_tensors='pt'),
|
73 |
+
util_tokenizer.encode(f"{english_text}", add_special_tokens=False, return_tensors='pt') + torch.tensor([main_tokenizer_len]),
|
74 |
+
main_tokenizer.encode(f"\nТекстны татар теленә тәрҗемә итү:\n", add_special_tokens=False, return_tensors='pt')
|
75 |
+
], axis=1)
|
76 |
+
|
77 |
+
# prevent the model from repeating the prompt
|
78 |
+
prompt_starts = [
|
79 |
+
main_tokenizer.encode("Түбәндәге"),
|
80 |
+
main_tokenizer.encode("\nТүбәндәге")[2:],
|
81 |
+
main_tokenizer.encode("Текстны"),
|
82 |
+
main_tokenizer.encode("\nТекстны")[2:]
|
83 |
+
]
|
84 |
+
|
85 |
+
# genereate the output
|
86 |
+
model_inputs = {'input_ids':input_ids.to(model.device)}
|
87 |
+
model_outputs = model.generate(
|
88 |
+
**model_inputs,
|
89 |
+
max_new_tokens=128,
|
90 |
+
num_beams=8,
|
91 |
+
no_repeat_ngram_size=6,
|
92 |
+
early_stopping=False,
|
93 |
+
pad_token_id=main_tokenizer.eos_token_id,
|
94 |
+
eos_token_id=main_tokenizer.convert_tokens_to_ids(['<0x0A>','</s>']),
|
95 |
+
bad_words_ids=prompt_starts
|
96 |
+
)
|
97 |
+
|
98 |
+
# decode the output
|
99 |
+
return (main_tokenizer.decode(model_outputs[0][input_ids.shape[1]:]))
|
100 |
+
|
101 |
+
translate_english_text("The city of Paris is very pretty.") # Париж шәһәре бик матур.
|
102 |
+
```
|
103 |
+
|
104 |
+
|
105 |
+
## Citation
|
106 |
+
|
107 |
+
If you use this model, please cite our work as:
|
108 |
+
|
109 |
+
```
|
110 |
+
@article{tweeties2024,
|
111 |
+
title = {Trans-Tokenization and Cross-lingual Vocabulary Transfers: Language Adaptation of LLMs for Low-Resource NLP},
|
112 |
+
author = {François Remy and Pieter Delobelle and Hayastan Avetisyan and Alfiya Khabibullina and Miryam de Lhoneux and Thomas Demeester},
|
113 |
+
url = {https://huggingface.co/Tweeties},
|
114 |
+
year = {2024},
|
115 |
+
note = {Under review at COLM 2024}
|
116 |
+
}
|
117 |
+
```
|
config.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "Tweeties/tweety-tatar-hydra-mt-7b-2024-v1",
|
3 |
+
"additional_special_tokens_ids": [],
|
4 |
+
"architectures": [
|
5 |
+
"LlamaHydraForCausalLM"
|
6 |
+
],
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "modeling_llama_hydra.LlamaHydraConfig",
|
9 |
+
"AutoModelForCausalLM": "modeling_llama_hydra.LlamaHydraForCausalLM"
|
10 |
+
},
|
11 |
+
"attention_bias": false,
|
12 |
+
"attention_dropout": 0.0,
|
13 |
+
"bos_token_id": 1,
|
14 |
+
"cls_token_id": null,
|
15 |
+
"eos_token_id": 2,
|
16 |
+
"hidden_act": "silu",
|
17 |
+
"hidden_size": 4096,
|
18 |
+
"initializer_range": 0.02,
|
19 |
+
"input_vocab_size": 64007,
|
20 |
+
"intermediate_size": 11008,
|
21 |
+
"mask_token_id": null,
|
22 |
+
"max_position_embeddings": 4096,
|
23 |
+
"model_type": "llama_hydra",
|
24 |
+
"num_attention_heads": 32,
|
25 |
+
"num_hidden_layers": 32,
|
26 |
+
"num_key_value_heads": 32,
|
27 |
+
"output_vocab_size": 32000,
|
28 |
+
"pretraining_tp": 1,
|
29 |
+
"rms_norm_eps": 1e-05,
|
30 |
+
"rope_scaling": null,
|
31 |
+
"rope_theta": 10000.0,
|
32 |
+
"tie_word_embeddings": false,
|
33 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
34 |
+
"torch_dtype": "float32",
|
35 |
+
"transformers_version": "4.37.1",
|
36 |
+
"unk_token_id": 0,
|
37 |
+
"use_cache": true,
|
38 |
+
"vocab_size": 32000
|
39 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"transformers_version": "4.37.1",
|
6 |
+
"use_cache": false
|
7 |
+
}
|
model-00001-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f47e01515e6c7cee6059de216df3993bda7e6048e01980c32edbd400264bf79b
|
3 |
+
size 4915975008
|
model-00002-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c657406da0aa52f3334204a1213f42e048f879ed5811329b5b80c87134fb59dc
|
3 |
+
size 4857206856
|
model-00003-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b5980631f0fdb0395722aaca5c54d31f17862572d11ba88d91a70276668592a
|
3 |
+
size 4857206896
|
model-00004-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e3d6436e3aa56ecfbda3c4121487efd7b44de04a1e3e663cf98ec89162f9fba
|
3 |
+
size 4857206896
|
model-00005-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3d4435ceb2a781926ffc860ffe4de17c11f1887bfd0a8dfe3209e0a6890fc284
|
3 |
+
size 4857206896
|
model-00006-of-00006.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ac7442490a4c080e88ce8271f079aa073041da803632020c9389422f0a0d995
|
3 |
+
size 3133296224
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 27478065152
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "model-00006-of-00006.safetensors",
|
7 |
+
"model.embed_tokens.weight": "model-00001-of-00006.safetensors",
|
8 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00006.safetensors",
|
9 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00006.safetensors",
|
10 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00006.safetensors",
|
11 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00006.safetensors",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
|
13 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00006.safetensors",
|
14 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00006.safetensors",
|
15 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00006.safetensors",
|
16 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00006.safetensors",
|
17 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00006.safetensors",
|
18 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00006.safetensors",
|
19 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00006.safetensors",
|
20 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00006.safetensors",
|
21 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
|
22 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00006.safetensors",
|
23 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00006.safetensors",
|
24 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00006.safetensors",
|
25 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00006.safetensors",
|
26 |
+
"model.layers.10.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
27 |
+
"model.layers.10.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
28 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
29 |
+
"model.layers.10.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
30 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
31 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
32 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
33 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
34 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
35 |
+
"model.layers.11.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
36 |
+
"model.layers.11.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
37 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
38 |
+
"model.layers.11.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
39 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
40 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
41 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
42 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
43 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
44 |
+
"model.layers.12.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
45 |
+
"model.layers.12.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
46 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
47 |
+
"model.layers.12.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
48 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
49 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
50 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
51 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
52 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
53 |
+
"model.layers.13.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
54 |
+
"model.layers.13.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
55 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
56 |
+
"model.layers.13.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
57 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
58 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
59 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
60 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
61 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
62 |
+
"model.layers.14.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
63 |
+
"model.layers.14.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
64 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
65 |
+
"model.layers.14.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
66 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
67 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
68 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
69 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
70 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
71 |
+
"model.layers.15.input_layernorm.weight": "model-00003-of-00006.safetensors",
|
72 |
+
"model.layers.15.mlp.down_proj.weight": "model-00003-of-00006.safetensors",
|
73 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
74 |
+
"model.layers.15.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
75 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
|
76 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
77 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
78 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
79 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
80 |
+
"model.layers.16.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
81 |
+
"model.layers.16.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
82 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00003-of-00006.safetensors",
|
83 |
+
"model.layers.16.mlp.up_proj.weight": "model-00003-of-00006.safetensors",
|
84 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
85 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00003-of-00006.safetensors",
|
86 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00003-of-00006.safetensors",
|
87 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00003-of-00006.safetensors",
|
88 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00003-of-00006.safetensors",
|
89 |
+
"model.layers.17.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
90 |
+
"model.layers.17.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
91 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
92 |
+
"model.layers.17.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
93 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
94 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
95 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
96 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
97 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
98 |
+
"model.layers.18.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
99 |
+
"model.layers.18.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
100 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
101 |
+
"model.layers.18.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
102 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
103 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
104 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
105 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
106 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
107 |
+
"model.layers.19.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
108 |
+
"model.layers.19.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
109 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
110 |
+
"model.layers.19.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
111 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
112 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
113 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
114 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
115 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
116 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00006.safetensors",
|
117 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00006.safetensors",
|
118 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00006.safetensors",
|
119 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00006.safetensors",
|
120 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
|
121 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00006.safetensors",
|
122 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00006.safetensors",
|
123 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00006.safetensors",
|
124 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00006.safetensors",
|
125 |
+
"model.layers.20.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
126 |
+
"model.layers.20.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
127 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
128 |
+
"model.layers.20.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
129 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
130 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
131 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
132 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
133 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
134 |
+
"model.layers.21.input_layernorm.weight": "model-00004-of-00006.safetensors",
|
135 |
+
"model.layers.21.mlp.down_proj.weight": "model-00004-of-00006.safetensors",
|
136 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
137 |
+
"model.layers.21.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
138 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
|
139 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
140 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
141 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
142 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
143 |
+
"model.layers.22.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
144 |
+
"model.layers.22.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
145 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00004-of-00006.safetensors",
|
146 |
+
"model.layers.22.mlp.up_proj.weight": "model-00004-of-00006.safetensors",
|
147 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
148 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00004-of-00006.safetensors",
|
149 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00004-of-00006.safetensors",
|
150 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00004-of-00006.safetensors",
|
151 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00004-of-00006.safetensors",
|
152 |
+
"model.layers.23.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
153 |
+
"model.layers.23.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
154 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
155 |
+
"model.layers.23.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
156 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
157 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
158 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
159 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
160 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
161 |
+
"model.layers.24.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
162 |
+
"model.layers.24.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
163 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
164 |
+
"model.layers.24.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
165 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
166 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
167 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
168 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
169 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
170 |
+
"model.layers.25.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
171 |
+
"model.layers.25.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
172 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
173 |
+
"model.layers.25.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
174 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
175 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
176 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
177 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
178 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
179 |
+
"model.layers.26.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
180 |
+
"model.layers.26.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
181 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
182 |
+
"model.layers.26.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
183 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
184 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
185 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
186 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
187 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
188 |
+
"model.layers.27.input_layernorm.weight": "model-00005-of-00006.safetensors",
|
189 |
+
"model.layers.27.mlp.down_proj.weight": "model-00005-of-00006.safetensors",
|
190 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
191 |
+
"model.layers.27.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
192 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
|
193 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
194 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
195 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
196 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
197 |
+
"model.layers.28.input_layernorm.weight": "model-00006-of-00006.safetensors",
|
198 |
+
"model.layers.28.mlp.down_proj.weight": "model-00006-of-00006.safetensors",
|
199 |
+
"model.layers.28.mlp.gate_proj.weight": "model-00005-of-00006.safetensors",
|
200 |
+
"model.layers.28.mlp.up_proj.weight": "model-00005-of-00006.safetensors",
|
201 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
|
202 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00005-of-00006.safetensors",
|
203 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00005-of-00006.safetensors",
|
204 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00005-of-00006.safetensors",
|
205 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00005-of-00006.safetensors",
|
206 |
+
"model.layers.29.input_layernorm.weight": "model-00006-of-00006.safetensors",
|
207 |
+
"model.layers.29.mlp.down_proj.weight": "model-00006-of-00006.safetensors",
|
208 |
+
"model.layers.29.mlp.gate_proj.weight": "model-00006-of-00006.safetensors",
|
209 |
+
"model.layers.29.mlp.up_proj.weight": "model-00006-of-00006.safetensors",
|
210 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
|
211 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00006-of-00006.safetensors",
|
212 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00006-of-00006.safetensors",
|
213 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00006-of-00006.safetensors",
|
214 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00006-of-00006.safetensors",
|
215 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00006.safetensors",
|
216 |
+
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00006.safetensors",
|
217 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00006.safetensors",
|
218 |
+
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00006.safetensors",
|
219 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
|
220 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00006.safetensors",
|
221 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00006.safetensors",
|
222 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00006.safetensors",
|
223 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00006.safetensors",
|
224 |
+
"model.layers.30.input_layernorm.weight": "model-00006-of-00006.safetensors",
|
225 |
+
"model.layers.30.mlp.down_proj.weight": "model-00006-of-00006.safetensors",
|
226 |
+
"model.layers.30.mlp.gate_proj.weight": "model-00006-of-00006.safetensors",
|
227 |
+
"model.layers.30.mlp.up_proj.weight": "model-00006-of-00006.safetensors",
|
228 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
|
229 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00006-of-00006.safetensors",
|
230 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00006-of-00006.safetensors",
|
231 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00006-of-00006.safetensors",
|
232 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00006-of-00006.safetensors",
|
233 |
+
"model.layers.31.input_layernorm.weight": "model-00006-of-00006.safetensors",
|
234 |
+
"model.layers.31.mlp.down_proj.weight": "model-00006-of-00006.safetensors",
|
235 |
+
"model.layers.31.mlp.gate_proj.weight": "model-00006-of-00006.safetensors",
|
236 |
+
"model.layers.31.mlp.up_proj.weight": "model-00006-of-00006.safetensors",
|
237 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
|
238 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00006-of-00006.safetensors",
|
239 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00006-of-00006.safetensors",
|
240 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00006-of-00006.safetensors",
|
241 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00006-of-00006.safetensors",
|
242 |
+
"model.layers.4.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
243 |
+
"model.layers.4.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
244 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00006.safetensors",
|
245 |
+
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00006.safetensors",
|
246 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
247 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00006.safetensors",
|
248 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00006.safetensors",
|
249 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00006.safetensors",
|
250 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00006.safetensors",
|
251 |
+
"model.layers.5.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
252 |
+
"model.layers.5.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
253 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
254 |
+
"model.layers.5.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
255 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
256 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
257 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
258 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
259 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
260 |
+
"model.layers.6.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
261 |
+
"model.layers.6.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
262 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
263 |
+
"model.layers.6.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
264 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
265 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
266 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
267 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
268 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
269 |
+
"model.layers.7.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
270 |
+
"model.layers.7.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
271 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
272 |
+
"model.layers.7.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
273 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
274 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
275 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
276 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
277 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
278 |
+
"model.layers.8.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
279 |
+
"model.layers.8.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
280 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
281 |
+
"model.layers.8.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
282 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
283 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
284 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
285 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
286 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
287 |
+
"model.layers.9.input_layernorm.weight": "model-00002-of-00006.safetensors",
|
288 |
+
"model.layers.9.mlp.down_proj.weight": "model-00002-of-00006.safetensors",
|
289 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00002-of-00006.safetensors",
|
290 |
+
"model.layers.9.mlp.up_proj.weight": "model-00002-of-00006.safetensors",
|
291 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
|
292 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00002-of-00006.safetensors",
|
293 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00002-of-00006.safetensors",
|
294 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00002-of-00006.safetensors",
|
295 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00002-of-00006.safetensors",
|
296 |
+
"model.norm.weight": "model-00006-of-00006.safetensors"
|
297 |
+
}
|
298 |
+
}
|
modeling_llama_hydra.py
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import math
|
2 |
+
import warnings
|
3 |
+
|
4 |
+
import torch
|
5 |
+
import torch.nn.functional as F
|
6 |
+
import torch.utils.checkpoint
|
7 |
+
from torch import nn
|
8 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
9 |
+
|
10 |
+
from typing import List, Optional, Tuple, Union
|
11 |
+
|
12 |
+
import transformers
|
13 |
+
from transformers import LlamaConfig
|
14 |
+
from transformers.cache_utils import Cache
|
15 |
+
from transformers.modeling_outputs import (
|
16 |
+
BaseModelOutputWithPast,
|
17 |
+
CausalLMOutputWithPast,
|
18 |
+
QuestionAnsweringModelOutput,
|
19 |
+
SequenceClassifierOutputWithPast,
|
20 |
+
)
|
21 |
+
|
22 |
+
class LlamaHydraConfig(LlamaConfig):
|
23 |
+
model_type = "llama_hydra"
|
24 |
+
|
25 |
+
def __init__(self, **kwargs):
|
26 |
+
if 'vocab_size' not in kwargs:
|
27 |
+
if 'output_vocab_size' in kwargs:
|
28 |
+
kwargs['vocab_size'] = kwargs['output_vocab_size']
|
29 |
+
else:
|
30 |
+
kwargs['vocab_size'] = 32000
|
31 |
+
self.input_vocab_size = kwargs['input_vocab_size'] if 'input_vocab_size' in kwargs else kwargs['vocab_size']
|
32 |
+
self.output_vocab_size = kwargs['output_vocab_size'] if 'output_vocab_size' in kwargs else kwargs['vocab_size']
|
33 |
+
super().__init__(**kwargs)
|
34 |
+
|
35 |
+
class LlamaHydraForCausalLM(transformers.LlamaPreTrainedModel):
|
36 |
+
config_class = LlamaHydraConfig
|
37 |
+
_tied_weights_keys = ["lm_head.weight"]
|
38 |
+
|
39 |
+
def __init__(self, config):
|
40 |
+
hydra_config = LlamaHydraConfig(**config.__dict__)
|
41 |
+
encoder_config = LlamaConfig(**config.__dict__)
|
42 |
+
encoder_config.vocab_size = hydra_config.input_vocab_size
|
43 |
+
super().__init__(hydra_config)
|
44 |
+
self.model = transformers.LlamaModel(encoder_config)
|
45 |
+
self.input_vocab_size = hydra_config.input_vocab_size
|
46 |
+
self.output_vocab_size = hydra_config.output_vocab_size
|
47 |
+
self.vocab_size = hydra_config.vocab_size
|
48 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
49 |
+
|
50 |
+
# Initialize weights and apply final processing
|
51 |
+
self.post_init()
|
52 |
+
|
53 |
+
def get_input_embeddings(self):
|
54 |
+
return self.model.embed_tokens
|
55 |
+
|
56 |
+
def set_input_embeddings(self, value):
|
57 |
+
self.model.embed_tokens = value
|
58 |
+
|
59 |
+
def get_output_embeddings(self):
|
60 |
+
return self.lm_head
|
61 |
+
|
62 |
+
def set_output_embeddings(self, new_embeddings):
|
63 |
+
self.lm_head = new_embeddings
|
64 |
+
|
65 |
+
def set_decoder(self, decoder):
|
66 |
+
self.model = decoder
|
67 |
+
|
68 |
+
def get_decoder(self):
|
69 |
+
return self.model
|
70 |
+
|
71 |
+
#@add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
|
72 |
+
#@replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
|
73 |
+
def forward(
|
74 |
+
self,
|
75 |
+
input_ids: torch.LongTensor = None,
|
76 |
+
attention_mask: Optional[torch.Tensor] = None,
|
77 |
+
position_ids: Optional[torch.LongTensor] = None,
|
78 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
79 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
80 |
+
labels: Optional[torch.LongTensor] = None,
|
81 |
+
use_cache: Optional[bool] = None,
|
82 |
+
output_attentions: Optional[bool] = None,
|
83 |
+
output_hidden_states: Optional[bool] = None,
|
84 |
+
return_dict: Optional[bool] = None,
|
85 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
86 |
+
r"""
|
87 |
+
Args:
|
88 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
89 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
90 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
91 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
92 |
+
|
93 |
+
Returns:
|
94 |
+
|
95 |
+
Example:
|
96 |
+
|
97 |
+
```python
|
98 |
+
>>> from transformers import AutoTokenizer, LlamaForCausalLM
|
99 |
+
|
100 |
+
>>> model = LlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
|
101 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf")
|
102 |
+
|
103 |
+
>>> prompt = "Hey, are you conscious? Can you talk to me?"
|
104 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
105 |
+
|
106 |
+
>>> # Generate
|
107 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
108 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
109 |
+
"Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
|
110 |
+
```"""
|
111 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
112 |
+
output_hidden_states = (
|
113 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
114 |
+
)
|
115 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
116 |
+
|
117 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
118 |
+
outputs = self.model(
|
119 |
+
input_ids=input_ids,
|
120 |
+
attention_mask=attention_mask,
|
121 |
+
position_ids=position_ids,
|
122 |
+
past_key_values=past_key_values,
|
123 |
+
inputs_embeds=inputs_embeds,
|
124 |
+
use_cache=use_cache,
|
125 |
+
output_attentions=output_attentions,
|
126 |
+
output_hidden_states=output_hidden_states,
|
127 |
+
return_dict=return_dict,
|
128 |
+
)
|
129 |
+
|
130 |
+
hidden_states = outputs[0]
|
131 |
+
if self.config.pretraining_tp > 1:
|
132 |
+
lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
|
133 |
+
logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
|
134 |
+
logits = torch.cat(logits, dim=-1)
|
135 |
+
else:
|
136 |
+
logits = self.lm_head(hidden_states)
|
137 |
+
logits = logits.float()
|
138 |
+
|
139 |
+
loss = None
|
140 |
+
if labels is not None:
|
141 |
+
# Shift so that tokens < n predict n
|
142 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
143 |
+
shift_labels = labels[..., 1:].contiguous()
|
144 |
+
# Flatten the tokens
|
145 |
+
loss_fct = CrossEntropyLoss()
|
146 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
147 |
+
shift_labels = shift_labels.view(-1)
|
148 |
+
# Enable model parallelism
|
149 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
150 |
+
loss = loss_fct(shift_logits, shift_labels)
|
151 |
+
|
152 |
+
if not return_dict:
|
153 |
+
output = (logits,) + outputs[1:]
|
154 |
+
return (loss,) + output if loss is not None else output
|
155 |
+
|
156 |
+
return CausalLMOutputWithPast(
|
157 |
+
loss=loss,
|
158 |
+
logits=logits,
|
159 |
+
past_key_values=outputs.past_key_values,
|
160 |
+
hidden_states=outputs.hidden_states,
|
161 |
+
attentions=outputs.attentions,
|
162 |
+
)
|
163 |
+
|
164 |
+
def prepare_inputs_for_generation(
|
165 |
+
self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
|
166 |
+
):
|
167 |
+
if past_key_values is not None:
|
168 |
+
if isinstance(past_key_values, Cache):
|
169 |
+
cache_length = past_key_values.get_seq_length()
|
170 |
+
past_length = past_key_values.seen_tokens
|
171 |
+
max_cache_length = past_key_values.get_max_length()
|
172 |
+
else:
|
173 |
+
cache_length = past_length = past_key_values[0][0].shape[2]
|
174 |
+
max_cache_length = None
|
175 |
+
|
176 |
+
# Keep only the unprocessed tokens:
|
177 |
+
# 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
|
178 |
+
# some of the inputs are exclusively passed as part of the cache (e.g. when passing input_embeds as
|
179 |
+
# input)
|
180 |
+
if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
|
181 |
+
input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
|
182 |
+
# 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
|
183 |
+
# input_ids based on the past_length.
|
184 |
+
elif past_length < input_ids.shape[1]:
|
185 |
+
input_ids = input_ids[:, past_length:]
|
186 |
+
# 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
|
187 |
+
|
188 |
+
# If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
|
189 |
+
if (
|
190 |
+
max_cache_length is not None
|
191 |
+
and attention_mask is not None
|
192 |
+
and cache_length + input_ids.shape[1] > max_cache_length
|
193 |
+
):
|
194 |
+
attention_mask = attention_mask[:, -max_cache_length:]
|
195 |
+
|
196 |
+
position_ids = kwargs.get("position_ids", None)
|
197 |
+
if attention_mask is not None and position_ids is None:
|
198 |
+
# create position_ids on the fly for batch generation
|
199 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
200 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
201 |
+
if past_key_values:
|
202 |
+
position_ids = position_ids[:, -input_ids.shape[1] :]
|
203 |
+
|
204 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
205 |
+
if inputs_embeds is not None and past_key_values is None:
|
206 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
207 |
+
else:
|
208 |
+
model_inputs = {"input_ids": input_ids}
|
209 |
+
|
210 |
+
model_inputs.update(
|
211 |
+
{
|
212 |
+
"position_ids": position_ids,
|
213 |
+
"past_key_values": past_key_values,
|
214 |
+
"use_cache": kwargs.get("use_cache"),
|
215 |
+
"attention_mask": attention_mask,
|
216 |
+
}
|
217 |
+
)
|
218 |
+
return model_inputs
|
219 |
+
|
220 |
+
@staticmethod
|
221 |
+
def _reorder_cache(past_key_values, beam_idx):
|
222 |
+
reordered_past = ()
|
223 |
+
for layer_past in past_key_values:
|
224 |
+
reordered_past += (
|
225 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
|
226 |
+
)
|
227 |
+
return reordered_past
|
special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"unk_token": {
|
17 |
+
"content": "<unk>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4ca82daf7120db431caf5fb454efcc44d80fb1226ed92fe5b3a33e1a717a35a6
|
3 |
+
size 924701
|
tokenizer_config.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"0": {
|
6 |
+
"content": "<unk>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"1": {
|
14 |
+
"content": "<s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"2": {
|
22 |
+
"content": "</s>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": false,
|
26 |
+
"single_word": false,
|
27 |
+
"special": true
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"bos_token": "<s>",
|
31 |
+
"clean_up_tokenization_spaces": false,
|
32 |
+
"eos_token": "</s>",
|
33 |
+
"legacy": true,
|
34 |
+
"model_max_length": 1000000000000000019884624838656,
|
35 |
+
"pad_token": null,
|
36 |
+
"sp_model_kwargs": {},
|
37 |
+
"spaces_between_special_tokens": false,
|
38 |
+
"tokenizer_class": "LlamaTokenizer",
|
39 |
+
"unk_token": "<unk>",
|
40 |
+
"use_default_system_prompt": false
|
41 |
+
}
|