nicolaus625 commited on
Commit
2a4f061
1 Parent(s): 9f4cab1

Upload model

Browse files
config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MusilingoModel"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_musilingo.MusiLingoConfig",
7
+ "AutoModel": "modelling_musilingo.MusilingoModel"
8
+ },
9
+ "device_8bit": 0,
10
+ "end_sym": "\n",
11
+ "llama_model": "lmsys/vicuna-7b-delta-v0",
12
+ "low_resource": false,
13
+ "max_txt_len": 32,
14
+ "mert_model": "m-a-p/MERT-v1-330M",
15
+ "model_type": "musilingo",
16
+ "prompt_path": "",
17
+ "prompt_template": "###Human: {} ###Assistant: ",
18
+ "torch_dtype": "float32",
19
+ "transformers_version": "4.39.3"
20
+ }
configuration_musilingo.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+
4
+ PATH = "."
5
+
6
+ class MusiLingoConfig(PretrainedConfig):
7
+ model_type = "musilingo"
8
+ is_encoder_decoder = True
9
+ def __init__(self,
10
+ mert_model = "m-a-p/MERT-v1-330M",
11
+ llama_model = f'lmsys/vicuna-7b-delta-v0',
12
+ prompt_path = "",
13
+ prompt_template = '###Human: {} ###Assistant: ',
14
+ max_txt_len = 32,
15
+ end_sym = '\n',
16
+ low_resource = False,
17
+ device_8bit = 0,
18
+ # linear_ckpt_path = "",
19
+ **kwargs):
20
+ self.mert_model = mert_model
21
+ self.llama_model = llama_model
22
+ self.prompt_path = prompt_path
23
+ self.prompt_template = prompt_template
24
+ self.max_txt_len = max_txt_len
25
+ self.end_sym = end_sym
26
+ self.low_resource = low_resource
27
+ self.device_8bit = device_8bit
28
+ # self.linear_ckpt_path = linear_ckpt_path
29
+ super().__init__(**kwargs)
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c24790aba36855d1eb25095c68b7a3a782d09c5281d1ddebc788f6946c374b3b
3
+ size 4986465504
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81c614ec56b4947a29b7f48a1e0d557e0a12ef70cf626194da05c02a1cfb85ff
3
+ size 4947397256
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c56f6cdf43a6860aa3599b4158148b7941f1e7a12395fd7d4bb317bd591ba7e5
3
+ size 4821600024
model.safetensors.index.json ADDED
@@ -0,0 +1,735 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 14755365376
4
+ },
5
+ "weight_map": {
6
+ "model.audio_encoder.encoder.layer_norm.bias": "model-00001-of-00003.safetensors",
7
+ "model.audio_encoder.encoder.layer_norm.weight": "model-00001-of-00003.safetensors",
8
+ "model.audio_encoder.encoder.layers.0.attention.k_proj.bias": "model-00001-of-00003.safetensors",
9
+ "model.audio_encoder.encoder.layers.0.attention.k_proj.weight": "model-00001-of-00003.safetensors",
10
+ "model.audio_encoder.encoder.layers.0.attention.out_proj.bias": "model-00001-of-00003.safetensors",
11
+ "model.audio_encoder.encoder.layers.0.attention.out_proj.weight": "model-00001-of-00003.safetensors",
12
+ "model.audio_encoder.encoder.layers.0.attention.q_proj.bias": "model-00001-of-00003.safetensors",
13
+ "model.audio_encoder.encoder.layers.0.attention.q_proj.weight": "model-00001-of-00003.safetensors",
14
+ "model.audio_encoder.encoder.layers.0.attention.v_proj.bias": "model-00001-of-00003.safetensors",
15
+ "model.audio_encoder.encoder.layers.0.attention.v_proj.weight": "model-00001-of-00003.safetensors",
16
+ "model.audio_encoder.encoder.layers.0.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
17
+ "model.audio_encoder.encoder.layers.0.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
18
+ "model.audio_encoder.encoder.layers.0.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
19
+ "model.audio_encoder.encoder.layers.0.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
20
+ "model.audio_encoder.encoder.layers.0.final_layer_norm.bias": "model-00001-of-00003.safetensors",
21
+ "model.audio_encoder.encoder.layers.0.final_layer_norm.weight": "model-00001-of-00003.safetensors",
22
+ "model.audio_encoder.encoder.layers.0.layer_norm.bias": "model-00001-of-00003.safetensors",
23
+ "model.audio_encoder.encoder.layers.0.layer_norm.weight": "model-00001-of-00003.safetensors",
24
+ "model.audio_encoder.encoder.layers.1.attention.k_proj.bias": "model-00001-of-00003.safetensors",
25
+ "model.audio_encoder.encoder.layers.1.attention.k_proj.weight": "model-00001-of-00003.safetensors",
26
+ "model.audio_encoder.encoder.layers.1.attention.out_proj.bias": "model-00001-of-00003.safetensors",
27
+ "model.audio_encoder.encoder.layers.1.attention.out_proj.weight": "model-00001-of-00003.safetensors",
28
+ "model.audio_encoder.encoder.layers.1.attention.q_proj.bias": "model-00001-of-00003.safetensors",
29
+ "model.audio_encoder.encoder.layers.1.attention.q_proj.weight": "model-00001-of-00003.safetensors",
30
+ "model.audio_encoder.encoder.layers.1.attention.v_proj.bias": "model-00001-of-00003.safetensors",
31
+ "model.audio_encoder.encoder.layers.1.attention.v_proj.weight": "model-00001-of-00003.safetensors",
32
+ "model.audio_encoder.encoder.layers.1.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
33
+ "model.audio_encoder.encoder.layers.1.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
34
+ "model.audio_encoder.encoder.layers.1.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
35
+ "model.audio_encoder.encoder.layers.1.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
36
+ "model.audio_encoder.encoder.layers.1.final_layer_norm.bias": "model-00001-of-00003.safetensors",
37
+ "model.audio_encoder.encoder.layers.1.final_layer_norm.weight": "model-00001-of-00003.safetensors",
38
+ "model.audio_encoder.encoder.layers.1.layer_norm.bias": "model-00001-of-00003.safetensors",
39
+ "model.audio_encoder.encoder.layers.1.layer_norm.weight": "model-00001-of-00003.safetensors",
40
+ "model.audio_encoder.encoder.layers.10.attention.k_proj.bias": "model-00001-of-00003.safetensors",
41
+ "model.audio_encoder.encoder.layers.10.attention.k_proj.weight": "model-00001-of-00003.safetensors",
42
+ "model.audio_encoder.encoder.layers.10.attention.out_proj.bias": "model-00001-of-00003.safetensors",
43
+ "model.audio_encoder.encoder.layers.10.attention.out_proj.weight": "model-00001-of-00003.safetensors",
44
+ "model.audio_encoder.encoder.layers.10.attention.q_proj.bias": "model-00001-of-00003.safetensors",
45
+ "model.audio_encoder.encoder.layers.10.attention.q_proj.weight": "model-00001-of-00003.safetensors",
46
+ "model.audio_encoder.encoder.layers.10.attention.v_proj.bias": "model-00001-of-00003.safetensors",
47
+ "model.audio_encoder.encoder.layers.10.attention.v_proj.weight": "model-00001-of-00003.safetensors",
48
+ "model.audio_encoder.encoder.layers.10.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
49
+ "model.audio_encoder.encoder.layers.10.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
50
+ "model.audio_encoder.encoder.layers.10.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
51
+ "model.audio_encoder.encoder.layers.10.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
52
+ "model.audio_encoder.encoder.layers.10.final_layer_norm.bias": "model-00001-of-00003.safetensors",
53
+ "model.audio_encoder.encoder.layers.10.final_layer_norm.weight": "model-00001-of-00003.safetensors",
54
+ "model.audio_encoder.encoder.layers.10.layer_norm.bias": "model-00001-of-00003.safetensors",
55
+ "model.audio_encoder.encoder.layers.10.layer_norm.weight": "model-00001-of-00003.safetensors",
56
+ "model.audio_encoder.encoder.layers.11.attention.k_proj.bias": "model-00001-of-00003.safetensors",
57
+ "model.audio_encoder.encoder.layers.11.attention.k_proj.weight": "model-00001-of-00003.safetensors",
58
+ "model.audio_encoder.encoder.layers.11.attention.out_proj.bias": "model-00001-of-00003.safetensors",
59
+ "model.audio_encoder.encoder.layers.11.attention.out_proj.weight": "model-00001-of-00003.safetensors",
60
+ "model.audio_encoder.encoder.layers.11.attention.q_proj.bias": "model-00001-of-00003.safetensors",
61
+ "model.audio_encoder.encoder.layers.11.attention.q_proj.weight": "model-00001-of-00003.safetensors",
62
+ "model.audio_encoder.encoder.layers.11.attention.v_proj.bias": "model-00001-of-00003.safetensors",
63
+ "model.audio_encoder.encoder.layers.11.attention.v_proj.weight": "model-00001-of-00003.safetensors",
64
+ "model.audio_encoder.encoder.layers.11.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
65
+ "model.audio_encoder.encoder.layers.11.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
66
+ "model.audio_encoder.encoder.layers.11.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
67
+ "model.audio_encoder.encoder.layers.11.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
68
+ "model.audio_encoder.encoder.layers.11.final_layer_norm.bias": "model-00001-of-00003.safetensors",
69
+ "model.audio_encoder.encoder.layers.11.final_layer_norm.weight": "model-00001-of-00003.safetensors",
70
+ "model.audio_encoder.encoder.layers.11.layer_norm.bias": "model-00001-of-00003.safetensors",
71
+ "model.audio_encoder.encoder.layers.11.layer_norm.weight": "model-00001-of-00003.safetensors",
72
+ "model.audio_encoder.encoder.layers.12.attention.k_proj.bias": "model-00001-of-00003.safetensors",
73
+ "model.audio_encoder.encoder.layers.12.attention.k_proj.weight": "model-00001-of-00003.safetensors",
74
+ "model.audio_encoder.encoder.layers.12.attention.out_proj.bias": "model-00001-of-00003.safetensors",
75
+ "model.audio_encoder.encoder.layers.12.attention.out_proj.weight": "model-00001-of-00003.safetensors",
76
+ "model.audio_encoder.encoder.layers.12.attention.q_proj.bias": "model-00001-of-00003.safetensors",
77
+ "model.audio_encoder.encoder.layers.12.attention.q_proj.weight": "model-00001-of-00003.safetensors",
78
+ "model.audio_encoder.encoder.layers.12.attention.v_proj.bias": "model-00001-of-00003.safetensors",
79
+ "model.audio_encoder.encoder.layers.12.attention.v_proj.weight": "model-00001-of-00003.safetensors",
80
+ "model.audio_encoder.encoder.layers.12.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
81
+ "model.audio_encoder.encoder.layers.12.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
82
+ "model.audio_encoder.encoder.layers.12.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
83
+ "model.audio_encoder.encoder.layers.12.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
84
+ "model.audio_encoder.encoder.layers.12.final_layer_norm.bias": "model-00001-of-00003.safetensors",
85
+ "model.audio_encoder.encoder.layers.12.final_layer_norm.weight": "model-00001-of-00003.safetensors",
86
+ "model.audio_encoder.encoder.layers.12.layer_norm.bias": "model-00001-of-00003.safetensors",
87
+ "model.audio_encoder.encoder.layers.12.layer_norm.weight": "model-00001-of-00003.safetensors",
88
+ "model.audio_encoder.encoder.layers.13.attention.k_proj.bias": "model-00001-of-00003.safetensors",
89
+ "model.audio_encoder.encoder.layers.13.attention.k_proj.weight": "model-00001-of-00003.safetensors",
90
+ "model.audio_encoder.encoder.layers.13.attention.out_proj.bias": "model-00001-of-00003.safetensors",
91
+ "model.audio_encoder.encoder.layers.13.attention.out_proj.weight": "model-00001-of-00003.safetensors",
92
+ "model.audio_encoder.encoder.layers.13.attention.q_proj.bias": "model-00001-of-00003.safetensors",
93
+ "model.audio_encoder.encoder.layers.13.attention.q_proj.weight": "model-00001-of-00003.safetensors",
94
+ "model.audio_encoder.encoder.layers.13.attention.v_proj.bias": "model-00001-of-00003.safetensors",
95
+ "model.audio_encoder.encoder.layers.13.attention.v_proj.weight": "model-00001-of-00003.safetensors",
96
+ "model.audio_encoder.encoder.layers.13.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
97
+ "model.audio_encoder.encoder.layers.13.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
98
+ "model.audio_encoder.encoder.layers.13.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
99
+ "model.audio_encoder.encoder.layers.13.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
100
+ "model.audio_encoder.encoder.layers.13.final_layer_norm.bias": "model-00001-of-00003.safetensors",
101
+ "model.audio_encoder.encoder.layers.13.final_layer_norm.weight": "model-00001-of-00003.safetensors",
102
+ "model.audio_encoder.encoder.layers.13.layer_norm.bias": "model-00001-of-00003.safetensors",
103
+ "model.audio_encoder.encoder.layers.13.layer_norm.weight": "model-00001-of-00003.safetensors",
104
+ "model.audio_encoder.encoder.layers.14.attention.k_proj.bias": "model-00001-of-00003.safetensors",
105
+ "model.audio_encoder.encoder.layers.14.attention.k_proj.weight": "model-00001-of-00003.safetensors",
106
+ "model.audio_encoder.encoder.layers.14.attention.out_proj.bias": "model-00001-of-00003.safetensors",
107
+ "model.audio_encoder.encoder.layers.14.attention.out_proj.weight": "model-00001-of-00003.safetensors",
108
+ "model.audio_encoder.encoder.layers.14.attention.q_proj.bias": "model-00001-of-00003.safetensors",
109
+ "model.audio_encoder.encoder.layers.14.attention.q_proj.weight": "model-00001-of-00003.safetensors",
110
+ "model.audio_encoder.encoder.layers.14.attention.v_proj.bias": "model-00001-of-00003.safetensors",
111
+ "model.audio_encoder.encoder.layers.14.attention.v_proj.weight": "model-00001-of-00003.safetensors",
112
+ "model.audio_encoder.encoder.layers.14.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
113
+ "model.audio_encoder.encoder.layers.14.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
114
+ "model.audio_encoder.encoder.layers.14.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
115
+ "model.audio_encoder.encoder.layers.14.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
116
+ "model.audio_encoder.encoder.layers.14.final_layer_norm.bias": "model-00001-of-00003.safetensors",
117
+ "model.audio_encoder.encoder.layers.14.final_layer_norm.weight": "model-00001-of-00003.safetensors",
118
+ "model.audio_encoder.encoder.layers.14.layer_norm.bias": "model-00001-of-00003.safetensors",
119
+ "model.audio_encoder.encoder.layers.14.layer_norm.weight": "model-00001-of-00003.safetensors",
120
+ "model.audio_encoder.encoder.layers.15.attention.k_proj.bias": "model-00001-of-00003.safetensors",
121
+ "model.audio_encoder.encoder.layers.15.attention.k_proj.weight": "model-00001-of-00003.safetensors",
122
+ "model.audio_encoder.encoder.layers.15.attention.out_proj.bias": "model-00001-of-00003.safetensors",
123
+ "model.audio_encoder.encoder.layers.15.attention.out_proj.weight": "model-00001-of-00003.safetensors",
124
+ "model.audio_encoder.encoder.layers.15.attention.q_proj.bias": "model-00001-of-00003.safetensors",
125
+ "model.audio_encoder.encoder.layers.15.attention.q_proj.weight": "model-00001-of-00003.safetensors",
126
+ "model.audio_encoder.encoder.layers.15.attention.v_proj.bias": "model-00001-of-00003.safetensors",
127
+ "model.audio_encoder.encoder.layers.15.attention.v_proj.weight": "model-00001-of-00003.safetensors",
128
+ "model.audio_encoder.encoder.layers.15.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
129
+ "model.audio_encoder.encoder.layers.15.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
130
+ "model.audio_encoder.encoder.layers.15.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
131
+ "model.audio_encoder.encoder.layers.15.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
132
+ "model.audio_encoder.encoder.layers.15.final_layer_norm.bias": "model-00001-of-00003.safetensors",
133
+ "model.audio_encoder.encoder.layers.15.final_layer_norm.weight": "model-00001-of-00003.safetensors",
134
+ "model.audio_encoder.encoder.layers.15.layer_norm.bias": "model-00001-of-00003.safetensors",
135
+ "model.audio_encoder.encoder.layers.15.layer_norm.weight": "model-00001-of-00003.safetensors",
136
+ "model.audio_encoder.encoder.layers.16.attention.k_proj.bias": "model-00001-of-00003.safetensors",
137
+ "model.audio_encoder.encoder.layers.16.attention.k_proj.weight": "model-00001-of-00003.safetensors",
138
+ "model.audio_encoder.encoder.layers.16.attention.out_proj.bias": "model-00001-of-00003.safetensors",
139
+ "model.audio_encoder.encoder.layers.16.attention.out_proj.weight": "model-00001-of-00003.safetensors",
140
+ "model.audio_encoder.encoder.layers.16.attention.q_proj.bias": "model-00001-of-00003.safetensors",
141
+ "model.audio_encoder.encoder.layers.16.attention.q_proj.weight": "model-00001-of-00003.safetensors",
142
+ "model.audio_encoder.encoder.layers.16.attention.v_proj.bias": "model-00001-of-00003.safetensors",
143
+ "model.audio_encoder.encoder.layers.16.attention.v_proj.weight": "model-00001-of-00003.safetensors",
144
+ "model.audio_encoder.encoder.layers.16.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
145
+ "model.audio_encoder.encoder.layers.16.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
146
+ "model.audio_encoder.encoder.layers.16.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
147
+ "model.audio_encoder.encoder.layers.16.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
148
+ "model.audio_encoder.encoder.layers.16.final_layer_norm.bias": "model-00001-of-00003.safetensors",
149
+ "model.audio_encoder.encoder.layers.16.final_layer_norm.weight": "model-00001-of-00003.safetensors",
150
+ "model.audio_encoder.encoder.layers.16.layer_norm.bias": "model-00001-of-00003.safetensors",
151
+ "model.audio_encoder.encoder.layers.16.layer_norm.weight": "model-00001-of-00003.safetensors",
152
+ "model.audio_encoder.encoder.layers.17.attention.k_proj.bias": "model-00001-of-00003.safetensors",
153
+ "model.audio_encoder.encoder.layers.17.attention.k_proj.weight": "model-00001-of-00003.safetensors",
154
+ "model.audio_encoder.encoder.layers.17.attention.out_proj.bias": "model-00001-of-00003.safetensors",
155
+ "model.audio_encoder.encoder.layers.17.attention.out_proj.weight": "model-00001-of-00003.safetensors",
156
+ "model.audio_encoder.encoder.layers.17.attention.q_proj.bias": "model-00001-of-00003.safetensors",
157
+ "model.audio_encoder.encoder.layers.17.attention.q_proj.weight": "model-00001-of-00003.safetensors",
158
+ "model.audio_encoder.encoder.layers.17.attention.v_proj.bias": "model-00001-of-00003.safetensors",
159
+ "model.audio_encoder.encoder.layers.17.attention.v_proj.weight": "model-00001-of-00003.safetensors",
160
+ "model.audio_encoder.encoder.layers.17.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
161
+ "model.audio_encoder.encoder.layers.17.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
162
+ "model.audio_encoder.encoder.layers.17.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
163
+ "model.audio_encoder.encoder.layers.17.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
164
+ "model.audio_encoder.encoder.layers.17.final_layer_norm.bias": "model-00001-of-00003.safetensors",
165
+ "model.audio_encoder.encoder.layers.17.final_layer_norm.weight": "model-00001-of-00003.safetensors",
166
+ "model.audio_encoder.encoder.layers.17.layer_norm.bias": "model-00001-of-00003.safetensors",
167
+ "model.audio_encoder.encoder.layers.17.layer_norm.weight": "model-00001-of-00003.safetensors",
168
+ "model.audio_encoder.encoder.layers.18.attention.k_proj.bias": "model-00001-of-00003.safetensors",
169
+ "model.audio_encoder.encoder.layers.18.attention.k_proj.weight": "model-00001-of-00003.safetensors",
170
+ "model.audio_encoder.encoder.layers.18.attention.out_proj.bias": "model-00001-of-00003.safetensors",
171
+ "model.audio_encoder.encoder.layers.18.attention.out_proj.weight": "model-00001-of-00003.safetensors",
172
+ "model.audio_encoder.encoder.layers.18.attention.q_proj.bias": "model-00001-of-00003.safetensors",
173
+ "model.audio_encoder.encoder.layers.18.attention.q_proj.weight": "model-00001-of-00003.safetensors",
174
+ "model.audio_encoder.encoder.layers.18.attention.v_proj.bias": "model-00001-of-00003.safetensors",
175
+ "model.audio_encoder.encoder.layers.18.attention.v_proj.weight": "model-00001-of-00003.safetensors",
176
+ "model.audio_encoder.encoder.layers.18.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
177
+ "model.audio_encoder.encoder.layers.18.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
178
+ "model.audio_encoder.encoder.layers.18.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
179
+ "model.audio_encoder.encoder.layers.18.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
180
+ "model.audio_encoder.encoder.layers.18.final_layer_norm.bias": "model-00001-of-00003.safetensors",
181
+ "model.audio_encoder.encoder.layers.18.final_layer_norm.weight": "model-00001-of-00003.safetensors",
182
+ "model.audio_encoder.encoder.layers.18.layer_norm.bias": "model-00001-of-00003.safetensors",
183
+ "model.audio_encoder.encoder.layers.18.layer_norm.weight": "model-00001-of-00003.safetensors",
184
+ "model.audio_encoder.encoder.layers.19.attention.k_proj.bias": "model-00001-of-00003.safetensors",
185
+ "model.audio_encoder.encoder.layers.19.attention.k_proj.weight": "model-00001-of-00003.safetensors",
186
+ "model.audio_encoder.encoder.layers.19.attention.out_proj.bias": "model-00001-of-00003.safetensors",
187
+ "model.audio_encoder.encoder.layers.19.attention.out_proj.weight": "model-00001-of-00003.safetensors",
188
+ "model.audio_encoder.encoder.layers.19.attention.q_proj.bias": "model-00001-of-00003.safetensors",
189
+ "model.audio_encoder.encoder.layers.19.attention.q_proj.weight": "model-00001-of-00003.safetensors",
190
+ "model.audio_encoder.encoder.layers.19.attention.v_proj.bias": "model-00001-of-00003.safetensors",
191
+ "model.audio_encoder.encoder.layers.19.attention.v_proj.weight": "model-00001-of-00003.safetensors",
192
+ "model.audio_encoder.encoder.layers.19.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
193
+ "model.audio_encoder.encoder.layers.19.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
194
+ "model.audio_encoder.encoder.layers.19.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
195
+ "model.audio_encoder.encoder.layers.19.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
196
+ "model.audio_encoder.encoder.layers.19.final_layer_norm.bias": "model-00001-of-00003.safetensors",
197
+ "model.audio_encoder.encoder.layers.19.final_layer_norm.weight": "model-00001-of-00003.safetensors",
198
+ "model.audio_encoder.encoder.layers.19.layer_norm.bias": "model-00001-of-00003.safetensors",
199
+ "model.audio_encoder.encoder.layers.19.layer_norm.weight": "model-00001-of-00003.safetensors",
200
+ "model.audio_encoder.encoder.layers.2.attention.k_proj.bias": "model-00001-of-00003.safetensors",
201
+ "model.audio_encoder.encoder.layers.2.attention.k_proj.weight": "model-00001-of-00003.safetensors",
202
+ "model.audio_encoder.encoder.layers.2.attention.out_proj.bias": "model-00001-of-00003.safetensors",
203
+ "model.audio_encoder.encoder.layers.2.attention.out_proj.weight": "model-00001-of-00003.safetensors",
204
+ "model.audio_encoder.encoder.layers.2.attention.q_proj.bias": "model-00001-of-00003.safetensors",
205
+ "model.audio_encoder.encoder.layers.2.attention.q_proj.weight": "model-00001-of-00003.safetensors",
206
+ "model.audio_encoder.encoder.layers.2.attention.v_proj.bias": "model-00001-of-00003.safetensors",
207
+ "model.audio_encoder.encoder.layers.2.attention.v_proj.weight": "model-00001-of-00003.safetensors",
208
+ "model.audio_encoder.encoder.layers.2.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
209
+ "model.audio_encoder.encoder.layers.2.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
210
+ "model.audio_encoder.encoder.layers.2.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
211
+ "model.audio_encoder.encoder.layers.2.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
212
+ "model.audio_encoder.encoder.layers.2.final_layer_norm.bias": "model-00001-of-00003.safetensors",
213
+ "model.audio_encoder.encoder.layers.2.final_layer_norm.weight": "model-00001-of-00003.safetensors",
214
+ "model.audio_encoder.encoder.layers.2.layer_norm.bias": "model-00001-of-00003.safetensors",
215
+ "model.audio_encoder.encoder.layers.2.layer_norm.weight": "model-00001-of-00003.safetensors",
216
+ "model.audio_encoder.encoder.layers.20.attention.k_proj.bias": "model-00001-of-00003.safetensors",
217
+ "model.audio_encoder.encoder.layers.20.attention.k_proj.weight": "model-00001-of-00003.safetensors",
218
+ "model.audio_encoder.encoder.layers.20.attention.out_proj.bias": "model-00001-of-00003.safetensors",
219
+ "model.audio_encoder.encoder.layers.20.attention.out_proj.weight": "model-00001-of-00003.safetensors",
220
+ "model.audio_encoder.encoder.layers.20.attention.q_proj.bias": "model-00001-of-00003.safetensors",
221
+ "model.audio_encoder.encoder.layers.20.attention.q_proj.weight": "model-00001-of-00003.safetensors",
222
+ "model.audio_encoder.encoder.layers.20.attention.v_proj.bias": "model-00001-of-00003.safetensors",
223
+ "model.audio_encoder.encoder.layers.20.attention.v_proj.weight": "model-00001-of-00003.safetensors",
224
+ "model.audio_encoder.encoder.layers.20.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
225
+ "model.audio_encoder.encoder.layers.20.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
226
+ "model.audio_encoder.encoder.layers.20.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
227
+ "model.audio_encoder.encoder.layers.20.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
228
+ "model.audio_encoder.encoder.layers.20.final_layer_norm.bias": "model-00001-of-00003.safetensors",
229
+ "model.audio_encoder.encoder.layers.20.final_layer_norm.weight": "model-00001-of-00003.safetensors",
230
+ "model.audio_encoder.encoder.layers.20.layer_norm.bias": "model-00001-of-00003.safetensors",
231
+ "model.audio_encoder.encoder.layers.20.layer_norm.weight": "model-00001-of-00003.safetensors",
232
+ "model.audio_encoder.encoder.layers.21.attention.k_proj.bias": "model-00001-of-00003.safetensors",
233
+ "model.audio_encoder.encoder.layers.21.attention.k_proj.weight": "model-00001-of-00003.safetensors",
234
+ "model.audio_encoder.encoder.layers.21.attention.out_proj.bias": "model-00001-of-00003.safetensors",
235
+ "model.audio_encoder.encoder.layers.21.attention.out_proj.weight": "model-00001-of-00003.safetensors",
236
+ "model.audio_encoder.encoder.layers.21.attention.q_proj.bias": "model-00001-of-00003.safetensors",
237
+ "model.audio_encoder.encoder.layers.21.attention.q_proj.weight": "model-00001-of-00003.safetensors",
238
+ "model.audio_encoder.encoder.layers.21.attention.v_proj.bias": "model-00001-of-00003.safetensors",
239
+ "model.audio_encoder.encoder.layers.21.attention.v_proj.weight": "model-00001-of-00003.safetensors",
240
+ "model.audio_encoder.encoder.layers.21.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
241
+ "model.audio_encoder.encoder.layers.21.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
242
+ "model.audio_encoder.encoder.layers.21.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
243
+ "model.audio_encoder.encoder.layers.21.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
244
+ "model.audio_encoder.encoder.layers.21.final_layer_norm.bias": "model-00001-of-00003.safetensors",
245
+ "model.audio_encoder.encoder.layers.21.final_layer_norm.weight": "model-00001-of-00003.safetensors",
246
+ "model.audio_encoder.encoder.layers.21.layer_norm.bias": "model-00001-of-00003.safetensors",
247
+ "model.audio_encoder.encoder.layers.21.layer_norm.weight": "model-00001-of-00003.safetensors",
248
+ "model.audio_encoder.encoder.layers.22.attention.k_proj.bias": "model-00001-of-00003.safetensors",
249
+ "model.audio_encoder.encoder.layers.22.attention.k_proj.weight": "model-00001-of-00003.safetensors",
250
+ "model.audio_encoder.encoder.layers.22.attention.out_proj.bias": "model-00001-of-00003.safetensors",
251
+ "model.audio_encoder.encoder.layers.22.attention.out_proj.weight": "model-00001-of-00003.safetensors",
252
+ "model.audio_encoder.encoder.layers.22.attention.q_proj.bias": "model-00001-of-00003.safetensors",
253
+ "model.audio_encoder.encoder.layers.22.attention.q_proj.weight": "model-00001-of-00003.safetensors",
254
+ "model.audio_encoder.encoder.layers.22.attention.v_proj.bias": "model-00001-of-00003.safetensors",
255
+ "model.audio_encoder.encoder.layers.22.attention.v_proj.weight": "model-00001-of-00003.safetensors",
256
+ "model.audio_encoder.encoder.layers.22.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
257
+ "model.audio_encoder.encoder.layers.22.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
258
+ "model.audio_encoder.encoder.layers.22.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
259
+ "model.audio_encoder.encoder.layers.22.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
260
+ "model.audio_encoder.encoder.layers.22.final_layer_norm.bias": "model-00001-of-00003.safetensors",
261
+ "model.audio_encoder.encoder.layers.22.final_layer_norm.weight": "model-00001-of-00003.safetensors",
262
+ "model.audio_encoder.encoder.layers.22.layer_norm.bias": "model-00001-of-00003.safetensors",
263
+ "model.audio_encoder.encoder.layers.22.layer_norm.weight": "model-00001-of-00003.safetensors",
264
+ "model.audio_encoder.encoder.layers.23.attention.k_proj.bias": "model-00001-of-00003.safetensors",
265
+ "model.audio_encoder.encoder.layers.23.attention.k_proj.weight": "model-00001-of-00003.safetensors",
266
+ "model.audio_encoder.encoder.layers.23.attention.out_proj.bias": "model-00001-of-00003.safetensors",
267
+ "model.audio_encoder.encoder.layers.23.attention.out_proj.weight": "model-00001-of-00003.safetensors",
268
+ "model.audio_encoder.encoder.layers.23.attention.q_proj.bias": "model-00001-of-00003.safetensors",
269
+ "model.audio_encoder.encoder.layers.23.attention.q_proj.weight": "model-00001-of-00003.safetensors",
270
+ "model.audio_encoder.encoder.layers.23.attention.v_proj.bias": "model-00001-of-00003.safetensors",
271
+ "model.audio_encoder.encoder.layers.23.attention.v_proj.weight": "model-00001-of-00003.safetensors",
272
+ "model.audio_encoder.encoder.layers.23.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
273
+ "model.audio_encoder.encoder.layers.23.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
274
+ "model.audio_encoder.encoder.layers.23.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
275
+ "model.audio_encoder.encoder.layers.23.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
276
+ "model.audio_encoder.encoder.layers.23.final_layer_norm.bias": "model-00001-of-00003.safetensors",
277
+ "model.audio_encoder.encoder.layers.23.final_layer_norm.weight": "model-00001-of-00003.safetensors",
278
+ "model.audio_encoder.encoder.layers.23.layer_norm.bias": "model-00001-of-00003.safetensors",
279
+ "model.audio_encoder.encoder.layers.23.layer_norm.weight": "model-00001-of-00003.safetensors",
280
+ "model.audio_encoder.encoder.layers.3.attention.k_proj.bias": "model-00001-of-00003.safetensors",
281
+ "model.audio_encoder.encoder.layers.3.attention.k_proj.weight": "model-00001-of-00003.safetensors",
282
+ "model.audio_encoder.encoder.layers.3.attention.out_proj.bias": "model-00001-of-00003.safetensors",
283
+ "model.audio_encoder.encoder.layers.3.attention.out_proj.weight": "model-00001-of-00003.safetensors",
284
+ "model.audio_encoder.encoder.layers.3.attention.q_proj.bias": "model-00001-of-00003.safetensors",
285
+ "model.audio_encoder.encoder.layers.3.attention.q_proj.weight": "model-00001-of-00003.safetensors",
286
+ "model.audio_encoder.encoder.layers.3.attention.v_proj.bias": "model-00001-of-00003.safetensors",
287
+ "model.audio_encoder.encoder.layers.3.attention.v_proj.weight": "model-00001-of-00003.safetensors",
288
+ "model.audio_encoder.encoder.layers.3.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
289
+ "model.audio_encoder.encoder.layers.3.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
290
+ "model.audio_encoder.encoder.layers.3.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
291
+ "model.audio_encoder.encoder.layers.3.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
292
+ "model.audio_encoder.encoder.layers.3.final_layer_norm.bias": "model-00001-of-00003.safetensors",
293
+ "model.audio_encoder.encoder.layers.3.final_layer_norm.weight": "model-00001-of-00003.safetensors",
294
+ "model.audio_encoder.encoder.layers.3.layer_norm.bias": "model-00001-of-00003.safetensors",
295
+ "model.audio_encoder.encoder.layers.3.layer_norm.weight": "model-00001-of-00003.safetensors",
296
+ "model.audio_encoder.encoder.layers.4.attention.k_proj.bias": "model-00001-of-00003.safetensors",
297
+ "model.audio_encoder.encoder.layers.4.attention.k_proj.weight": "model-00001-of-00003.safetensors",
298
+ "model.audio_encoder.encoder.layers.4.attention.out_proj.bias": "model-00001-of-00003.safetensors",
299
+ "model.audio_encoder.encoder.layers.4.attention.out_proj.weight": "model-00001-of-00003.safetensors",
300
+ "model.audio_encoder.encoder.layers.4.attention.q_proj.bias": "model-00001-of-00003.safetensors",
301
+ "model.audio_encoder.encoder.layers.4.attention.q_proj.weight": "model-00001-of-00003.safetensors",
302
+ "model.audio_encoder.encoder.layers.4.attention.v_proj.bias": "model-00001-of-00003.safetensors",
303
+ "model.audio_encoder.encoder.layers.4.attention.v_proj.weight": "model-00001-of-00003.safetensors",
304
+ "model.audio_encoder.encoder.layers.4.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
305
+ "model.audio_encoder.encoder.layers.4.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
306
+ "model.audio_encoder.encoder.layers.4.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
307
+ "model.audio_encoder.encoder.layers.4.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
308
+ "model.audio_encoder.encoder.layers.4.final_layer_norm.bias": "model-00001-of-00003.safetensors",
309
+ "model.audio_encoder.encoder.layers.4.final_layer_norm.weight": "model-00001-of-00003.safetensors",
310
+ "model.audio_encoder.encoder.layers.4.layer_norm.bias": "model-00001-of-00003.safetensors",
311
+ "model.audio_encoder.encoder.layers.4.layer_norm.weight": "model-00001-of-00003.safetensors",
312
+ "model.audio_encoder.encoder.layers.5.attention.k_proj.bias": "model-00001-of-00003.safetensors",
313
+ "model.audio_encoder.encoder.layers.5.attention.k_proj.weight": "model-00001-of-00003.safetensors",
314
+ "model.audio_encoder.encoder.layers.5.attention.out_proj.bias": "model-00001-of-00003.safetensors",
315
+ "model.audio_encoder.encoder.layers.5.attention.out_proj.weight": "model-00001-of-00003.safetensors",
316
+ "model.audio_encoder.encoder.layers.5.attention.q_proj.bias": "model-00001-of-00003.safetensors",
317
+ "model.audio_encoder.encoder.layers.5.attention.q_proj.weight": "model-00001-of-00003.safetensors",
318
+ "model.audio_encoder.encoder.layers.5.attention.v_proj.bias": "model-00001-of-00003.safetensors",
319
+ "model.audio_encoder.encoder.layers.5.attention.v_proj.weight": "model-00001-of-00003.safetensors",
320
+ "model.audio_encoder.encoder.layers.5.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
321
+ "model.audio_encoder.encoder.layers.5.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
322
+ "model.audio_encoder.encoder.layers.5.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
323
+ "model.audio_encoder.encoder.layers.5.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
324
+ "model.audio_encoder.encoder.layers.5.final_layer_norm.bias": "model-00001-of-00003.safetensors",
325
+ "model.audio_encoder.encoder.layers.5.final_layer_norm.weight": "model-00001-of-00003.safetensors",
326
+ "model.audio_encoder.encoder.layers.5.layer_norm.bias": "model-00001-of-00003.safetensors",
327
+ "model.audio_encoder.encoder.layers.5.layer_norm.weight": "model-00001-of-00003.safetensors",
328
+ "model.audio_encoder.encoder.layers.6.attention.k_proj.bias": "model-00001-of-00003.safetensors",
329
+ "model.audio_encoder.encoder.layers.6.attention.k_proj.weight": "model-00001-of-00003.safetensors",
330
+ "model.audio_encoder.encoder.layers.6.attention.out_proj.bias": "model-00001-of-00003.safetensors",
331
+ "model.audio_encoder.encoder.layers.6.attention.out_proj.weight": "model-00001-of-00003.safetensors",
332
+ "model.audio_encoder.encoder.layers.6.attention.q_proj.bias": "model-00001-of-00003.safetensors",
333
+ "model.audio_encoder.encoder.layers.6.attention.q_proj.weight": "model-00001-of-00003.safetensors",
334
+ "model.audio_encoder.encoder.layers.6.attention.v_proj.bias": "model-00001-of-00003.safetensors",
335
+ "model.audio_encoder.encoder.layers.6.attention.v_proj.weight": "model-00001-of-00003.safetensors",
336
+ "model.audio_encoder.encoder.layers.6.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
337
+ "model.audio_encoder.encoder.layers.6.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
338
+ "model.audio_encoder.encoder.layers.6.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
339
+ "model.audio_encoder.encoder.layers.6.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
340
+ "model.audio_encoder.encoder.layers.6.final_layer_norm.bias": "model-00001-of-00003.safetensors",
341
+ "model.audio_encoder.encoder.layers.6.final_layer_norm.weight": "model-00001-of-00003.safetensors",
342
+ "model.audio_encoder.encoder.layers.6.layer_norm.bias": "model-00001-of-00003.safetensors",
343
+ "model.audio_encoder.encoder.layers.6.layer_norm.weight": "model-00001-of-00003.safetensors",
344
+ "model.audio_encoder.encoder.layers.7.attention.k_proj.bias": "model-00001-of-00003.safetensors",
345
+ "model.audio_encoder.encoder.layers.7.attention.k_proj.weight": "model-00001-of-00003.safetensors",
346
+ "model.audio_encoder.encoder.layers.7.attention.out_proj.bias": "model-00001-of-00003.safetensors",
347
+ "model.audio_encoder.encoder.layers.7.attention.out_proj.weight": "model-00001-of-00003.safetensors",
348
+ "model.audio_encoder.encoder.layers.7.attention.q_proj.bias": "model-00001-of-00003.safetensors",
349
+ "model.audio_encoder.encoder.layers.7.attention.q_proj.weight": "model-00001-of-00003.safetensors",
350
+ "model.audio_encoder.encoder.layers.7.attention.v_proj.bias": "model-00001-of-00003.safetensors",
351
+ "model.audio_encoder.encoder.layers.7.attention.v_proj.weight": "model-00001-of-00003.safetensors",
352
+ "model.audio_encoder.encoder.layers.7.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
353
+ "model.audio_encoder.encoder.layers.7.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
354
+ "model.audio_encoder.encoder.layers.7.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
355
+ "model.audio_encoder.encoder.layers.7.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
356
+ "model.audio_encoder.encoder.layers.7.final_layer_norm.bias": "model-00001-of-00003.safetensors",
357
+ "model.audio_encoder.encoder.layers.7.final_layer_norm.weight": "model-00001-of-00003.safetensors",
358
+ "model.audio_encoder.encoder.layers.7.layer_norm.bias": "model-00001-of-00003.safetensors",
359
+ "model.audio_encoder.encoder.layers.7.layer_norm.weight": "model-00001-of-00003.safetensors",
360
+ "model.audio_encoder.encoder.layers.8.attention.k_proj.bias": "model-00001-of-00003.safetensors",
361
+ "model.audio_encoder.encoder.layers.8.attention.k_proj.weight": "model-00001-of-00003.safetensors",
362
+ "model.audio_encoder.encoder.layers.8.attention.out_proj.bias": "model-00001-of-00003.safetensors",
363
+ "model.audio_encoder.encoder.layers.8.attention.out_proj.weight": "model-00001-of-00003.safetensors",
364
+ "model.audio_encoder.encoder.layers.8.attention.q_proj.bias": "model-00001-of-00003.safetensors",
365
+ "model.audio_encoder.encoder.layers.8.attention.q_proj.weight": "model-00001-of-00003.safetensors",
366
+ "model.audio_encoder.encoder.layers.8.attention.v_proj.bias": "model-00001-of-00003.safetensors",
367
+ "model.audio_encoder.encoder.layers.8.attention.v_proj.weight": "model-00001-of-00003.safetensors",
368
+ "model.audio_encoder.encoder.layers.8.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
369
+ "model.audio_encoder.encoder.layers.8.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
370
+ "model.audio_encoder.encoder.layers.8.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
371
+ "model.audio_encoder.encoder.layers.8.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
372
+ "model.audio_encoder.encoder.layers.8.final_layer_norm.bias": "model-00001-of-00003.safetensors",
373
+ "model.audio_encoder.encoder.layers.8.final_layer_norm.weight": "model-00001-of-00003.safetensors",
374
+ "model.audio_encoder.encoder.layers.8.layer_norm.bias": "model-00001-of-00003.safetensors",
375
+ "model.audio_encoder.encoder.layers.8.layer_norm.weight": "model-00001-of-00003.safetensors",
376
+ "model.audio_encoder.encoder.layers.9.attention.k_proj.bias": "model-00001-of-00003.safetensors",
377
+ "model.audio_encoder.encoder.layers.9.attention.k_proj.weight": "model-00001-of-00003.safetensors",
378
+ "model.audio_encoder.encoder.layers.9.attention.out_proj.bias": "model-00001-of-00003.safetensors",
379
+ "model.audio_encoder.encoder.layers.9.attention.out_proj.weight": "model-00001-of-00003.safetensors",
380
+ "model.audio_encoder.encoder.layers.9.attention.q_proj.bias": "model-00001-of-00003.safetensors",
381
+ "model.audio_encoder.encoder.layers.9.attention.q_proj.weight": "model-00001-of-00003.safetensors",
382
+ "model.audio_encoder.encoder.layers.9.attention.v_proj.bias": "model-00001-of-00003.safetensors",
383
+ "model.audio_encoder.encoder.layers.9.attention.v_proj.weight": "model-00001-of-00003.safetensors",
384
+ "model.audio_encoder.encoder.layers.9.feed_forward.intermediate_dense.bias": "model-00001-of-00003.safetensors",
385
+ "model.audio_encoder.encoder.layers.9.feed_forward.intermediate_dense.weight": "model-00001-of-00003.safetensors",
386
+ "model.audio_encoder.encoder.layers.9.feed_forward.output_dense.bias": "model-00001-of-00003.safetensors",
387
+ "model.audio_encoder.encoder.layers.9.feed_forward.output_dense.weight": "model-00001-of-00003.safetensors",
388
+ "model.audio_encoder.encoder.layers.9.final_layer_norm.bias": "model-00001-of-00003.safetensors",
389
+ "model.audio_encoder.encoder.layers.9.final_layer_norm.weight": "model-00001-of-00003.safetensors",
390
+ "model.audio_encoder.encoder.layers.9.layer_norm.bias": "model-00001-of-00003.safetensors",
391
+ "model.audio_encoder.encoder.layers.9.layer_norm.weight": "model-00001-of-00003.safetensors",
392
+ "model.audio_encoder.encoder.pos_conv_embed.conv.bias": "model-00001-of-00003.safetensors",
393
+ "model.audio_encoder.encoder.pos_conv_embed.conv.parametrizations.weight.original0": "model-00001-of-00003.safetensors",
394
+ "model.audio_encoder.encoder.pos_conv_embed.conv.parametrizations.weight.original1": "model-00001-of-00003.safetensors",
395
+ "model.audio_encoder.feature_extractor.conv_layers.0.conv.weight": "model-00001-of-00003.safetensors",
396
+ "model.audio_encoder.feature_extractor.conv_layers.0.layer_norm.bias": "model-00001-of-00003.safetensors",
397
+ "model.audio_encoder.feature_extractor.conv_layers.0.layer_norm.weight": "model-00001-of-00003.safetensors",
398
+ "model.audio_encoder.feature_extractor.conv_layers.1.conv.weight": "model-00001-of-00003.safetensors",
399
+ "model.audio_encoder.feature_extractor.conv_layers.2.conv.weight": "model-00001-of-00003.safetensors",
400
+ "model.audio_encoder.feature_extractor.conv_layers.3.conv.weight": "model-00001-of-00003.safetensors",
401
+ "model.audio_encoder.feature_extractor.conv_layers.4.conv.weight": "model-00001-of-00003.safetensors",
402
+ "model.audio_encoder.feature_extractor.conv_layers.5.conv.weight": "model-00001-of-00003.safetensors",
403
+ "model.audio_encoder.feature_extractor.conv_layers.6.conv.weight": "model-00001-of-00003.safetensors",
404
+ "model.audio_encoder.feature_projection.layer_norm.bias": "model-00001-of-00003.safetensors",
405
+ "model.audio_encoder.feature_projection.layer_norm.weight": "model-00001-of-00003.safetensors",
406
+ "model.audio_encoder.feature_projection.projection.bias": "model-00001-of-00003.safetensors",
407
+ "model.audio_encoder.feature_projection.projection.weight": "model-00001-of-00003.safetensors",
408
+ "model.audio_encoder.masked_spec_embed": "model-00001-of-00003.safetensors",
409
+ "model.llama_model.lm_head.weight": "model-00003-of-00003.safetensors",
410
+ "model.llama_model.model.embed_tokens.weight": "model-00001-of-00003.safetensors",
411
+ "model.llama_model.model.layers.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
412
+ "model.llama_model.model.layers.0.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
413
+ "model.llama_model.model.layers.0.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
414
+ "model.llama_model.model.layers.0.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
415
+ "model.llama_model.model.layers.0.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
416
+ "model.llama_model.model.layers.0.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
417
+ "model.llama_model.model.layers.0.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
418
+ "model.llama_model.model.layers.0.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
419
+ "model.llama_model.model.layers.0.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
420
+ "model.llama_model.model.layers.0.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
421
+ "model.llama_model.model.layers.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
422
+ "model.llama_model.model.layers.1.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
423
+ "model.llama_model.model.layers.1.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
424
+ "model.llama_model.model.layers.1.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
425
+ "model.llama_model.model.layers.1.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
426
+ "model.llama_model.model.layers.1.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
427
+ "model.llama_model.model.layers.1.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
428
+ "model.llama_model.model.layers.1.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
429
+ "model.llama_model.model.layers.1.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
430
+ "model.llama_model.model.layers.1.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
431
+ "model.llama_model.model.layers.10.input_layernorm.weight": "model-00002-of-00003.safetensors",
432
+ "model.llama_model.model.layers.10.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
433
+ "model.llama_model.model.layers.10.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
434
+ "model.llama_model.model.layers.10.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
435
+ "model.llama_model.model.layers.10.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
436
+ "model.llama_model.model.layers.10.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
437
+ "model.llama_model.model.layers.10.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
438
+ "model.llama_model.model.layers.10.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
439
+ "model.llama_model.model.layers.10.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
440
+ "model.llama_model.model.layers.10.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
441
+ "model.llama_model.model.layers.11.input_layernorm.weight": "model-00002-of-00003.safetensors",
442
+ "model.llama_model.model.layers.11.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
443
+ "model.llama_model.model.layers.11.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
444
+ "model.llama_model.model.layers.11.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
445
+ "model.llama_model.model.layers.11.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
446
+ "model.llama_model.model.layers.11.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
447
+ "model.llama_model.model.layers.11.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
448
+ "model.llama_model.model.layers.11.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
449
+ "model.llama_model.model.layers.11.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
450
+ "model.llama_model.model.layers.11.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
451
+ "model.llama_model.model.layers.12.input_layernorm.weight": "model-00002-of-00003.safetensors",
452
+ "model.llama_model.model.layers.12.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
453
+ "model.llama_model.model.layers.12.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
454
+ "model.llama_model.model.layers.12.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
455
+ "model.llama_model.model.layers.12.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
456
+ "model.llama_model.model.layers.12.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
457
+ "model.llama_model.model.layers.12.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
458
+ "model.llama_model.model.layers.12.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
459
+ "model.llama_model.model.layers.12.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
460
+ "model.llama_model.model.layers.12.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
461
+ "model.llama_model.model.layers.13.input_layernorm.weight": "model-00002-of-00003.safetensors",
462
+ "model.llama_model.model.layers.13.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
463
+ "model.llama_model.model.layers.13.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
464
+ "model.llama_model.model.layers.13.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
465
+ "model.llama_model.model.layers.13.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
466
+ "model.llama_model.model.layers.13.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
467
+ "model.llama_model.model.layers.13.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
468
+ "model.llama_model.model.layers.13.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
469
+ "model.llama_model.model.layers.13.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
470
+ "model.llama_model.model.layers.13.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
471
+ "model.llama_model.model.layers.14.input_layernorm.weight": "model-00002-of-00003.safetensors",
472
+ "model.llama_model.model.layers.14.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
473
+ "model.llama_model.model.layers.14.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
474
+ "model.llama_model.model.layers.14.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
475
+ "model.llama_model.model.layers.14.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
476
+ "model.llama_model.model.layers.14.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
477
+ "model.llama_model.model.layers.14.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
478
+ "model.llama_model.model.layers.14.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
479
+ "model.llama_model.model.layers.14.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
480
+ "model.llama_model.model.layers.14.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
481
+ "model.llama_model.model.layers.15.input_layernorm.weight": "model-00002-of-00003.safetensors",
482
+ "model.llama_model.model.layers.15.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
483
+ "model.llama_model.model.layers.15.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
484
+ "model.llama_model.model.layers.15.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
485
+ "model.llama_model.model.layers.15.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
486
+ "model.llama_model.model.layers.15.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
487
+ "model.llama_model.model.layers.15.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
488
+ "model.llama_model.model.layers.15.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
489
+ "model.llama_model.model.layers.15.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
490
+ "model.llama_model.model.layers.15.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
491
+ "model.llama_model.model.layers.16.input_layernorm.weight": "model-00002-of-00003.safetensors",
492
+ "model.llama_model.model.layers.16.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
493
+ "model.llama_model.model.layers.16.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
494
+ "model.llama_model.model.layers.16.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
495
+ "model.llama_model.model.layers.16.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
496
+ "model.llama_model.model.layers.16.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
497
+ "model.llama_model.model.layers.16.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
498
+ "model.llama_model.model.layers.16.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
499
+ "model.llama_model.model.layers.16.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
500
+ "model.llama_model.model.layers.16.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
501
+ "model.llama_model.model.layers.17.input_layernorm.weight": "model-00002-of-00003.safetensors",
502
+ "model.llama_model.model.layers.17.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
503
+ "model.llama_model.model.layers.17.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
504
+ "model.llama_model.model.layers.17.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
505
+ "model.llama_model.model.layers.17.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
506
+ "model.llama_model.model.layers.17.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
507
+ "model.llama_model.model.layers.17.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
508
+ "model.llama_model.model.layers.17.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
509
+ "model.llama_model.model.layers.17.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
510
+ "model.llama_model.model.layers.17.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
511
+ "model.llama_model.model.layers.18.input_layernorm.weight": "model-00002-of-00003.safetensors",
512
+ "model.llama_model.model.layers.18.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
513
+ "model.llama_model.model.layers.18.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
514
+ "model.llama_model.model.layers.18.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
515
+ "model.llama_model.model.layers.18.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
516
+ "model.llama_model.model.layers.18.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
517
+ "model.llama_model.model.layers.18.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
518
+ "model.llama_model.model.layers.18.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
519
+ "model.llama_model.model.layers.18.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
520
+ "model.llama_model.model.layers.18.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
521
+ "model.llama_model.model.layers.19.input_layernorm.weight": "model-00002-of-00003.safetensors",
522
+ "model.llama_model.model.layers.19.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
523
+ "model.llama_model.model.layers.19.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
524
+ "model.llama_model.model.layers.19.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
525
+ "model.llama_model.model.layers.19.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
526
+ "model.llama_model.model.layers.19.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
527
+ "model.llama_model.model.layers.19.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
528
+ "model.llama_model.model.layers.19.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
529
+ "model.llama_model.model.layers.19.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
530
+ "model.llama_model.model.layers.19.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
531
+ "model.llama_model.model.layers.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
532
+ "model.llama_model.model.layers.2.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
533
+ "model.llama_model.model.layers.2.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
534
+ "model.llama_model.model.layers.2.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
535
+ "model.llama_model.model.layers.2.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
536
+ "model.llama_model.model.layers.2.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
537
+ "model.llama_model.model.layers.2.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
538
+ "model.llama_model.model.layers.2.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
539
+ "model.llama_model.model.layers.2.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
540
+ "model.llama_model.model.layers.2.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
541
+ "model.llama_model.model.layers.20.input_layernorm.weight": "model-00003-of-00003.safetensors",
542
+ "model.llama_model.model.layers.20.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
543
+ "model.llama_model.model.layers.20.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
544
+ "model.llama_model.model.layers.20.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
545
+ "model.llama_model.model.layers.20.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
546
+ "model.llama_model.model.layers.20.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
547
+ "model.llama_model.model.layers.20.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
548
+ "model.llama_model.model.layers.20.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
549
+ "model.llama_model.model.layers.20.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
550
+ "model.llama_model.model.layers.20.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
551
+ "model.llama_model.model.layers.21.input_layernorm.weight": "model-00003-of-00003.safetensors",
552
+ "model.llama_model.model.layers.21.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
553
+ "model.llama_model.model.layers.21.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
554
+ "model.llama_model.model.layers.21.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
555
+ "model.llama_model.model.layers.21.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
556
+ "model.llama_model.model.layers.21.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
557
+ "model.llama_model.model.layers.21.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
558
+ "model.llama_model.model.layers.21.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
559
+ "model.llama_model.model.layers.21.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
560
+ "model.llama_model.model.layers.21.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
561
+ "model.llama_model.model.layers.22.input_layernorm.weight": "model-00003-of-00003.safetensors",
562
+ "model.llama_model.model.layers.22.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
563
+ "model.llama_model.model.layers.22.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
564
+ "model.llama_model.model.layers.22.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
565
+ "model.llama_model.model.layers.22.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
566
+ "model.llama_model.model.layers.22.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
567
+ "model.llama_model.model.layers.22.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
568
+ "model.llama_model.model.layers.22.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
569
+ "model.llama_model.model.layers.22.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
570
+ "model.llama_model.model.layers.22.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
571
+ "model.llama_model.model.layers.23.input_layernorm.weight": "model-00003-of-00003.safetensors",
572
+ "model.llama_model.model.layers.23.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
573
+ "model.llama_model.model.layers.23.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
574
+ "model.llama_model.model.layers.23.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
575
+ "model.llama_model.model.layers.23.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
576
+ "model.llama_model.model.layers.23.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
577
+ "model.llama_model.model.layers.23.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
578
+ "model.llama_model.model.layers.23.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
579
+ "model.llama_model.model.layers.23.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
580
+ "model.llama_model.model.layers.23.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
581
+ "model.llama_model.model.layers.24.input_layernorm.weight": "model-00003-of-00003.safetensors",
582
+ "model.llama_model.model.layers.24.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
583
+ "model.llama_model.model.layers.24.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
584
+ "model.llama_model.model.layers.24.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
585
+ "model.llama_model.model.layers.24.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
586
+ "model.llama_model.model.layers.24.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
587
+ "model.llama_model.model.layers.24.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
588
+ "model.llama_model.model.layers.24.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
589
+ "model.llama_model.model.layers.24.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
590
+ "model.llama_model.model.layers.24.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
591
+ "model.llama_model.model.layers.25.input_layernorm.weight": "model-00003-of-00003.safetensors",
592
+ "model.llama_model.model.layers.25.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
593
+ "model.llama_model.model.layers.25.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
594
+ "model.llama_model.model.layers.25.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
595
+ "model.llama_model.model.layers.25.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
596
+ "model.llama_model.model.layers.25.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
597
+ "model.llama_model.model.layers.25.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
598
+ "model.llama_model.model.layers.25.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
599
+ "model.llama_model.model.layers.25.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
600
+ "model.llama_model.model.layers.25.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
601
+ "model.llama_model.model.layers.26.input_layernorm.weight": "model-00003-of-00003.safetensors",
602
+ "model.llama_model.model.layers.26.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
603
+ "model.llama_model.model.layers.26.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
604
+ "model.llama_model.model.layers.26.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
605
+ "model.llama_model.model.layers.26.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
606
+ "model.llama_model.model.layers.26.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
607
+ "model.llama_model.model.layers.26.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
608
+ "model.llama_model.model.layers.26.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
609
+ "model.llama_model.model.layers.26.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
610
+ "model.llama_model.model.layers.26.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
611
+ "model.llama_model.model.layers.27.input_layernorm.weight": "model-00003-of-00003.safetensors",
612
+ "model.llama_model.model.layers.27.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
613
+ "model.llama_model.model.layers.27.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
614
+ "model.llama_model.model.layers.27.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
615
+ "model.llama_model.model.layers.27.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
616
+ "model.llama_model.model.layers.27.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
617
+ "model.llama_model.model.layers.27.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
618
+ "model.llama_model.model.layers.27.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
619
+ "model.llama_model.model.layers.27.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
620
+ "model.llama_model.model.layers.27.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
621
+ "model.llama_model.model.layers.28.input_layernorm.weight": "model-00003-of-00003.safetensors",
622
+ "model.llama_model.model.layers.28.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
623
+ "model.llama_model.model.layers.28.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
624
+ "model.llama_model.model.layers.28.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
625
+ "model.llama_model.model.layers.28.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
626
+ "model.llama_model.model.layers.28.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
627
+ "model.llama_model.model.layers.28.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
628
+ "model.llama_model.model.layers.28.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
629
+ "model.llama_model.model.layers.28.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
630
+ "model.llama_model.model.layers.28.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
631
+ "model.llama_model.model.layers.29.input_layernorm.weight": "model-00003-of-00003.safetensors",
632
+ "model.llama_model.model.layers.29.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
633
+ "model.llama_model.model.layers.29.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
634
+ "model.llama_model.model.layers.29.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
635
+ "model.llama_model.model.layers.29.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
636
+ "model.llama_model.model.layers.29.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
637
+ "model.llama_model.model.layers.29.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
638
+ "model.llama_model.model.layers.29.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
639
+ "model.llama_model.model.layers.29.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
640
+ "model.llama_model.model.layers.29.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
641
+ "model.llama_model.model.layers.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
642
+ "model.llama_model.model.layers.3.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
643
+ "model.llama_model.model.layers.3.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
644
+ "model.llama_model.model.layers.3.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
645
+ "model.llama_model.model.layers.3.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
646
+ "model.llama_model.model.layers.3.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
647
+ "model.llama_model.model.layers.3.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
648
+ "model.llama_model.model.layers.3.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
649
+ "model.llama_model.model.layers.3.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
650
+ "model.llama_model.model.layers.3.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
651
+ "model.llama_model.model.layers.30.input_layernorm.weight": "model-00003-of-00003.safetensors",
652
+ "model.llama_model.model.layers.30.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
653
+ "model.llama_model.model.layers.30.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
654
+ "model.llama_model.model.layers.30.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
655
+ "model.llama_model.model.layers.30.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
656
+ "model.llama_model.model.layers.30.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
657
+ "model.llama_model.model.layers.30.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
658
+ "model.llama_model.model.layers.30.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
659
+ "model.llama_model.model.layers.30.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
660
+ "model.llama_model.model.layers.30.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
661
+ "model.llama_model.model.layers.31.input_layernorm.weight": "model-00003-of-00003.safetensors",
662
+ "model.llama_model.model.layers.31.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
663
+ "model.llama_model.model.layers.31.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
664
+ "model.llama_model.model.layers.31.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
665
+ "model.llama_model.model.layers.31.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
666
+ "model.llama_model.model.layers.31.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
667
+ "model.llama_model.model.layers.31.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
668
+ "model.llama_model.model.layers.31.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
669
+ "model.llama_model.model.layers.31.self_attn.rotary_emb.inv_freq": "model-00003-of-00003.safetensors",
670
+ "model.llama_model.model.layers.31.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
671
+ "model.llama_model.model.layers.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
672
+ "model.llama_model.model.layers.4.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
673
+ "model.llama_model.model.layers.4.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
674
+ "model.llama_model.model.layers.4.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
675
+ "model.llama_model.model.layers.4.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
676
+ "model.llama_model.model.layers.4.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
677
+ "model.llama_model.model.layers.4.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
678
+ "model.llama_model.model.layers.4.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
679
+ "model.llama_model.model.layers.4.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
680
+ "model.llama_model.model.layers.4.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
681
+ "model.llama_model.model.layers.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
682
+ "model.llama_model.model.layers.5.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
683
+ "model.llama_model.model.layers.5.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
684
+ "model.llama_model.model.layers.5.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
685
+ "model.llama_model.model.layers.5.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
686
+ "model.llama_model.model.layers.5.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
687
+ "model.llama_model.model.layers.5.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
688
+ "model.llama_model.model.layers.5.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
689
+ "model.llama_model.model.layers.5.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
690
+ "model.llama_model.model.layers.5.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
691
+ "model.llama_model.model.layers.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
692
+ "model.llama_model.model.layers.6.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
693
+ "model.llama_model.model.layers.6.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
694
+ "model.llama_model.model.layers.6.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
695
+ "model.llama_model.model.layers.6.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
696
+ "model.llama_model.model.layers.6.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
697
+ "model.llama_model.model.layers.6.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
698
+ "model.llama_model.model.layers.6.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
699
+ "model.llama_model.model.layers.6.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
700
+ "model.llama_model.model.layers.6.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
701
+ "model.llama_model.model.layers.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
702
+ "model.llama_model.model.layers.7.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
703
+ "model.llama_model.model.layers.7.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
704
+ "model.llama_model.model.layers.7.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
705
+ "model.llama_model.model.layers.7.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
706
+ "model.llama_model.model.layers.7.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
707
+ "model.llama_model.model.layers.7.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
708
+ "model.llama_model.model.layers.7.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
709
+ "model.llama_model.model.layers.7.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
710
+ "model.llama_model.model.layers.7.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
711
+ "model.llama_model.model.layers.8.input_layernorm.weight": "model-00002-of-00003.safetensors",
712
+ "model.llama_model.model.layers.8.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
713
+ "model.llama_model.model.layers.8.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
714
+ "model.llama_model.model.layers.8.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
715
+ "model.llama_model.model.layers.8.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
716
+ "model.llama_model.model.layers.8.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
717
+ "model.llama_model.model.layers.8.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
718
+ "model.llama_model.model.layers.8.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
719
+ "model.llama_model.model.layers.8.self_attn.rotary_emb.inv_freq": "model-00001-of-00003.safetensors",
720
+ "model.llama_model.model.layers.8.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
721
+ "model.llama_model.model.layers.9.input_layernorm.weight": "model-00002-of-00003.safetensors",
722
+ "model.llama_model.model.layers.9.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
723
+ "model.llama_model.model.layers.9.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
724
+ "model.llama_model.model.layers.9.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
725
+ "model.llama_model.model.layers.9.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
726
+ "model.llama_model.model.layers.9.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
727
+ "model.llama_model.model.layers.9.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
728
+ "model.llama_model.model.layers.9.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
729
+ "model.llama_model.model.layers.9.self_attn.rotary_emb.inv_freq": "model-00002-of-00003.safetensors",
730
+ "model.llama_model.model.layers.9.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
731
+ "model.llama_model.model.norm.weight": "model-00003-of-00003.safetensors",
732
+ "model.llama_proj.bias": "model-00003-of-00003.safetensors",
733
+ "model.llama_proj.weight": "model-00003-of-00003.safetensors"
734
+ }
735
+ }
modelling_musilingo.py ADDED
@@ -0,0 +1,1509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import os
3
+ import random
4
+ import math
5
+ import re
6
+ from typing import List, Optional, Tuple, Union
7
+
8
+ from torch.cuda.amp import autocast as autocast
9
+ import torch
10
+ import torch.distributed as dist
11
+ import torch.nn as nn
12
+ import torch.utils.checkpoint
13
+ from torch.nn import CrossEntropyLoss
14
+ from transformers import Wav2Vec2FeatureExtractor
15
+ from omegaconf import OmegaConf
16
+
17
+ from musilingo_huggingface.configuration_musilingo import MusiLingoConfig, PATH
18
+ import timm.models.hub as timm_hub
19
+
20
+
21
+ from transformers import LlamaTokenizer, Wav2Vec2FeatureExtractor, AutoModel
22
+ from transformers.activations import ACT2FN
23
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
24
+ from transformers.modeling_utils import PreTrainedModel
25
+ from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
26
+ from transformers.models.llama.configuration_llama import LlamaConfig
27
+ from transformers import PreTrainedModel
28
+
29
+
30
+
31
+ class Registry:
32
+ mapping = {
33
+ "builder_name_mapping": {},
34
+ "task_name_mapping": {},
35
+ "processor_name_mapping": {},
36
+ "model_name_mapping": {},
37
+ "lr_scheduler_name_mapping": {},
38
+ "runner_name_mapping": {},
39
+ "state": {},
40
+ "paths": {},
41
+ }
42
+
43
+ @classmethod
44
+ def register_builder(cls, name):
45
+ r"""Register a dataset builder to registry with key 'name'
46
+
47
+ Args:
48
+ name: Key with which the builder will be registered.
49
+
50
+ Usage:
51
+
52
+ from lavi.common.registry import registry
53
+ from lavi.datasets.base_dataset_builder import BaseDatasetBuilder
54
+ """
55
+
56
+ def wrap(builder_cls):
57
+ from musilingo.datasets.builders.base_dataset_builder import BaseDatasetBuilder
58
+
59
+ assert issubclass(
60
+ builder_cls, BaseDatasetBuilder
61
+ ), "All builders must inherit BaseDatasetBuilder class, found {}".format(
62
+ builder_cls
63
+ )
64
+ if name in cls.mapping["builder_name_mapping"]:
65
+ raise KeyError(
66
+ "Name '{}' already registered for {}.".format(
67
+ name, cls.mapping["builder_name_mapping"][name]
68
+ )
69
+ )
70
+ cls.mapping["builder_name_mapping"][name] = builder_cls
71
+ return builder_cls
72
+
73
+ return wrap
74
+
75
+ @classmethod
76
+ def register_task(cls, name):
77
+ r"""Register a task to registry with key 'name'
78
+
79
+ Args:
80
+ name: Key with which the task will be registered.
81
+
82
+ Usage:
83
+
84
+ from lavi.common.registry import registry
85
+ """
86
+
87
+ def wrap(task_cls):
88
+ from musilingo.tasks.base_task import BaseTask
89
+
90
+ assert issubclass(
91
+ task_cls, BaseTask
92
+ ), "All tasks must inherit BaseTask class"
93
+ if name in cls.mapping["task_name_mapping"]:
94
+ raise KeyError(
95
+ "Name '{}' already registered for {}.".format(
96
+ name, cls.mapping["task_name_mapping"][name]
97
+ )
98
+ )
99
+ cls.mapping["task_name_mapping"][name] = task_cls
100
+ return task_cls
101
+
102
+ return wrap
103
+
104
+ @classmethod
105
+ def register_model(cls, name):
106
+ r"""Register a task to registry with key 'name'
107
+
108
+ Args:
109
+ name: Key with which the task will be registered.
110
+
111
+ Usage:
112
+
113
+ from lavi.common.registry import registry
114
+ """
115
+
116
+ def wrap(model_cls):
117
+
118
+ assert issubclass(
119
+ model_cls, BaseModel
120
+ ), "All models must inherit BaseModel class"
121
+ if name in cls.mapping["model_name_mapping"]:
122
+ raise KeyError(
123
+ "Name '{}' already registered for {}.".format(
124
+ name, cls.mapping["model_name_mapping"][name]
125
+ )
126
+ )
127
+ cls.mapping["model_name_mapping"][name] = model_cls
128
+ return model_cls
129
+
130
+ return wrap
131
+
132
+ @classmethod
133
+ def register_processor(cls, name):
134
+ r"""Register a processor to registry with key 'name'
135
+
136
+ Args:
137
+ name: Key with which the task will be registered.
138
+
139
+ Usage:
140
+
141
+ from lavi.common.registry import registry
142
+ """
143
+
144
+ def wrap(processor_cls):
145
+ from musilingo.processors import BaseProcessor
146
+
147
+ assert issubclass(
148
+ processor_cls, BaseProcessor
149
+ ), "All processors must inherit BaseProcessor class"
150
+ if name in cls.mapping["processor_name_mapping"]:
151
+ raise KeyError(
152
+ "Name '{}' already registered for {}.".format(
153
+ name, cls.mapping["processor_name_mapping"][name]
154
+ )
155
+ )
156
+ cls.mapping["processor_name_mapping"][name] = processor_cls
157
+ return processor_cls
158
+
159
+ return wrap
160
+
161
+ @classmethod
162
+ def register_lr_scheduler(cls, name):
163
+ r"""Register a model to registry with key 'name'
164
+
165
+ Args:
166
+ name: Key with which the task will be registered.
167
+
168
+ Usage:
169
+
170
+ from minigpt4.common.registry import registry
171
+ """
172
+
173
+ def wrap(lr_sched_cls):
174
+ if name in cls.mapping["lr_scheduler_name_mapping"]:
175
+ raise KeyError(
176
+ "Name '{}' already registered for {}.".format(
177
+ name, cls.mapping["lr_scheduler_name_mapping"][name]
178
+ )
179
+ )
180
+ cls.mapping["lr_scheduler_name_mapping"][name] = lr_sched_cls
181
+ return lr_sched_cls
182
+
183
+ return wrap
184
+
185
+ @classmethod
186
+ def register_runner(cls, name):
187
+ r"""Register a model to registry with key 'name'
188
+
189
+ Args:
190
+ name: Key with which the task will be registered.
191
+
192
+ Usage:
193
+
194
+ from minigpt4.common.registry import registry
195
+ """
196
+
197
+ def wrap(runner_cls):
198
+ if name in cls.mapping["runner_name_mapping"]:
199
+ raise KeyError(
200
+ "Name '{}' already registered for {}.".format(
201
+ name, cls.mapping["runner_name_mapping"][name]
202
+ )
203
+ )
204
+ cls.mapping["runner_name_mapping"][name] = runner_cls
205
+ return runner_cls
206
+
207
+ return wrap
208
+
209
+ @classmethod
210
+ def register_path(cls, name, path):
211
+ r"""Register a path to registry with key 'name'
212
+
213
+ Args:
214
+ name: Key with which the path will be registered.
215
+
216
+ Usage:
217
+
218
+ from minigpt4.common.registry import registry
219
+ """
220
+ assert isinstance(path, str), "All path must be str."
221
+ if name in cls.mapping["paths"]:
222
+ raise KeyError("Name '{}' already registered.".format(name))
223
+ cls.mapping["paths"][name] = path
224
+
225
+ @classmethod
226
+ def register(cls, name, obj):
227
+ r"""Register an item to registry with key 'name'
228
+
229
+ Args:
230
+ name: Key with which the item will be registered.
231
+
232
+ Usage::
233
+
234
+ from minigpt4.common.registry import registry
235
+
236
+ registry.register("config", {})
237
+ """
238
+ path = name.split(".")
239
+ current = cls.mapping["state"]
240
+
241
+ for part in path[:-1]:
242
+ if part not in current:
243
+ current[part] = {}
244
+ current = current[part]
245
+
246
+ current[path[-1]] = obj
247
+
248
+ # @classmethod
249
+ # def get_trainer_class(cls, name):
250
+ # return cls.mapping["trainer_name_mapping"].get(name, None)
251
+
252
+ @classmethod
253
+ def get_builder_class(cls, name):
254
+ return cls.mapping["builder_name_mapping"].get(name, None)
255
+
256
+ @classmethod
257
+ def get_model_class(cls, name):
258
+ return cls.mapping["model_name_mapping"].get(name, None)
259
+
260
+ @classmethod
261
+ def get_task_class(cls, name):
262
+ return cls.mapping["task_name_mapping"].get(name, None)
263
+
264
+ @classmethod
265
+ def get_processor_class(cls, name):
266
+ return cls.mapping["processor_name_mapping"].get(name, None)
267
+
268
+ @classmethod
269
+ def get_lr_scheduler_class(cls, name):
270
+ return cls.mapping["lr_scheduler_name_mapping"].get(name, None)
271
+
272
+ @classmethod
273
+ def get_runner_class(cls, name):
274
+ return cls.mapping["runner_name_mapping"].get(name, None)
275
+
276
+ @classmethod
277
+ def list_runners(cls):
278
+ return sorted(cls.mapping["runner_name_mapping"].keys())
279
+
280
+ @classmethod
281
+ def list_models(cls):
282
+ return sorted(cls.mapping["model_name_mapping"].keys())
283
+
284
+ @classmethod
285
+ def list_tasks(cls):
286
+ return sorted(cls.mapping["task_name_mapping"].keys())
287
+
288
+ @classmethod
289
+ def list_processors(cls):
290
+ return sorted(cls.mapping["processor_name_mapping"].keys())
291
+
292
+ @classmethod
293
+ def list_lr_schedulers(cls):
294
+ return sorted(cls.mapping["lr_scheduler_name_mapping"].keys())
295
+
296
+ @classmethod
297
+ def list_datasets(cls):
298
+ return sorted(cls.mapping["builder_name_mapping"].keys())
299
+
300
+ @classmethod
301
+ def get_path(cls, name):
302
+ return cls.mapping["paths"].get(name, None)
303
+
304
+ @classmethod
305
+ def get(cls, name, default=None, no_warning=False):
306
+ r"""Get an item from registry with key 'name'
307
+
308
+ Args:
309
+ name (string): Key whose value needs to be retrieved.
310
+ default: If passed and key is not in registry, default value will
311
+ be returned with a warning. Default: None
312
+ no_warning (bool): If passed as True, warning when key doesn't exist
313
+ will not be generated. Useful for MMF's
314
+ internal operations. Default: False
315
+ """
316
+ original_name = name
317
+ name = name.split(".")
318
+ value = cls.mapping["state"]
319
+ for subname in name:
320
+ value = value.get(subname, default)
321
+ if value is default:
322
+ break
323
+
324
+ if (
325
+ "writer" in cls.mapping["state"]
326
+ and value == default
327
+ and no_warning is False
328
+ ):
329
+ cls.mapping["state"]["writer"].warning(
330
+ "Key {} is not present in registry, returning default value "
331
+ "of {}".format(original_name, default)
332
+ )
333
+ return value
334
+
335
+ @classmethod
336
+ def unregister(cls, name):
337
+ r"""Remove an item from registry with key 'name'
338
+
339
+ Args:
340
+ name: Key which needs to be removed.
341
+ Usage::
342
+
343
+ from mmf.common.registry import registry
344
+
345
+ config = registry.unregister("config")
346
+ """
347
+ return cls.mapping["state"].pop(name, None)
348
+
349
+
350
+ registry = Registry()
351
+
352
+
353
+ def get_abs_path(rel_path):
354
+ return os.path.join(registry.get_path("library_root"), rel_path)
355
+
356
+ def is_url(input_url):
357
+ """
358
+ Check if an input string is a url. look for http(s):// and ignoring the case
359
+ """
360
+ is_url = re.match(r"^(?:http)s?://", input_url, re.IGNORECASE) is not None
361
+ return is_url
362
+
363
+
364
+ def download_cached_file(url, check_hash=True, progress=False):
365
+ """
366
+ Download a file from a URL and cache it locally. If the file already exists, it is not downloaded again.
367
+ If distributed, only the main process downloads the file, and the other processes wait for the file to be downloaded.
368
+ """
369
+
370
+ def get_cached_file_path():
371
+ # a hack to sync the file path across processes
372
+ parts = torch.hub.urlparse(url)
373
+ filename = os.path.basename(parts.path)
374
+ cached_file = os.path.join(timm_hub.get_cache_dir(), filename)
375
+
376
+ return cached_file
377
+
378
+ if is_main_process():
379
+ timm_hub.download_cached_file(url, check_hash, progress)
380
+
381
+ if is_dist_avail_and_initialized():
382
+ dist.barrier()
383
+
384
+ return get_cached_file_path()
385
+
386
+ def is_dist_avail_and_initialized():
387
+ if not dist.is_available():
388
+ return False
389
+ if not dist.is_initialized():
390
+ return False
391
+ return True
392
+
393
+ def is_main_process():
394
+ return get_rank() == 0
395
+
396
+ def get_rank():
397
+ if not is_dist_avail_and_initialized():
398
+ return 0
399
+ return dist.get_rank()
400
+
401
+ class BaseModel(nn.Module):
402
+ """Base class for models."""
403
+
404
+ def __init__(self):
405
+ super().__init__()
406
+
407
+ @property
408
+ def device(self):
409
+ return list(self.parameters())[0].device
410
+
411
+ def load_checkpoint(self, url_or_filename):
412
+ """
413
+ Load from a finetuned checkpoint.
414
+
415
+ This should expect no mismatch in the model keys and the checkpoint keys.
416
+ """
417
+
418
+ if is_url(url_or_filename):
419
+ cached_file = download_cached_file(
420
+ url_or_filename, check_hash=False, progress=True
421
+ )
422
+ checkpoint = torch.load(cached_file, map_location="cpu")
423
+ elif os.path.isfile(url_or_filename):
424
+ checkpoint = torch.load(url_or_filename, map_location="cpu")
425
+ else:
426
+ raise RuntimeError("checkpoint url or path is invalid")
427
+
428
+ if "model" in checkpoint.keys():
429
+ state_dict = checkpoint["model"]
430
+ else:
431
+ state_dict = checkpoint
432
+
433
+ msg = self.load_state_dict(state_dict, strict=False)
434
+
435
+ logging.info("Missing keys {}".format(msg.missing_keys))
436
+ logging.info("load checkpoint from %s" % url_or_filename)
437
+
438
+ return msg
439
+
440
+ @classmethod
441
+ def from_pretrained(cls, model_type):
442
+ """
443
+ Build a pretrained model from default configuration file, specified by model_type.
444
+
445
+ Args:
446
+ - model_type (str): model type, specifying architecture and checkpoints.
447
+
448
+ Returns:
449
+ - model (nn.Module): pretrained or finetuned model, depending on the configuration.
450
+ """
451
+ model_cfg = OmegaConf.load(cls.default_config_path(model_type)).model
452
+ model = cls.from_config(model_cfg)
453
+
454
+ return model
455
+
456
+ @classmethod
457
+ def default_config_path(cls, model_type):
458
+ assert (
459
+ model_type in cls.PRETRAINED_MODEL_CONFIG_DICT
460
+ ), "Unknown model type {}".format(model_type)
461
+ return get_abs_path(cls.PRETRAINED_MODEL_CONFIG_DICT[model_type])
462
+
463
+ def load_checkpoint_from_config(self, cfg, **kwargs):
464
+ """
465
+ Load checkpoint as specified in the config file.
466
+
467
+ If load_finetuned is True, load the finetuned model; otherwise, load the pretrained model.
468
+ When loading the pretrained model, each task-specific architecture may define their
469
+ own load_from_pretrained() method.
470
+ """
471
+ load_finetuned = cfg.get("load_finetuned", True)
472
+ if load_finetuned:
473
+ finetune_path = cfg.get("finetuned", None)
474
+ assert (
475
+ finetune_path is not None
476
+ ), "Found load_finetuned is True, but finetune_path is None."
477
+ self.load_checkpoint(url_or_filename=finetune_path)
478
+ else:
479
+ # load pre-trained weights
480
+ pretrain_path = cfg.get("pretrained", None)
481
+ assert "Found load_finetuned is False, but pretrain_path is None."
482
+ self.load_from_pretrained(url_or_filename=pretrain_path, **kwargs)
483
+
484
+ def before_evaluation(self, **kwargs):
485
+ pass
486
+
487
+ def show_n_params(self, return_str=True):
488
+ tot = 0
489
+ for p in self.parameters():
490
+ w = 1
491
+ for x in p.shape:
492
+ w *= x
493
+ tot += w
494
+ if return_str:
495
+ if tot >= 1e6:
496
+ return "{:.1f}M".format(tot / 1e6)
497
+ else:
498
+ return "{:.1f}K".format(tot / 1e3)
499
+ else:
500
+ return tot
501
+
502
+ LLAMA_INPUTS_DOCSTRING = r"""
503
+ Args:
504
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
505
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
506
+ it.
507
+
508
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
509
+ [`PreTrainedTokenizer.__call__`] for details.
510
+
511
+ [What are input IDs?](../glossary#input-ids)
512
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
513
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
514
+
515
+ - 1 for tokens that are **not masked**,
516
+ - 0 for tokens that are **masked**.
517
+
518
+ [What are attention masks?](../glossary#attention-mask)
519
+
520
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
521
+ [`PreTrainedTokenizer.__call__`] for details.
522
+
523
+ If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
524
+ `past_key_values`).
525
+
526
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
527
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
528
+ information on the default strategy.
529
+
530
+ - 1 indicates the head is **not masked**,
531
+ - 0 indicates the head is **masked**.
532
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
533
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
534
+ config.n_positions - 1]`.
535
+
536
+ [What are position IDs?](../glossary#position-ids)
537
+ past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
538
+ Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
539
+ `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
540
+ `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.
541
+
542
+ Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
543
+ blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
544
+
545
+ If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those that
546
+ don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of all
547
+ `decoder_input_ids` of shape `(batch_size, sequence_length)`.
548
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
549
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
550
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
551
+ model's internal embedding lookup matrix.
552
+ use_cache (`bool`, *optional*):
553
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
554
+ `past_key_values`).
555
+ output_attentions (`bool`, *optional*):
556
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
557
+ tensors for more detail.
558
+ output_hidden_states (`bool`, *optional*):
559
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
560
+ more detail.
561
+ return_dict (`bool`, *optional*):
562
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
563
+ """
564
+
565
+
566
+ LLAMA_START_DOCSTRING = r"""
567
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
568
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
569
+ etc.)
570
+
571
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
572
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
573
+ and behavior.
574
+
575
+ Parameters:
576
+ config ([`LlamaConfig`]):
577
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
578
+ load the weights associated with the model, only the configuration. Check out the
579
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
580
+ """
581
+
582
+
583
+ logger = logging.get_logger(__name__)
584
+
585
+ _CONFIG_FOR_DOC = "LlamaConfig"
586
+
587
+
588
+ # Copied from transformers.models.bart.modeling_bart._make_causal_mask
589
+ def _make_causal_mask(
590
+ input_ids_shape: torch.Size, dtype: torch.dtype, device: torch.device, past_key_values_length: int = 0
591
+ ):
592
+ """
593
+ Make causal mask used for bi-directional self-attention.
594
+ """
595
+ bsz, tgt_len = input_ids_shape
596
+ mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min, device=device), device=device)
597
+ mask_cond = torch.arange(mask.size(-1), device=device)
598
+ mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
599
+ mask = mask.to(dtype)
600
+
601
+ if past_key_values_length > 0:
602
+ mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype, device=device), mask], dim=-1)
603
+ return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len + past_key_values_length)
604
+
605
+
606
+ # Copied from transformers.models.bart.modeling_bart._expand_mask
607
+ def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
608
+ """
609
+ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
610
+ """
611
+ bsz, src_len = mask.size()
612
+ tgt_len = tgt_len if tgt_len is not None else src_len
613
+
614
+ expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
615
+
616
+ inverted_mask = 1.0 - expanded_mask
617
+
618
+ return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min)
619
+
620
+
621
+ class LlamaRMSNorm(nn.Module):
622
+ def __init__(self, hidden_size, eps=1e-6):
623
+ """
624
+ LlamaRMSNorm is equivalent to T5LayerNorm
625
+ """
626
+ super().__init__()
627
+ self.weight = nn.Parameter(torch.ones(hidden_size))
628
+ self.variance_epsilon = eps
629
+
630
+ def forward(self, hidden_states):
631
+ variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True)
632
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
633
+
634
+ # convert into half-precision if necessary
635
+ if self.weight.dtype in [torch.float16, torch.bfloat16]:
636
+ hidden_states = hidden_states.to(self.weight.dtype)
637
+
638
+ return self.weight * hidden_states
639
+
640
+
641
+ class LlamaRotaryEmbedding(torch.nn.Module):
642
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
643
+ super().__init__()
644
+ inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float().to(device) / dim))
645
+ self.register_buffer("inv_freq", inv_freq)
646
+
647
+ # Build here to make `torch.jit.trace` work.
648
+ self.max_seq_len_cached = max_position_embeddings
649
+ t = torch.arange(self.max_seq_len_cached, device=self.inv_freq.device, dtype=self.inv_freq.dtype)
650
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
651
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
652
+ emb = torch.cat((freqs, freqs), dim=-1)
653
+ self.register_buffer("cos_cached", emb.cos()[None, None, :, :], persistent=False)
654
+ self.register_buffer("sin_cached", emb.sin()[None, None, :, :], persistent=False)
655
+
656
+ def forward(self, x, seq_len=None):
657
+ # x: [bs, num_attention_heads, seq_len, head_size]
658
+ # This `if` block is unlikely to be run after we build sin/cos in `__init__`. Keep the logic here just in case.
659
+ if seq_len > self.max_seq_len_cached:
660
+ self.max_seq_len_cached = seq_len
661
+ t = torch.arange(self.max_seq_len_cached, device=x.device, dtype=self.inv_freq.dtype)
662
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
663
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
664
+ emb = torch.cat((freqs, freqs), dim=-1).to(x.device)
665
+ self.register_buffer("cos_cached", emb.cos()[None, None, :, :], persistent=False)
666
+ self.register_buffer("sin_cached", emb.sin()[None, None, :, :], persistent=False)
667
+ return (
668
+ self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
669
+ self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
670
+ )
671
+
672
+
673
+ def rotate_half(x):
674
+ """Rotates half the hidden dims of the input."""
675
+ x1 = x[..., : x.shape[-1] // 2]
676
+ x2 = x[..., x.shape[-1] // 2 :]
677
+ return torch.cat((-x2, x1), dim=-1)
678
+
679
+
680
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
681
+ gather_indices = position_ids[:, None, :, None] # [bs, 1, seq_len, 1]
682
+ gather_indices = gather_indices.repeat(1, cos.shape[1], 1, cos.shape[3])
683
+ cos = torch.gather(cos.repeat(gather_indices.shape[0], 1, 1, 1), 2, gather_indices)
684
+ sin = torch.gather(sin.repeat(gather_indices.shape[0], 1, 1, 1), 2, gather_indices)
685
+ q_embed = (q * cos) + (rotate_half(q) * sin)
686
+ k_embed = (k * cos) + (rotate_half(k) * sin)
687
+ return q_embed, k_embed
688
+
689
+
690
+
691
+
692
+ class LlamaMLP(nn.Module):
693
+ def __init__(
694
+ self,
695
+ hidden_size: int,
696
+ intermediate_size: int,
697
+ hidden_act: str,
698
+ ):
699
+ super().__init__()
700
+ self.gate_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
701
+ self.down_proj = nn.Linear(intermediate_size, hidden_size, bias=False)
702
+ self.up_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
703
+ self.act_fn = ACT2FN[hidden_act]
704
+
705
+ def forward(self, x):
706
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
707
+
708
+
709
+ class LlamaAttention(nn.Module):
710
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
711
+
712
+ def __init__(self, config: LlamaConfig):
713
+ super().__init__()
714
+ self.config = config
715
+ self.hidden_size = config.hidden_size
716
+ self.num_heads = config.num_attention_heads
717
+ self.head_dim = self.hidden_size // self.num_heads
718
+ self.max_position_embeddings = config.max_position_embeddings
719
+
720
+ if (self.head_dim * self.num_heads) != self.hidden_size:
721
+ raise ValueError(
722
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
723
+ f" and `num_heads`: {self.num_heads})."
724
+ )
725
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
726
+ self.k_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
727
+ self.v_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
728
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
729
+ self.rotary_emb = LlamaRotaryEmbedding(self.head_dim, max_position_embeddings=self.max_position_embeddings)
730
+
731
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
732
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
733
+
734
+ def forward(
735
+ self,
736
+ hidden_states: torch.Tensor,
737
+ attention_mask: Optional[torch.Tensor] = None,
738
+ position_ids: Optional[torch.LongTensor] = None,
739
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
740
+ output_attentions: bool = False,
741
+ use_cache: bool = False,
742
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
743
+ bsz, q_len, _ = hidden_states.size()
744
+
745
+ query_states = self.q_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
746
+ key_states = self.k_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
747
+ value_states = self.v_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
748
+
749
+ kv_seq_len = key_states.shape[-2]
750
+ if past_key_value is not None:
751
+ kv_seq_len += past_key_value[0].shape[-2]
752
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
753
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
754
+ # [bsz, nh, t, hd]
755
+
756
+ if past_key_value is not None:
757
+ # reuse k, v, self_attention
758
+ key_states = torch.cat([past_key_value[0], key_states], dim=2)
759
+ value_states = torch.cat([past_key_value[1], value_states], dim=2)
760
+
761
+ past_key_value = (key_states, value_states) if use_cache else None
762
+
763
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
764
+
765
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
766
+ raise ValueError(
767
+ f"Attention weights should be of size {(bsz * self.num_heads, q_len, kv_seq_len)}, but is"
768
+ f" {attn_weights.size()}"
769
+ )
770
+
771
+ if attention_mask is not None:
772
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
773
+ raise ValueError(
774
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
775
+ )
776
+ attn_weights = attn_weights + attention_mask
777
+ attn_weights = torch.max(attn_weights, torch.tensor(torch.finfo(attn_weights.dtype).min))
778
+
779
+ # upcast attention to fp32
780
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
781
+ attn_output = torch.matmul(attn_weights, value_states)
782
+
783
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
784
+ raise ValueError(
785
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
786
+ f" {attn_output.size()}"
787
+ )
788
+
789
+ attn_output = attn_output.transpose(1, 2)
790
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
791
+
792
+ attn_output = self.o_proj(attn_output)
793
+
794
+ if not output_attentions:
795
+ attn_weights = None
796
+
797
+ return attn_output, attn_weights, past_key_value
798
+
799
+
800
+
801
+ class LlamaDecoderLayer(nn.Module):
802
+ def __init__(self, config: LlamaConfig):
803
+ super().__init__()
804
+ self.hidden_size = config.hidden_size
805
+ self.self_attn = LlamaAttention(config=config)
806
+ self.mlp = LlamaMLP(
807
+ hidden_size=self.hidden_size,
808
+ intermediate_size=config.intermediate_size,
809
+ hidden_act=config.hidden_act,
810
+ )
811
+ self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
812
+ self.post_attention_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
813
+
814
+ def forward(
815
+ self,
816
+ hidden_states: torch.Tensor,
817
+ attention_mask: Optional[torch.Tensor] = None,
818
+ position_ids: Optional[torch.LongTensor] = None,
819
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
820
+ output_attentions: Optional[bool] = False,
821
+ use_cache: Optional[bool] = False,
822
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
823
+ """
824
+ Args:
825
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
826
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
827
+ `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
828
+ output_attentions (`bool`, *optional*):
829
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
830
+ returned tensors for more detail.
831
+ use_cache (`bool`, *optional*):
832
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
833
+ (see `past_key_values`).
834
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
835
+ """
836
+
837
+ residual = hidden_states
838
+
839
+ hidden_states = self.input_layernorm(hidden_states)
840
+
841
+ # Self Attention
842
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
843
+ hidden_states=hidden_states,
844
+ attention_mask=attention_mask,
845
+ position_ids=position_ids,
846
+ past_key_value=past_key_value,
847
+ output_attentions=output_attentions,
848
+ use_cache=use_cache,
849
+ )
850
+ hidden_states = residual + hidden_states
851
+
852
+ # Fully Connected
853
+ residual = hidden_states
854
+ hidden_states = self.post_attention_layernorm(hidden_states)
855
+ hidden_states = self.mlp(hidden_states)
856
+ hidden_states = residual + hidden_states
857
+
858
+ outputs = (hidden_states,)
859
+
860
+ if output_attentions:
861
+ outputs += (self_attn_weights,)
862
+
863
+ if use_cache:
864
+ outputs += (present_key_value,)
865
+
866
+ return outputs
867
+
868
+
869
+ @add_start_docstrings(
870
+ "The bare LLaMA Model outputting raw hidden-states without any specific head on top.",
871
+ LLAMA_START_DOCSTRING,
872
+ )
873
+ class LlamaPreTrainedModel(PreTrainedModel):
874
+ config_class = LlamaConfig
875
+ base_model_prefix = "model"
876
+ supports_gradient_checkpointing = True
877
+ _no_split_modules = ["LlamaDecoderLayer"]
878
+ _keys_to_ignore_on_load_unexpected = [r"decoder\.version"]
879
+
880
+ def _init_weights(self, module):
881
+ std = self.config.initializer_range
882
+ if isinstance(module, nn.Linear):
883
+ module.weight.data.normal_(mean=0.0, std=std)
884
+ if module.bias is not None:
885
+ module.bias.data.zero_()
886
+ elif isinstance(module, nn.Embedding):
887
+ module.weight.data.normal_(mean=0.0, std=std)
888
+ if module.padding_idx is not None:
889
+ module.weight.data[module.padding_idx].zero_()
890
+
891
+ def _set_gradient_checkpointing(self, module, value=False):
892
+ if isinstance(module, LlamaModel):
893
+ module.gradient_checkpointing = value
894
+
895
+
896
+ @add_start_docstrings(
897
+ "The bare LLaMA Model outputting raw hidden-states without any specific head on top.",
898
+ LLAMA_START_DOCSTRING,
899
+ )
900
+ class LlamaModel(LlamaPreTrainedModel):
901
+ """
902
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`LlamaDecoderLayer`]
903
+
904
+ Args:
905
+ config: LlamaConfig
906
+ """
907
+
908
+ def __init__(self, config: LlamaConfig):
909
+ super().__init__(config)
910
+ self.padding_idx = config.pad_token_id
911
+ self.vocab_size = config.vocab_size
912
+
913
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
914
+ self.layers = nn.ModuleList([LlamaDecoderLayer(config) for _ in range(config.num_hidden_layers)])
915
+ self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
916
+
917
+ self.gradient_checkpointing = False
918
+ # Initialize weights and apply final processing
919
+ self.post_init()
920
+
921
+ def get_input_embeddings(self):
922
+ return self.embed_tokens
923
+
924
+ def set_input_embeddings(self, value):
925
+ self.embed_tokens = value
926
+
927
+ # Copied from transformers.models.bart.modeling_bart.BartDecoder._prepare_decoder_attention_mask
928
+ def _prepare_decoder_attention_mask(self, attention_mask, input_shape, inputs_embeds, past_key_values_length):
929
+ # create causal mask
930
+ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
931
+ combined_attention_mask = None
932
+ if input_shape[-1] > 1:
933
+ combined_attention_mask = _make_causal_mask(
934
+ input_shape,
935
+ inputs_embeds.dtype,
936
+ device=inputs_embeds.device,
937
+ past_key_values_length=past_key_values_length,
938
+ )
939
+
940
+ if attention_mask is not None:
941
+ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
942
+ expanded_attn_mask = _expand_mask(attention_mask, inputs_embeds.dtype, tgt_len=input_shape[-1]).to(
943
+ inputs_embeds.device
944
+ )
945
+ combined_attention_mask = (
946
+ expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask + combined_attention_mask
947
+ )
948
+
949
+ return combined_attention_mask
950
+
951
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
952
+ def forward(
953
+ self,
954
+ input_ids: torch.LongTensor = None,
955
+ attention_mask: Optional[torch.Tensor] = None,
956
+ position_ids: Optional[torch.LongTensor] = None,
957
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
958
+ inputs_embeds: Optional[torch.FloatTensor] = None,
959
+ query_embeds: Optional[torch.FloatTensor] = None,
960
+ use_cache: Optional[bool] = None,
961
+ output_attentions: Optional[bool] = None,
962
+ output_hidden_states: Optional[bool] = None,
963
+ return_dict: Optional[bool] = None,
964
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
965
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
966
+ output_hidden_states = (
967
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
968
+ )
969
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
970
+
971
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
972
+
973
+ # retrieve input_ids and inputs_embeds
974
+ if input_ids is not None and inputs_embeds is not None:
975
+ raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
976
+ elif input_ids is not None:
977
+ batch_size, seq_length = input_ids.shape
978
+ elif inputs_embeds is not None:
979
+ batch_size, seq_length, _ = inputs_embeds.shape
980
+ else:
981
+ raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
982
+
983
+ if inputs_embeds is None:
984
+ inputs_embeds = self.embed_tokens(input_ids)
985
+ if query_embeds is not None:
986
+ inputs_embeds = torch.cat([query_embeds, inputs_embeds], dim=1)
987
+ batch_size, seq_length, _ = inputs_embeds.shape
988
+
989
+ seq_length_with_past = seq_length
990
+ past_key_values_length = 0
991
+
992
+ if past_key_values is not None:
993
+ past_key_values_length = past_key_values[0][0].shape[2]
994
+ seq_length_with_past = seq_length_with_past + past_key_values_length
995
+
996
+ if position_ids is None:
997
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
998
+ position_ids = torch.arange(
999
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
1000
+ )
1001
+ position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
1002
+ else:
1003
+ position_ids = position_ids.view(-1, seq_length).long()
1004
+
1005
+ # embed positions
1006
+ if attention_mask is None:
1007
+ attention_mask = torch.ones(
1008
+ (batch_size, seq_length_with_past), dtype=torch.bool, device=inputs_embeds.device
1009
+ )
1010
+ attention_mask = self._prepare_decoder_attention_mask(
1011
+ attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length
1012
+ )
1013
+
1014
+ hidden_states = inputs_embeds
1015
+
1016
+ if self.gradient_checkpointing and self.training:
1017
+ if use_cache:
1018
+ logger.warning_once(
1019
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
1020
+ )
1021
+ use_cache = False
1022
+
1023
+ # decoder layers
1024
+ all_hidden_states = () if output_hidden_states else None
1025
+ all_self_attns = () if output_attentions else None
1026
+ next_decoder_cache = () if use_cache else None
1027
+
1028
+ for idx, decoder_layer in enumerate(self.layers):
1029
+ if output_hidden_states:
1030
+ all_hidden_states += (hidden_states,)
1031
+
1032
+ past_key_value = past_key_values[idx] if past_key_values is not None else None
1033
+
1034
+ if self.gradient_checkpointing and self.training:
1035
+
1036
+ def create_custom_forward(module):
1037
+ def custom_forward(*inputs):
1038
+ # None for past_key_value
1039
+ return module(*inputs, output_attentions, None)
1040
+
1041
+ return custom_forward
1042
+
1043
+ layer_outputs = torch.utils.checkpoint.checkpoint(
1044
+ create_custom_forward(decoder_layer),
1045
+ hidden_states,
1046
+ attention_mask,
1047
+ position_ids,
1048
+ None,
1049
+ )
1050
+ else:
1051
+ layer_outputs = decoder_layer(
1052
+ hidden_states,
1053
+ attention_mask=attention_mask,
1054
+ position_ids=position_ids,
1055
+ past_key_value=past_key_value,
1056
+ output_attentions=output_attentions,
1057
+ use_cache=use_cache,
1058
+ )
1059
+
1060
+ hidden_states = layer_outputs[0]
1061
+
1062
+ if use_cache:
1063
+ next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
1064
+
1065
+ if output_attentions:
1066
+ all_self_attns += (layer_outputs[1],)
1067
+
1068
+ hidden_states = self.norm(hidden_states)
1069
+
1070
+ # add hidden states from the last decoder layer
1071
+ if output_hidden_states:
1072
+ all_hidden_states += (hidden_states,)
1073
+
1074
+ next_cache = next_decoder_cache if use_cache else None
1075
+ if not return_dict:
1076
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
1077
+ return BaseModelOutputWithPast(
1078
+ last_hidden_state=hidden_states,
1079
+ past_key_values=next_cache,
1080
+ hidden_states=all_hidden_states,
1081
+ attentions=all_self_attns,
1082
+ )
1083
+
1084
+
1085
+
1086
+ class LlamaForCausalLM(LlamaPreTrainedModel):
1087
+ def __init__(self, config):
1088
+ super().__init__(config)
1089
+ self.model = LlamaModel(config)
1090
+
1091
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1092
+
1093
+ # Initialize weights and apply final processing
1094
+ self.post_init()
1095
+
1096
+ def get_input_embeddings(self):
1097
+ return self.model.embed_tokens
1098
+
1099
+ def set_input_embeddings(self, value):
1100
+ self.model.embed_tokens = value
1101
+
1102
+ def get_output_embeddings(self):
1103
+ return self.lm_head
1104
+
1105
+ def set_output_embeddings(self, new_embeddings):
1106
+ self.lm_head = new_embeddings
1107
+
1108
+ def set_decoder(self, decoder):
1109
+ self.model = decoder
1110
+
1111
+ def get_decoder(self):
1112
+ return self.model
1113
+
1114
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
1115
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1116
+ def forward(
1117
+ self,
1118
+ input_ids: torch.LongTensor = None,
1119
+ attention_mask: Optional[torch.Tensor] = None,
1120
+ position_ids: Optional[torch.LongTensor] = None,
1121
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1122
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1123
+ query_embeds: Optional[torch.FloatTensor] = None,
1124
+ labels: Optional[torch.LongTensor] = None,
1125
+ use_cache: Optional[bool] = None,
1126
+ output_attentions: Optional[bool] = None,
1127
+ output_hidden_states: Optional[bool] = None,
1128
+ return_dict: Optional[bool] = None,
1129
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1130
+ r"""
1131
+ Args:
1132
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1133
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1134
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1135
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1136
+
1137
+ Returns:
1138
+
1139
+ Example:
1140
+
1141
+ ```python
1142
+ >>> from transformers import AutoTokenizer, LlamaForCausalLM
1143
+
1144
+ >>> model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
1145
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
1146
+
1147
+ >>> prompt = "Hey, are you consciours? Can you talk to me?"
1148
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1149
+
1150
+ >>> # Generate
1151
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1152
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1153
+ "Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."
1154
+ ```"""
1155
+
1156
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1157
+ output_hidden_states = (
1158
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1159
+ )
1160
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1161
+
1162
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1163
+ outputs = self.model(
1164
+ input_ids=input_ids,
1165
+ attention_mask=attention_mask,
1166
+ position_ids=position_ids,
1167
+ past_key_values=past_key_values,
1168
+ inputs_embeds=inputs_embeds,
1169
+ query_embeds=query_embeds,
1170
+ use_cache=use_cache,
1171
+ output_attentions=output_attentions,
1172
+ output_hidden_states=output_hidden_states,
1173
+ return_dict=return_dict,
1174
+ )
1175
+
1176
+ hidden_states = outputs[0]
1177
+ logits = self.lm_head(hidden_states)
1178
+
1179
+ loss = None
1180
+ if labels is not None:
1181
+ # Shift so that tokens < n predict n
1182
+ shift_logits = logits[..., :-1, :].contiguous()
1183
+ shift_labels = labels[..., 1:].contiguous()
1184
+ # Flatten the tokens
1185
+ loss_fct = CrossEntropyLoss()
1186
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1187
+ shift_labels = shift_labels.view(-1)
1188
+ # Enable model parallelism
1189
+ shift_labels = shift_labels.to(shift_logits.device)
1190
+ loss = loss_fct(shift_logits, shift_labels)
1191
+
1192
+ if not return_dict:
1193
+ output = (logits,) + outputs[1:]
1194
+ return (loss,) + output if loss is not None else output
1195
+
1196
+ return CausalLMOutputWithPast(
1197
+ loss=loss,
1198
+ logits=logits,
1199
+ past_key_values=outputs.past_key_values,
1200
+ hidden_states=outputs.hidden_states,
1201
+ attentions=outputs.attentions,
1202
+ )
1203
+
1204
+ def prepare_inputs_for_generation(
1205
+ self, input_ids, query_embeds=None, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
1206
+ ):
1207
+ if past_key_values:
1208
+ input_ids = input_ids[:, -1:]
1209
+
1210
+ position_ids = kwargs.get("position_ids", None)
1211
+ if attention_mask is not None and position_ids is None:
1212
+ # create position_ids on the fly for batch generation
1213
+ position_ids = attention_mask.long().cumsum(-1) - 1
1214
+ position_ids.masked_fill_(attention_mask == 0, 1)
1215
+ if past_key_values:
1216
+ position_ids = position_ids[:, -1].unsqueeze(-1)
1217
+ query_embeds = None
1218
+
1219
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1220
+ if inputs_embeds is not None and past_key_values is None:
1221
+ model_inputs = {"inputs_embeds": inputs_embeds}
1222
+ else:
1223
+ model_inputs = {"input_ids": input_ids}
1224
+
1225
+ model_inputs.update(
1226
+ {
1227
+ "position_ids": position_ids,
1228
+ "query_embeds": query_embeds,
1229
+ "past_key_values": past_key_values,
1230
+ "use_cache": kwargs.get("use_cache"),
1231
+ "attention_mask": attention_mask,
1232
+ }
1233
+ )
1234
+ return model_inputs
1235
+
1236
+ @staticmethod
1237
+ def _reorder_cache(past_key_values, beam_idx):
1238
+ reordered_past = ()
1239
+ for layer_past in past_key_values:
1240
+ reordered_past += (tuple(past_state.index_select(0, beam_idx) for past_state in layer_past),)
1241
+ return reordered_past
1242
+
1243
+
1244
+ @registry.register_model("musilingo")
1245
+ class MusiLingo(BaseModel):
1246
+ """
1247
+ MERT GPT-LLAMA model.
1248
+ """
1249
+
1250
+ PRETRAINED_MODEL_CONFIG_DICT = {
1251
+ "pretrain_vicuna": "configs/models/musilingo.yaml",
1252
+ }
1253
+
1254
+ def __init__(
1255
+ self,
1256
+ mert_model,
1257
+ llama_model,
1258
+ prompt_path="",
1259
+ prompt_template="",
1260
+ max_txt_len=32,
1261
+ end_sym='\n',
1262
+ low_resource=False, # use 8 bit and put vit in cpu
1263
+ device_8bit=0, # the device of 8bit model should be set when loading and cannot be changed anymore.
1264
+ ):
1265
+ super().__init__()
1266
+
1267
+ self.low_resource = low_resource
1268
+
1269
+ print('Loading Audio Encoder')
1270
+ self.audio_encoder = AutoModel.from_pretrained(mert_model, trust_remote_code=True)
1271
+ # loading the corresponding preprocessor config
1272
+ self.processor = Wav2Vec2FeatureExtractor.from_pretrained(mert_model, trust_remote_code=True)
1273
+
1274
+ for name, param in self.audio_encoder.named_parameters():
1275
+ param.requires_grad = False
1276
+ self.audio_encoder = self.audio_encoder.eval()
1277
+
1278
+ print('Loading Audio Encoder Done')
1279
+
1280
+ print('Loading LLAMA')
1281
+ self.llama_tokenizer = LlamaTokenizer.from_pretrained(llama_model, use_fast=False)
1282
+ self.llama_tokenizer.pad_token = self.llama_tokenizer.eos_token
1283
+
1284
+ if self.low_resource:
1285
+ self.llama_model = LlamaForCausalLM.from_pretrained(
1286
+ llama_model,
1287
+ torch_dtype=torch.float16,
1288
+ load_in_8bit=True,
1289
+ device_map={'': device_8bit}
1290
+ )
1291
+ else:
1292
+ self.llama_model = LlamaForCausalLM.from_pretrained(
1293
+ llama_model,
1294
+ torch_dtype=torch.float16,
1295
+ )
1296
+
1297
+ for name, param in self.llama_model.named_parameters():
1298
+ param.requires_grad = False
1299
+ print('Loading LLAMA Done')
1300
+
1301
+ self.llama_proj = nn.Linear(
1302
+ self.audio_encoder.config.hidden_size, self.llama_model.config.hidden_size
1303
+ )
1304
+ self.max_txt_len = max_txt_len
1305
+ self.end_sym = end_sym
1306
+
1307
+ self.prompt_template = prompt_template
1308
+
1309
+ if prompt_path:
1310
+ with open(prompt_path, 'r') as f:
1311
+ raw_prompts = f.read().splitlines()
1312
+ filted_prompts = [raw_prompt for raw_prompt in raw_prompts if "<AudioHere>" in raw_prompt]
1313
+ self.prompt_list = [prompt_template.format(p) for p in filted_prompts]
1314
+ print('Load {} training prompts'.format(len(self.prompt_list)))
1315
+ print('Prompt Example \n{}'.format(random.choice(self.prompt_list)))
1316
+ else:
1317
+ self.prompt_list = []
1318
+
1319
+ def audioenc_to_cpu(self):
1320
+ self.audio_encoder.to("cpu")
1321
+ self.audio_encoder.float()
1322
+
1323
+ def encode_audio(self, audio, attn=None):
1324
+ device = audio.device
1325
+ if self.low_resource:
1326
+ self.audioenc_to_cpu()
1327
+ audio = audio.to("cpu")
1328
+
1329
+ if attn is None:
1330
+
1331
+ audio_embeds = torch.stack(self.audio_encoder(input_values=audio,
1332
+ output_hidden_states=True).hidden_states) # [25, B, T, 1024]
1333
+ audio_embeds = audio_embeds.transpose(0, 1).mean(-3) #[B, T, 1024]
1334
+
1335
+ else:
1336
+
1337
+ audio_embeds = torch.stack(self.audio_encoder(input_values=audio,
1338
+ output_hidden_states=True,
1339
+ attention_mask=attn).hidden_states) # [25, B, T, 1024]
1340
+ audio_embeds = audio_embeds.transpose(0, 1).mean(-3) #[B, T, 1024]
1341
+
1342
+ # Average time steps:
1343
+ t = 325
1344
+ B, T, D = audio_embeds.shape
1345
+ avg_tmp = audio_embeds[:, :T//t*t].reshape(B, T//t, t, D).mean(2)
1346
+
1347
+ # Average the remaining steps
1348
+ if T % t > 0:
1349
+ avg_last = audio_embeds[:, T//t*t:].reshape(B, 1, T%t, D).mean(2)
1350
+ audio_embeds = torch.concat([avg_tmp, avg_last], dim=1)
1351
+ else:
1352
+ audio_embeds = avg_tmp
1353
+ audio_embeds = audio_embeds.to(device)
1354
+ inputs_llama = self.llama_proj(audio_embeds)
1355
+ atts_llama = torch.ones(inputs_llama.size()[:-1], dtype=torch.long).to(audio.device)
1356
+ return inputs_llama, atts_llama
1357
+
1358
+ def prompt_wrap(self, audio_embeds, atts_audio, prompt):
1359
+ if prompt:
1360
+ batch_size = audio_embeds.shape[0]
1361
+ p_before, p_after = prompt.split('<AudioHere>')
1362
+ p_before_tokens = self.llama_tokenizer(
1363
+ p_before, return_tensors="pt", add_special_tokens=False).to(audio_embeds.device)
1364
+ p_after_tokens = self.llama_tokenizer(
1365
+ p_after, return_tensors="pt", add_special_tokens=False).to(audio_embeds.device)
1366
+ p_before_embeds = self.llama_model.model.embed_tokens(p_before_tokens.input_ids).expand(batch_size, -1, -1)
1367
+ p_after_embeds = self.llama_model.model.embed_tokens(p_after_tokens.input_ids).expand(batch_size, -1, -1)
1368
+ wrapped_audio_embeds = torch.cat([p_before_embeds, audio_embeds, p_after_embeds], dim=1)
1369
+ wrapped_atts_audio = atts_audio[:, :1].expand(-1, wrapped_audio_embeds.shape[1])
1370
+ return wrapped_audio_embeds, wrapped_atts_audio
1371
+ else:
1372
+ return audio_embeds, atts_audio
1373
+
1374
+ def instruction_prompt_wrap(self, audio_embeds, atts_audio, prompt):
1375
+ if prompt:
1376
+ batch_size = audio_embeds.shape[0]
1377
+ p_before = []
1378
+ p_after = []
1379
+
1380
+ for i in range(batch_size):
1381
+ p_b, p_a = prompt[i].split('<AudioHere>')
1382
+ p_before.append(p_b)
1383
+ p_after.append(p_a)
1384
+
1385
+ p_before_tokens = self.llama_tokenizer(
1386
+ p_before, return_tensors="pt", padding='longest', add_special_tokens=False).to(audio_embeds.device)
1387
+ p_after_tokens = self.llama_tokenizer(
1388
+ p_after, return_tensors="pt", padding='longest', add_special_tokens=False).to(audio_embeds.device)
1389
+ p_before_embeds = self.llama_model.model.embed_tokens(p_before_tokens.input_ids)
1390
+ p_after_embeds = self.llama_model.model.embed_tokens(p_after_tokens.input_ids)
1391
+ wrapped_audio_embeds = torch.cat([p_before_embeds, audio_embeds, p_after_embeds], dim=1)
1392
+ wrapped_atts_audio = torch.cat([p_before_tokens.attention_mask, atts_audio, p_after_tokens.attention_mask], dim=1)
1393
+ return wrapped_audio_embeds, wrapped_atts_audio
1394
+ else:
1395
+ return audio_embeds, atts_audio
1396
+
1397
+
1398
+ def forward(self, samples):
1399
+ audio = samples["audio"]
1400
+ attn = samples["attention_mask"] if "attention_mask" in samples else None
1401
+ audio_embeds, atts_audio = self.encode_audio(audio, attn)
1402
+
1403
+ if 'instruction_input' in samples: # instruction tuning dataset
1404
+ instruction_prompt = []
1405
+ for instruction in samples['instruction_input']:
1406
+ prompt = '<Audio><AudioHere></Audio> ' + instruction
1407
+ instruction_prompt.append(self.prompt_template.format(prompt))
1408
+ audio_embeds, atts_audio = self.instruction_prompt_wrap(audio_embeds, atts_audio, instruction_prompt)
1409
+
1410
+ elif self.prompt_list:
1411
+ prompt = random.choice(self.prompt_list)
1412
+ audio_embeds, atts_audio = self.prompt_wrap(audio_embeds, atts_audio, prompt)
1413
+
1414
+ self.llama_tokenizer.padding_side = "right"
1415
+
1416
+ text = [t + self.end_sym for t in samples["text_input"]]
1417
+
1418
+ to_regress_tokens = self.llama_tokenizer(
1419
+ text,
1420
+ return_tensors="pt",
1421
+ padding="longest",
1422
+ truncation=True,
1423
+ max_length=self.max_txt_len,
1424
+ add_special_tokens=False
1425
+ ).to(audio.device)
1426
+
1427
+ targets = to_regress_tokens.input_ids.masked_fill(
1428
+ to_regress_tokens.input_ids == self.llama_tokenizer.pad_token_id, -100
1429
+ )
1430
+
1431
+ empty_targets = (
1432
+ torch.ones([atts_audio.shape[0], atts_audio.shape[1]+1],
1433
+ dtype=torch.long).to(audio.device).fill_(-100) # plus one for bos
1434
+ )
1435
+ targets = torch.cat([empty_targets, targets], dim=1)
1436
+
1437
+ batch_size = audio_embeds.shape[0]
1438
+ bos = torch.ones([batch_size, 1],
1439
+ dtype=to_regress_tokens.input_ids.dtype,
1440
+ device=to_regress_tokens.input_ids.device) * self.llama_tokenizer.bos_token_id
1441
+ bos_embeds = self.llama_model.model.embed_tokens(bos)
1442
+ atts_bos = atts_audio[:, :1]
1443
+
1444
+ to_regress_embeds = self.llama_model.model.embed_tokens(to_regress_tokens.input_ids)
1445
+ inputs_embeds = torch.cat([bos_embeds, audio_embeds, to_regress_embeds], dim=1)
1446
+ attention_mask = torch.cat([atts_bos, atts_audio, to_regress_tokens.attention_mask], dim=1)
1447
+
1448
+ outputs = self.llama_model(
1449
+ inputs_embeds=inputs_embeds,
1450
+ attention_mask=attention_mask,
1451
+ return_dict=True,
1452
+ labels=targets,
1453
+ )
1454
+ loss = outputs.loss
1455
+
1456
+ return {"loss": loss}
1457
+
1458
+ @classmethod
1459
+ def from_config(cls, cfg):
1460
+ mert_model = cfg.get("mert_model", "")
1461
+ llama_model = cfg.get("llama_model")
1462
+
1463
+ low_resource = cfg.get("low_resource", False)
1464
+ device_8bit = cfg.get("device_8bit", 0)
1465
+
1466
+ prompt_path = cfg.get("prompt_path", "")
1467
+ prompt_template = cfg.get("prompt_template", "")
1468
+ max_txt_len = cfg.get("max_txt_len", 32)
1469
+ end_sym = cfg.get("end_sym", '\n')
1470
+
1471
+ model = cls(
1472
+ mert_model=mert_model,
1473
+ llama_model=llama_model,
1474
+ prompt_path=prompt_path,
1475
+ prompt_template=prompt_template,
1476
+ max_txt_len=max_txt_len,
1477
+ end_sym=end_sym,
1478
+ low_resource=low_resource,
1479
+ device_8bit=device_8bit,
1480
+ )
1481
+
1482
+ ckpt_path = cfg.get("ckpt", "") # load ckpt weights of MusiLingo
1483
+ if ckpt_path:
1484
+ print("Load MERT-LLM Checkpoint: {}".format(ckpt_path))
1485
+ ckpt = torch.load(ckpt_path, map_location="cpu")
1486
+ msg = model.load_state_dict(ckpt['model'], strict=False)
1487
+
1488
+ return model
1489
+
1490
+
1491
+ class MusilingoModel(PreTrainedModel):
1492
+ config_class = MusiLingoConfig
1493
+ def __init__(self, config):
1494
+ super().__init__(config)
1495
+ self.model = MusiLingo(
1496
+ mert_model=config.mert_model,
1497
+ llama_model=config.llama_model,
1498
+ prompt_path=config.prompt_path,
1499
+ prompt_template=config.prompt_template,
1500
+ max_txt_len=config.max_txt_len,
1501
+ end_sym=config.end_sym,
1502
+ low_resource=config.low_resource,
1503
+ device_8bit=config.device_8bit
1504
+ # self.linear_ckpt_path = config.linear_ckpt_path``
1505
+ )
1506
+
1507
+
1508
+ def forward(self, tensor):
1509
+ return self.model.forward(tensor)