reach-vb HF staff commited on
Commit
ef7f7d1
·
verified ·
1 Parent(s): 392bade

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. checkpoint-10800/config.json +44 -0
  2. checkpoint-10800/generation_config.json +7 -0
  3. checkpoint-10800/merges.txt +0 -0
  4. checkpoint-10800/model.safetensors +3 -0
  5. checkpoint-10800/optimizer.pt +3 -0
  6. checkpoint-10800/rng_state.pth +3 -0
  7. checkpoint-10800/scheduler.pt +3 -0
  8. checkpoint-10800/special_tokens_map.json +28 -0
  9. checkpoint-10800/tokenizer.json +0 -0
  10. checkpoint-10800/tokenizer_config.json +155 -0
  11. checkpoint-10800/trainer_state.json +886 -0
  12. checkpoint-10800/training_args.bin +3 -0
  13. checkpoint-10800/ultravox_config.py +173 -0
  14. checkpoint-10800/ultravox_model.py +754 -0
  15. checkpoint-10800/vocab.json +0 -0
  16. checkpoint-14400/config.json +44 -0
  17. checkpoint-14400/generation_config.json +7 -0
  18. checkpoint-14400/merges.txt +0 -0
  19. checkpoint-14400/model.safetensors +3 -0
  20. checkpoint-14400/optimizer.pt +3 -0
  21. checkpoint-14400/rng_state.pth +3 -0
  22. checkpoint-14400/scheduler.pt +3 -0
  23. checkpoint-14400/special_tokens_map.json +28 -0
  24. checkpoint-14400/tokenizer.json +0 -0
  25. checkpoint-14400/tokenizer_config.json +155 -0
  26. checkpoint-14400/trainer_state.json +1174 -0
  27. checkpoint-14400/training_args.bin +3 -0
  28. checkpoint-14400/ultravox_config.py +173 -0
  29. checkpoint-14400/ultravox_model.py +754 -0
  30. checkpoint-14400/vocab.json +0 -0
  31. checkpoint-3600/config.json +44 -0
  32. checkpoint-3600/generation_config.json +7 -0
  33. checkpoint-3600/merges.txt +0 -0
  34. checkpoint-3600/model.safetensors +3 -0
  35. checkpoint-3600/optimizer.pt +3 -0
  36. checkpoint-3600/rng_state.pth +3 -0
  37. checkpoint-3600/scheduler.pt +3 -0
  38. checkpoint-3600/special_tokens_map.json +28 -0
  39. checkpoint-3600/tokenizer.json +0 -0
  40. checkpoint-3600/tokenizer_config.json +155 -0
  41. checkpoint-3600/trainer_state.json +319 -0
  42. checkpoint-3600/training_args.bin +3 -0
  43. checkpoint-3600/ultravox_config.py +173 -0
  44. checkpoint-3600/ultravox_model.py +754 -0
  45. checkpoint-3600/vocab.json +0 -0
  46. checkpoint-7200/config.json +44 -0
  47. checkpoint-7200/generation_config.json +7 -0
  48. checkpoint-7200/merges.txt +0 -0
  49. checkpoint-7200/model.safetensors +3 -0
  50. checkpoint-7200/optimizer.pt +3 -0
checkpoint-10800/config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UltravoxModel"
4
+ ],
5
+ "audio_latency_block_size": null,
6
+ "audio_model_id": "openai/whisper-large-v3-turbo",
7
+ "audio_model_lora_config": {
8
+ "lora_alpha": 8,
9
+ "r": 0,
10
+ "target_modules": [
11
+ "k_proj",
12
+ "q_proj",
13
+ "linear_k",
14
+ "linear_q"
15
+ ]
16
+ },
17
+ "auto_map": {
18
+ "AutoConfig": "ultravox_config.UltravoxConfig",
19
+ "AutoModel": "ultravox_model.UltravoxModel"
20
+ },
21
+ "hidden_size": 4096,
22
+ "ignore_index": -100,
23
+ "initializer_range": 0.02,
24
+ "model_type": "ultravox",
25
+ "norm_init": 0.4,
26
+ "pad_token_id": 2,
27
+ "projector_act": "swiglu",
28
+ "projector_ln_mid": false,
29
+ "stack_factor": 8,
30
+ "text_model_id": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
31
+ "text_model_lora_config": {
32
+ "lora_alpha": 8,
33
+ "r": 0,
34
+ "target_modules": [
35
+ "k_proj",
36
+ "q_proj",
37
+ "linear_k",
38
+ "linear_q"
39
+ ]
40
+ },
41
+ "torch_dtype": "bfloat16",
42
+ "transformers_version": "4.47.0",
43
+ "vocab_size": 49152
44
+ }
checkpoint-10800/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "4.47.0"
7
+ }
checkpoint-10800/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-10800/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:599403a4e51e9462dec7603c72d5f6f03b3a9b3f316f6ecda2c082e6b9885566
3
+ size 92299736
checkpoint-10800/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:802dc6c7082cb34cf728621561091d75e2351c60ad7abcbb07c6055f7cf2433e
3
+ size 184602962
checkpoint-10800/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d902b2fc21ae01a2e62068637a291fad3a067be62ae6dd561ab05d3c42c1f44d
3
+ size 14244
checkpoint-10800/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01ae122cbb1630c5e9128a1def009fb9fe6db25bf8dbd0de4ec680be8f1568e1
3
+ size 1064
checkpoint-10800/special_tokens_map.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<|im_start|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "eos_token": {
14
+ "content": "<|im_end|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "pad_token": "<|im_end|>",
21
+ "unk_token": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ }
28
+ }
checkpoint-10800/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-10800/tokenizer_config.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<repo_name>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<reponame>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<file_sep>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<filename>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<gh_stars>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_start>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_comment>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<issue_closed>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_start>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_text>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_code>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<jupyter_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<jupyter_script>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<empty_output>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ }
140
+ },
141
+ "additional_special_tokens": [
142
+ "<|im_start|>",
143
+ "<|im_end|>"
144
+ ],
145
+ "bos_token": "<|im_start|>",
146
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
147
+ "clean_up_tokenization_spaces": false,
148
+ "eos_token": "<|im_end|>",
149
+ "extra_special_tokens": {},
150
+ "model_max_length": 8192,
151
+ "pad_token": "<|im_end|>",
152
+ "tokenizer_class": "GPT2Tokenizer",
153
+ "unk_token": "<|endoftext|>",
154
+ "vocab_size": 49152
155
+ }
checkpoint-10800/trainer_state.json ADDED
@@ -0,0 +1,886 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.08988464803502172,
5
+ "eval_steps": 1000,
6
+ "global_step": 10800,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 8.322652595835345e-06,
13
+ "grad_norm": 14.9375,
14
+ "learning_rate": 2e-06,
15
+ "loss": 0.6484,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.0008322652595835345,
20
+ "grad_norm": 0.3671875,
21
+ "learning_rate": 0.0002,
22
+ "loss": 0.4345,
23
+ "step": 100
24
+ },
25
+ {
26
+ "epoch": 0.001664530519167069,
27
+ "grad_norm": 0.1689453125,
28
+ "learning_rate": 0.0004,
29
+ "loss": 0.2537,
30
+ "step": 200
31
+ },
32
+ {
33
+ "epoch": 0.0024967957787506035,
34
+ "grad_norm": 0.55859375,
35
+ "learning_rate": 0.0006,
36
+ "loss": 0.2344,
37
+ "step": 300
38
+ },
39
+ {
40
+ "epoch": 0.003329061038334138,
41
+ "grad_norm": 0.154296875,
42
+ "learning_rate": 0.0008,
43
+ "loss": 0.222,
44
+ "step": 400
45
+ },
46
+ {
47
+ "epoch": 0.004161326297917672,
48
+ "grad_norm": 0.126953125,
49
+ "learning_rate": 0.001,
50
+ "loss": 0.2142,
51
+ "step": 500
52
+ },
53
+ {
54
+ "epoch": 0.004993591557501207,
55
+ "grad_norm": 0.12353515625,
56
+ "learning_rate": 0.0012,
57
+ "loss": 0.2011,
58
+ "step": 600
59
+ },
60
+ {
61
+ "epoch": 0.005825856817084741,
62
+ "grad_norm": 0.10693359375,
63
+ "learning_rate": 0.0014,
64
+ "loss": 0.1897,
65
+ "step": 700
66
+ },
67
+ {
68
+ "epoch": 0.006658122076668276,
69
+ "grad_norm": 0.10595703125,
70
+ "learning_rate": 0.0016,
71
+ "loss": 0.1775,
72
+ "step": 800
73
+ },
74
+ {
75
+ "epoch": 0.0074903873362518105,
76
+ "grad_norm": 0.0859375,
77
+ "learning_rate": 0.0018000000000000002,
78
+ "loss": 0.1615,
79
+ "step": 900
80
+ },
81
+ {
82
+ "epoch": 0.008322652595835344,
83
+ "grad_norm": 0.083984375,
84
+ "learning_rate": 0.002,
85
+ "loss": 0.1444,
86
+ "step": 1000
87
+ },
88
+ {
89
+ "epoch": 0.008322652595835344,
90
+ "eval_peoplespeech-clean-transcription_loss": 2.2110702991485596,
91
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
92
+ "eval_peoplespeech-clean-transcription_runtime": 9.5405,
93
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.708,
94
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
95
+ "step": 1000
96
+ },
97
+ {
98
+ "epoch": 0.009154917855418878,
99
+ "grad_norm": 0.0771484375,
100
+ "learning_rate": 0.001999725185109816,
101
+ "loss": 0.1323,
102
+ "step": 1100
103
+ },
104
+ {
105
+ "epoch": 0.009987183115002414,
106
+ "grad_norm": 0.083984375,
107
+ "learning_rate": 0.0019989008914857113,
108
+ "loss": 0.1242,
109
+ "step": 1200
110
+ },
111
+ {
112
+ "epoch": 0.010819448374585948,
113
+ "grad_norm": 0.07861328125,
114
+ "learning_rate": 0.00199752757218401,
115
+ "loss": 0.1162,
116
+ "step": 1300
117
+ },
118
+ {
119
+ "epoch": 0.011651713634169482,
120
+ "grad_norm": 0.07275390625,
121
+ "learning_rate": 0.001995605982021898,
122
+ "loss": 0.1128,
123
+ "step": 1400
124
+ },
125
+ {
126
+ "epoch": 0.012483978893753018,
127
+ "grad_norm": 0.07666015625,
128
+ "learning_rate": 0.0019931371771625545,
129
+ "loss": 0.1094,
130
+ "step": 1500
131
+ },
132
+ {
133
+ "epoch": 0.013316244153336551,
134
+ "grad_norm": 0.06201171875,
135
+ "learning_rate": 0.001990122514534651,
136
+ "loss": 0.1052,
137
+ "step": 1600
138
+ },
139
+ {
140
+ "epoch": 0.014148509412920085,
141
+ "grad_norm": 0.058837890625,
142
+ "learning_rate": 0.0019865636510865464,
143
+ "loss": 0.1022,
144
+ "step": 1700
145
+ },
146
+ {
147
+ "epoch": 0.014980774672503621,
148
+ "grad_norm": 0.0625,
149
+ "learning_rate": 0.001982462542875576,
150
+ "loss": 0.1011,
151
+ "step": 1800
152
+ },
153
+ {
154
+ "epoch": 0.015813039932087155,
155
+ "grad_norm": 0.06787109375,
156
+ "learning_rate": 0.001977821443992945,
157
+ "loss": 0.0983,
158
+ "step": 1900
159
+ },
160
+ {
161
+ "epoch": 0.01664530519167069,
162
+ "grad_norm": 0.0537109375,
163
+ "learning_rate": 0.001972642905324813,
164
+ "loss": 0.0975,
165
+ "step": 2000
166
+ },
167
+ {
168
+ "epoch": 0.01664530519167069,
169
+ "eval_peoplespeech-clean-transcription_loss": 1.6914767026901245,
170
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
171
+ "eval_peoplespeech-clean-transcription_runtime": 9.5301,
172
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.716,
173
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
174
+ "step": 2000
175
+ },
176
+ {
177
+ "epoch": 0.017477570451254223,
178
+ "grad_norm": 0.05859375,
179
+ "learning_rate": 0.0019669297731502505,
180
+ "loss": 0.0947,
181
+ "step": 2100
182
+ },
183
+ {
184
+ "epoch": 0.018309835710837757,
185
+ "grad_norm": 0.062255859375,
186
+ "learning_rate": 0.00196068518757684,
187
+ "loss": 0.0935,
188
+ "step": 2200
189
+ },
190
+ {
191
+ "epoch": 0.019142100970421294,
192
+ "grad_norm": 0.059326171875,
193
+ "learning_rate": 0.001953912580814779,
194
+ "loss": 0.0911,
195
+ "step": 2300
196
+ },
197
+ {
198
+ "epoch": 0.019974366230004828,
199
+ "grad_norm": 0.060302734375,
200
+ "learning_rate": 0.0019466156752904343,
201
+ "loss": 0.0904,
202
+ "step": 2400
203
+ },
204
+ {
205
+ "epoch": 0.020806631489588362,
206
+ "grad_norm": 0.0615234375,
207
+ "learning_rate": 0.0019387984816003866,
208
+ "loss": 0.0882,
209
+ "step": 2500
210
+ },
211
+ {
212
+ "epoch": 0.021638896749171896,
213
+ "grad_norm": 0.056884765625,
214
+ "learning_rate": 0.0019304652963070869,
215
+ "loss": 0.0874,
216
+ "step": 2600
217
+ },
218
+ {
219
+ "epoch": 0.02247116200875543,
220
+ "grad_norm": 0.049072265625,
221
+ "learning_rate": 0.0019216206995773372,
222
+ "loss": 0.0871,
223
+ "step": 2700
224
+ },
225
+ {
226
+ "epoch": 0.023303427268338964,
227
+ "grad_norm": 0.053955078125,
228
+ "learning_rate": 0.0019122695526648968,
229
+ "loss": 0.0856,
230
+ "step": 2800
231
+ },
232
+ {
233
+ "epoch": 0.0241356925279225,
234
+ "grad_norm": 0.05517578125,
235
+ "learning_rate": 0.0019024169952385887,
236
+ "loss": 0.0845,
237
+ "step": 2900
238
+ },
239
+ {
240
+ "epoch": 0.024967957787506035,
241
+ "grad_norm": 0.0546875,
242
+ "learning_rate": 0.0018920684425573864,
243
+ "loss": 0.0852,
244
+ "step": 3000
245
+ },
246
+ {
247
+ "epoch": 0.024967957787506035,
248
+ "eval_peoplespeech-clean-transcription_loss": 1.6414048671722412,
249
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
250
+ "eval_peoplespeech-clean-transcription_runtime": 9.8151,
251
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.521,
252
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.815,
253
+ "step": 3000
254
+ },
255
+ {
256
+ "epoch": 0.02580022304708957,
257
+ "grad_norm": 0.052978515625,
258
+ "learning_rate": 0.0018812295824940284,
259
+ "loss": 0.0836,
260
+ "step": 3100
261
+ },
262
+ {
263
+ "epoch": 0.026632488306673103,
264
+ "grad_norm": 0.05126953125,
265
+ "learning_rate": 0.0018699063724087904,
266
+ "loss": 0.0821,
267
+ "step": 3200
268
+ },
269
+ {
270
+ "epoch": 0.027464753566256637,
271
+ "grad_norm": 0.056884765625,
272
+ "learning_rate": 0.0018581050358751443,
273
+ "loss": 0.0816,
274
+ "step": 3300
275
+ },
276
+ {
277
+ "epoch": 0.02829701882584017,
278
+ "grad_norm": 0.045654296875,
279
+ "learning_rate": 0.0018458320592590974,
280
+ "loss": 0.0814,
281
+ "step": 3400
282
+ },
283
+ {
284
+ "epoch": 0.029129284085423705,
285
+ "grad_norm": 0.04638671875,
286
+ "learning_rate": 0.0018330941881540914,
287
+ "loss": 0.0791,
288
+ "step": 3500
289
+ },
290
+ {
291
+ "epoch": 0.029961549345007242,
292
+ "grad_norm": 0.043212890625,
293
+ "learning_rate": 0.0018198984236734246,
294
+ "loss": 0.0804,
295
+ "step": 3600
296
+ },
297
+ {
298
+ "epoch": 0.030793814604590776,
299
+ "grad_norm": 0.054931640625,
300
+ "learning_rate": 0.0018062520186022297,
301
+ "loss": 0.0802,
302
+ "step": 3700
303
+ },
304
+ {
305
+ "epoch": 0.03162607986417431,
306
+ "grad_norm": 0.054931640625,
307
+ "learning_rate": 0.0017921624734111292,
308
+ "loss": 0.0805,
309
+ "step": 3800
310
+ },
311
+ {
312
+ "epoch": 0.032458345123757844,
313
+ "grad_norm": 0.048095703125,
314
+ "learning_rate": 0.001777637532133752,
315
+ "loss": 0.079,
316
+ "step": 3900
317
+ },
318
+ {
319
+ "epoch": 0.03329061038334138,
320
+ "grad_norm": 0.0458984375,
321
+ "learning_rate": 0.0017626851781103819,
322
+ "loss": 0.0759,
323
+ "step": 4000
324
+ },
325
+ {
326
+ "epoch": 0.03329061038334138,
327
+ "eval_peoplespeech-clean-transcription_loss": 1.5952188968658447,
328
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
329
+ "eval_peoplespeech-clean-transcription_runtime": 9.4647,
330
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.762,
331
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.845,
332
+ "step": 4000
333
+ },
334
+ {
335
+ "epoch": 0.03412287564292491,
336
+ "grad_norm": 0.06494140625,
337
+ "learning_rate": 0.001747313629600077,
338
+ "loss": 0.0774,
339
+ "step": 4100
340
+ },
341
+ {
342
+ "epoch": 0.034955140902508446,
343
+ "grad_norm": 0.043701171875,
344
+ "learning_rate": 0.001731531335263669,
345
+ "loss": 0.0774,
346
+ "step": 4200
347
+ },
348
+ {
349
+ "epoch": 0.03578740616209198,
350
+ "grad_norm": 0.048095703125,
351
+ "learning_rate": 0.0017153469695201276,
352
+ "loss": 0.0769,
353
+ "step": 4300
354
+ },
355
+ {
356
+ "epoch": 0.03661967142167551,
357
+ "grad_norm": 0.051513671875,
358
+ "learning_rate": 0.0016987694277788418,
359
+ "loss": 0.0763,
360
+ "step": 4400
361
+ },
362
+ {
363
+ "epoch": 0.037451936681259054,
364
+ "grad_norm": 0.047607421875,
365
+ "learning_rate": 0.001681807821550438,
366
+ "loss": 0.0774,
367
+ "step": 4500
368
+ },
369
+ {
370
+ "epoch": 0.03828420194084259,
371
+ "grad_norm": 0.040283203125,
372
+ "learning_rate": 0.0016644714734388218,
373
+ "loss": 0.0748,
374
+ "step": 4600
375
+ },
376
+ {
377
+ "epoch": 0.03911646720042612,
378
+ "grad_norm": 0.05419921875,
379
+ "learning_rate": 0.0016467699120171987,
380
+ "loss": 0.0755,
381
+ "step": 4700
382
+ },
383
+ {
384
+ "epoch": 0.039948732460009656,
385
+ "grad_norm": 0.048828125,
386
+ "learning_rate": 0.001628712866590885,
387
+ "loss": 0.0732,
388
+ "step": 4800
389
+ },
390
+ {
391
+ "epoch": 0.04078099771959319,
392
+ "grad_norm": 0.046875,
393
+ "learning_rate": 0.0016103102618497923,
394
+ "loss": 0.0757,
395
+ "step": 4900
396
+ },
397
+ {
398
+ "epoch": 0.041613262979176724,
399
+ "grad_norm": 0.042236328125,
400
+ "learning_rate": 0.0015915722124135226,
401
+ "loss": 0.0738,
402
+ "step": 5000
403
+ },
404
+ {
405
+ "epoch": 0.041613262979176724,
406
+ "eval_peoplespeech-clean-transcription_loss": 1.5546748638153076,
407
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
408
+ "eval_peoplespeech-clean-transcription_runtime": 9.345,
409
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.849,
410
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.856,
411
+ "step": 5000
412
+ },
413
+ {
414
+ "epoch": 0.04244552823876026,
415
+ "grad_norm": 0.045166015625,
416
+ "learning_rate": 0.001572509017272072,
417
+ "loss": 0.0742,
418
+ "step": 5100
419
+ },
420
+ {
421
+ "epoch": 0.04327779349834379,
422
+ "grad_norm": 0.0556640625,
423
+ "learning_rate": 0.0015531311541251993,
424
+ "loss": 0.0746,
425
+ "step": 5200
426
+ },
427
+ {
428
+ "epoch": 0.044110058757927326,
429
+ "grad_norm": 0.043212890625,
430
+ "learning_rate": 0.0015334492736235703,
431
+ "loss": 0.073,
432
+ "step": 5300
433
+ },
434
+ {
435
+ "epoch": 0.04494232401751086,
436
+ "grad_norm": 0.044921875,
437
+ "learning_rate": 0.0015134741935148419,
438
+ "loss": 0.0727,
439
+ "step": 5400
440
+ },
441
+ {
442
+ "epoch": 0.045774589277094394,
443
+ "grad_norm": 0.05029296875,
444
+ "learning_rate": 0.0014932168926979072,
445
+ "loss": 0.0726,
446
+ "step": 5500
447
+ },
448
+ {
449
+ "epoch": 0.04660685453667793,
450
+ "grad_norm": 0.048095703125,
451
+ "learning_rate": 0.0014726885051885652,
452
+ "loss": 0.0718,
453
+ "step": 5600
454
+ },
455
+ {
456
+ "epoch": 0.04743911979626146,
457
+ "grad_norm": 0.046875,
458
+ "learning_rate": 0.0014519003139999338,
459
+ "loss": 0.0736,
460
+ "step": 5700
461
+ },
462
+ {
463
+ "epoch": 0.048271385055845,
464
+ "grad_norm": 0.051513671875,
465
+ "learning_rate": 0.0014308637449409706,
466
+ "loss": 0.0724,
467
+ "step": 5800
468
+ },
469
+ {
470
+ "epoch": 0.049103650315428536,
471
+ "grad_norm": 0.053955078125,
472
+ "learning_rate": 0.0014095903603365066,
473
+ "loss": 0.0724,
474
+ "step": 5900
475
+ },
476
+ {
477
+ "epoch": 0.04993591557501207,
478
+ "grad_norm": 0.037841796875,
479
+ "learning_rate": 0.0013880918526722496,
480
+ "loss": 0.071,
481
+ "step": 6000
482
+ },
483
+ {
484
+ "epoch": 0.04993591557501207,
485
+ "eval_peoplespeech-clean-transcription_loss": 1.5297455787658691,
486
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
487
+ "eval_peoplespeech-clean-transcription_runtime": 9.3364,
488
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.855,
489
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.857,
490
+ "step": 6000
491
+ },
492
+ {
493
+ "epoch": 0.050768180834595604,
494
+ "grad_norm": 0.05029296875,
495
+ "learning_rate": 0.0013663800381682463,
496
+ "loss": 0.0713,
497
+ "step": 6100
498
+ },
499
+ {
500
+ "epoch": 0.05160044609417914,
501
+ "grad_norm": 0.037109375,
502
+ "learning_rate": 0.0013444668502843329,
503
+ "loss": 0.0701,
504
+ "step": 6200
505
+ },
506
+ {
507
+ "epoch": 0.05243271135376267,
508
+ "grad_norm": 0.03564453125,
509
+ "learning_rate": 0.0013223643331611537,
510
+ "loss": 0.0708,
511
+ "step": 6300
512
+ },
513
+ {
514
+ "epoch": 0.053264976613346206,
515
+ "grad_norm": 0.04443359375,
516
+ "learning_rate": 0.001300084635000341,
517
+ "loss": 0.0707,
518
+ "step": 6400
519
+ },
520
+ {
521
+ "epoch": 0.05409724187292974,
522
+ "grad_norm": 0.033935546875,
523
+ "learning_rate": 0.0012776400013875004,
524
+ "loss": 0.0704,
525
+ "step": 6500
526
+ },
527
+ {
528
+ "epoch": 0.054929507132513274,
529
+ "grad_norm": 0.046142578125,
530
+ "learning_rate": 0.0012550427685616766,
531
+ "loss": 0.0707,
532
+ "step": 6600
533
+ },
534
+ {
535
+ "epoch": 0.05576177239209681,
536
+ "grad_norm": 0.04150390625,
537
+ "learning_rate": 0.0012323053566349834,
538
+ "loss": 0.0696,
539
+ "step": 6700
540
+ },
541
+ {
542
+ "epoch": 0.05659403765168034,
543
+ "grad_norm": 0.042236328125,
544
+ "learning_rate": 0.0012094402627661448,
545
+ "loss": 0.0705,
546
+ "step": 6800
547
+ },
548
+ {
549
+ "epoch": 0.057426302911263875,
550
+ "grad_norm": 0.035888671875,
551
+ "learning_rate": 0.0011864600542916813,
552
+ "loss": 0.0686,
553
+ "step": 6900
554
+ },
555
+ {
556
+ "epoch": 0.05825856817084741,
557
+ "grad_norm": 0.0498046875,
558
+ "learning_rate": 0.0011633773618185302,
559
+ "loss": 0.0687,
560
+ "step": 7000
561
+ },
562
+ {
563
+ "epoch": 0.05825856817084741,
564
+ "eval_peoplespeech-clean-transcription_loss": 1.518404483795166,
565
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
566
+ "eval_peoplespeech-clean-transcription_runtime": 9.4703,
567
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.758,
568
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.845,
569
+ "step": 7000
570
+ },
571
+ {
572
+ "epoch": 0.05909083343043095,
573
+ "grad_norm": 0.034423828125,
574
+ "learning_rate": 0.0011402048722818862,
575
+ "loss": 0.0693,
576
+ "step": 7100
577
+ },
578
+ {
579
+ "epoch": 0.059923098690014484,
580
+ "grad_norm": 0.047119140625,
581
+ "learning_rate": 0.0011169553219720827,
582
+ "loss": 0.0697,
583
+ "step": 7200
584
+ },
585
+ {
586
+ "epoch": 0.06075536394959802,
587
+ "grad_norm": 0.0576171875,
588
+ "learning_rate": 0.001093641489534351,
589
+ "loss": 0.0685,
590
+ "step": 7300
591
+ },
592
+ {
593
+ "epoch": 0.06158762920918155,
594
+ "grad_norm": 0.052490234375,
595
+ "learning_rate": 0.001070276188945293,
596
+ "loss": 0.0666,
597
+ "step": 7400
598
+ },
599
+ {
600
+ "epoch": 0.062419894468765086,
601
+ "grad_norm": 0.043212890625,
602
+ "learning_rate": 0.00104687226246994,
603
+ "loss": 0.0692,
604
+ "step": 7500
605
+ },
606
+ {
607
+ "epoch": 0.06325215972834862,
608
+ "grad_norm": 0.04052734375,
609
+ "learning_rate": 0.0010234425736032607,
610
+ "loss": 0.069,
611
+ "step": 7600
612
+ },
613
+ {
614
+ "epoch": 0.06408442498793215,
615
+ "grad_norm": 0.06298828125,
616
+ "learning_rate": 0.001,
617
+ "loss": 0.0682,
618
+ "step": 7700
619
+ },
620
+ {
621
+ "epoch": 0.06491669024751569,
622
+ "grad_norm": 0.04736328125,
623
+ "learning_rate": 0.0009765574263967396,
624
+ "loss": 0.0676,
625
+ "step": 7800
626
+ },
627
+ {
628
+ "epoch": 0.06574895550709922,
629
+ "grad_norm": 0.064453125,
630
+ "learning_rate": 0.0009531277375300599,
631
+ "loss": 0.0685,
632
+ "step": 7900
633
+ },
634
+ {
635
+ "epoch": 0.06658122076668276,
636
+ "grad_norm": 0.037109375,
637
+ "learning_rate": 0.0009297238110547074,
638
+ "loss": 0.0677,
639
+ "step": 8000
640
+ },
641
+ {
642
+ "epoch": 0.06658122076668276,
643
+ "eval_peoplespeech-clean-transcription_loss": 1.5178765058517456,
644
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
645
+ "eval_peoplespeech-clean-transcription_runtime": 9.3361,
646
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.855,
647
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.857,
648
+ "step": 8000
649
+ },
650
+ {
651
+ "epoch": 0.06741348602626629,
652
+ "grad_norm": 0.041259765625,
653
+ "learning_rate": 0.0009063585104656494,
654
+ "loss": 0.068,
655
+ "step": 8100
656
+ },
657
+ {
658
+ "epoch": 0.06824575128584982,
659
+ "grad_norm": 0.0390625,
660
+ "learning_rate": 0.0008830446780279176,
661
+ "loss": 0.0681,
662
+ "step": 8200
663
+ },
664
+ {
665
+ "epoch": 0.06907801654543336,
666
+ "grad_norm": 0.043212890625,
667
+ "learning_rate": 0.0008597951277181142,
668
+ "loss": 0.0677,
669
+ "step": 8300
670
+ },
671
+ {
672
+ "epoch": 0.06991028180501689,
673
+ "grad_norm": 0.054443359375,
674
+ "learning_rate": 0.0008366226381814697,
675
+ "loss": 0.0679,
676
+ "step": 8400
677
+ },
678
+ {
679
+ "epoch": 0.07074254706460043,
680
+ "grad_norm": 0.036865234375,
681
+ "learning_rate": 0.000813539945708319,
682
+ "loss": 0.0685,
683
+ "step": 8500
684
+ },
685
+ {
686
+ "epoch": 0.07157481232418396,
687
+ "grad_norm": 0.036865234375,
688
+ "learning_rate": 0.0007905597372338558,
689
+ "loss": 0.0678,
690
+ "step": 8600
691
+ },
692
+ {
693
+ "epoch": 0.07240707758376749,
694
+ "grad_norm": 0.03466796875,
695
+ "learning_rate": 0.0007676946433650169,
696
+ "loss": 0.0671,
697
+ "step": 8700
698
+ },
699
+ {
700
+ "epoch": 0.07323934284335103,
701
+ "grad_norm": 0.03857421875,
702
+ "learning_rate": 0.0007449572314383236,
703
+ "loss": 0.0659,
704
+ "step": 8800
705
+ },
706
+ {
707
+ "epoch": 0.07407160810293456,
708
+ "grad_norm": 0.04248046875,
709
+ "learning_rate": 0.0007223599986124993,
710
+ "loss": 0.0657,
711
+ "step": 8900
712
+ },
713
+ {
714
+ "epoch": 0.07490387336251811,
715
+ "grad_norm": 0.0517578125,
716
+ "learning_rate": 0.0006999153649996595,
717
+ "loss": 0.0662,
718
+ "step": 9000
719
+ },
720
+ {
721
+ "epoch": 0.07490387336251811,
722
+ "eval_peoplespeech-clean-transcription_loss": 1.49990975856781,
723
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
724
+ "eval_peoplespeech-clean-transcription_runtime": 9.6057,
725
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.663,
726
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.833,
727
+ "step": 9000
728
+ },
729
+ {
730
+ "epoch": 0.07573613862210164,
731
+ "grad_norm": 0.05419921875,
732
+ "learning_rate": 0.0006776356668388464,
733
+ "loss": 0.0659,
734
+ "step": 9100
735
+ },
736
+ {
737
+ "epoch": 0.07656840388168518,
738
+ "grad_norm": 0.041015625,
739
+ "learning_rate": 0.0006555331497156671,
740
+ "loss": 0.0656,
741
+ "step": 9200
742
+ },
743
+ {
744
+ "epoch": 0.07740066914126871,
745
+ "grad_norm": 0.08203125,
746
+ "learning_rate": 0.0006336199618317538,
747
+ "loss": 0.0663,
748
+ "step": 9300
749
+ },
750
+ {
751
+ "epoch": 0.07823293440085224,
752
+ "grad_norm": 0.03271484375,
753
+ "learning_rate": 0.0006119081473277501,
754
+ "loss": 0.0663,
755
+ "step": 9400
756
+ },
757
+ {
758
+ "epoch": 0.07906519966043578,
759
+ "grad_norm": 0.043212890625,
760
+ "learning_rate": 0.0005904096396634935,
761
+ "loss": 0.0642,
762
+ "step": 9500
763
+ },
764
+ {
765
+ "epoch": 0.07989746492001931,
766
+ "grad_norm": 0.03271484375,
767
+ "learning_rate": 0.0005691362550590297,
768
+ "loss": 0.0644,
769
+ "step": 9600
770
+ },
771
+ {
772
+ "epoch": 0.08072973017960285,
773
+ "grad_norm": 0.047607421875,
774
+ "learning_rate": 0.0005480996860000663,
775
+ "loss": 0.0648,
776
+ "step": 9700
777
+ },
778
+ {
779
+ "epoch": 0.08156199543918638,
780
+ "grad_norm": 0.03955078125,
781
+ "learning_rate": 0.0005273114948114346,
782
+ "loss": 0.0655,
783
+ "step": 9800
784
+ },
785
+ {
786
+ "epoch": 0.08239426069876991,
787
+ "grad_norm": 0.048095703125,
788
+ "learning_rate": 0.0005067831073020928,
789
+ "loss": 0.0651,
790
+ "step": 9900
791
+ },
792
+ {
793
+ "epoch": 0.08322652595835345,
794
+ "grad_norm": 0.0299072265625,
795
+ "learning_rate": 0.00048652580648515787,
796
+ "loss": 0.066,
797
+ "step": 10000
798
+ },
799
+ {
800
+ "epoch": 0.08322652595835345,
801
+ "eval_peoplespeech-clean-transcription_loss": 1.489192247390747,
802
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
803
+ "eval_peoplespeech-clean-transcription_runtime": 9.4911,
804
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.743,
805
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.843,
806
+ "step": 10000
807
+ },
808
+ {
809
+ "epoch": 0.08405879121793698,
810
+ "grad_norm": 0.055908203125,
811
+ "learning_rate": 0.0004665507263764299,
812
+ "loss": 0.0653,
813
+ "step": 10100
814
+ },
815
+ {
816
+ "epoch": 0.08489105647752052,
817
+ "grad_norm": 0.039794921875,
818
+ "learning_rate": 0.0004468688458748006,
819
+ "loss": 0.065,
820
+ "step": 10200
821
+ },
822
+ {
823
+ "epoch": 0.08572332173710405,
824
+ "grad_norm": 0.05322265625,
825
+ "learning_rate": 0.0004274909827279283,
826
+ "loss": 0.0654,
827
+ "step": 10300
828
+ },
829
+ {
830
+ "epoch": 0.08655558699668758,
831
+ "grad_norm": 0.0419921875,
832
+ "learning_rate": 0.0004084277875864776,
833
+ "loss": 0.0648,
834
+ "step": 10400
835
+ },
836
+ {
837
+ "epoch": 0.08738785225627112,
838
+ "grad_norm": 0.050537109375,
839
+ "learning_rate": 0.00038968973815020803,
840
+ "loss": 0.0643,
841
+ "step": 10500
842
+ },
843
+ {
844
+ "epoch": 0.08822011751585465,
845
+ "grad_norm": 0.0458984375,
846
+ "learning_rate": 0.00037128713340911534,
847
+ "loss": 0.0669,
848
+ "step": 10600
849
+ },
850
+ {
851
+ "epoch": 0.08905238277543819,
852
+ "grad_norm": 0.05029296875,
853
+ "learning_rate": 0.00035323008798280133,
854
+ "loss": 0.0657,
855
+ "step": 10700
856
+ },
857
+ {
858
+ "epoch": 0.08988464803502172,
859
+ "grad_norm": 0.039794921875,
860
+ "learning_rate": 0.00033552852656117837,
861
+ "loss": 0.0646,
862
+ "step": 10800
863
+ }
864
+ ],
865
+ "logging_steps": 100,
866
+ "max_steps": 14400,
867
+ "num_input_tokens_seen": 0,
868
+ "num_train_epochs": 1,
869
+ "save_steps": 3600,
870
+ "stateful_callbacks": {
871
+ "TrainerControl": {
872
+ "args": {
873
+ "should_epoch_stop": false,
874
+ "should_evaluate": false,
875
+ "should_log": false,
876
+ "should_save": true,
877
+ "should_training_stop": false
878
+ },
879
+ "attributes": {}
880
+ }
881
+ },
882
+ "total_flos": 6.93903470695465e+17,
883
+ "train_batch_size": 24,
884
+ "trial_name": null,
885
+ "trial_params": null
886
+ }
checkpoint-10800/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37b86db64b66888697120b24a102f1ab62ab1d7da7b6bd4cd2e497d4499c3fb5
3
+ size 5688
checkpoint-10800/ultravox_config.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dataclasses
2
+ from enum import Enum
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ import transformers
6
+
7
+
8
+ @dataclasses.dataclass
9
+ class LoraConfigSimplified:
10
+ """
11
+ Low Rank Approximation (LoRA) configuration.
12
+
13
+ Used for language and audio models separately.
14
+ """
15
+
16
+ # The rank of the approximation
17
+ r: int = 0
18
+ lora_alpha: float = 8
19
+ target_modules: Optional[List[str]] = dataclasses.field(
20
+ default_factory=lambda: ["k_proj", "q_proj", "linear_k", "linear_q"]
21
+ )
22
+ # A list of module names regex patterns to unfreeze. Only used if r == 0.
23
+ unfreeze_layers: Optional[List[str]] = None
24
+
25
+
26
+ class LossFunction(str, Enum):
27
+ CrossEntropy = "ce"
28
+ KL_Divergence = "kl"
29
+
30
+
31
+ @dataclasses.dataclass
32
+ class LossConfig:
33
+ loss_function: LossFunction = LossFunction.CrossEntropy
34
+ kl_temperature: float = 2.0
35
+
36
+ @property
37
+ def requires_alt_fields(self):
38
+ return self.loss_function == LossFunction.KL_Divergence
39
+
40
+
41
+ class UltravoxConfig(transformers.PretrainedConfig):
42
+ r"""
43
+ This is the configuration class to store the configuration of a [`UltravoxForConditionalGeneration`]. It is used to instantiate an
44
+ Ultravox model according to the specified arguments, defining the model architecture.
45
+
46
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
47
+ documentation from [`PretrainedConfig`] for more information.
48
+
49
+ Args:
50
+ audio_config (`Wav2Vec2Config`, *optional*):
51
+ Custom audio config or dict
52
+ text_config (`Union[AutoConfig, dict]`, *optional*):
53
+ The config object of the text backbone. Can be any of `LlamaConfig` or `MistralConfig`.
54
+ ignore_index (`int`, *optional*, defaults to -100):
55
+ The ignore index for the loss function.
56
+ audio_token_index (`int`, *optional*, defaults to 32000):
57
+ The audio token index to encode the audio prompt.
58
+ stack_factor (`int`, *optional*, defaults to 8):
59
+ Audio downsampling factor for the multimodal projector.
60
+ norm_init (`float`, *optional*, defaults to 0.4):
61
+ The initialization value for the layer normalization.
62
+ projector_act (`str`, *optional*, defaults to `"swiglu"`):
63
+ The activation function used by the multimodal projector.
64
+ text_model_lora_config (`LoraConfigSimplified`, *optional*):
65
+ The LoRA configuration for finetuning the text model.
66
+ audio_model_lora_config (`LoraConfigSimplified`, *optional*):
67
+ The LoRA configuration for finetuning the audio model.
68
+ audio_latency_block_size (`int`, *optional*, defaults to `None`):
69
+ The latency block size for simulating audio streaming.
70
+
71
+
72
+ Example:
73
+
74
+ ```python
75
+ >>> from transformers import UltravoxModel, Wav2Vec2Config, UltravoxConfig, LlamaConfig
76
+
77
+ >>> # Initializing an audio encoder config
78
+ >>> audio_config = Wav2Vec2Config()
79
+
80
+ >>> # Initializing a Llama config
81
+ >>> text_config = LlamaConfig()
82
+
83
+ >>> # Initializing a default configuration
84
+ >>> configuration = UltravoxConfig(audio_config, text_config)
85
+
86
+ >>> # Initializing a completely untrained model from the configuration
87
+ >>> model = UltravoxModel(configuration)
88
+
89
+ >>> # Accessing the model configuration
90
+ >>> configuration = model.config
91
+
92
+ >>> # Initialize a model from pretrained checkpoints and random projector weights
93
+ >>> config = UltravoxConfig(audio_model_id="facebook/wav2vec2-base-960h", text_model_id="meta-llama/Llama-2-7b-chat-hf")
94
+ ```"""
95
+
96
+ model_type = "ultravox"
97
+ is_composition = False
98
+
99
+ def __init__(
100
+ self,
101
+ audio_config: Optional[Dict[str, Any]] = None,
102
+ text_config: Optional[Dict[str, Any]] = None,
103
+ audio_model_id: Optional[str] = None,
104
+ text_model_id: Optional[str] = None,
105
+ ignore_index: int = -100,
106
+ hidden_size: int = 4096,
107
+ stack_factor: int = 8,
108
+ norm_init: float = 0.4,
109
+ projector_act: str = "swiglu",
110
+ projector_ln_mid: bool = False, # defaults to False for compatibility with v0.4.1 and below
111
+ text_model_lora_config: Optional[LoraConfigSimplified] = None,
112
+ audio_model_lora_config: Optional[LoraConfigSimplified] = None,
113
+ audio_latency_block_size: Optional[int] = None,
114
+ **kwargs,
115
+ ):
116
+ self.ignore_index = ignore_index
117
+
118
+ self.audio_model_id = audio_model_id
119
+ self.text_model_id = text_model_id
120
+
121
+ self.hidden_size = hidden_size
122
+ self.stack_factor = stack_factor
123
+ self.norm_init = norm_init
124
+ self.projector_act = projector_act
125
+ self.projector_ln_mid = projector_ln_mid
126
+ if text_model_id is not None:
127
+ self.text_config: transformers.LlamaConfig = (
128
+ transformers.AutoConfig.from_pretrained(text_model_id)
129
+ )
130
+ else:
131
+ text_config = text_config or {}
132
+ self.text_config = transformers.CONFIG_MAPPING[
133
+ text_config.get("model_type", "llama")
134
+ ](**text_config)
135
+
136
+ if audio_model_id is not None:
137
+ self.audio_config: transformers.PretrainedConfig = (
138
+ transformers.AutoConfig.from_pretrained(audio_model_id)
139
+ )
140
+ else:
141
+ audio_config = audio_config or {}
142
+ self.audio_config = transformers.CONFIG_MAPPING[
143
+ audio_config.get("model_type", "wav2vec2")
144
+ ](**audio_config)
145
+
146
+ self.text_model_lora_config = (
147
+ text_model_lora_config
148
+ if isinstance(text_model_lora_config, dict)
149
+ else dataclasses.asdict(text_model_lora_config or LoraConfigSimplified())
150
+ )
151
+ self.audio_model_lora_config = (
152
+ audio_model_lora_config
153
+ if isinstance(audio_model_lora_config, dict)
154
+ else dataclasses.asdict(audio_model_lora_config or LoraConfigSimplified())
155
+ )
156
+ self.audio_latency_block_size = audio_latency_block_size
157
+
158
+ self.vocab_size = self.text_config.vocab_size
159
+
160
+ self.initializer_range = self.text_config.initializer_range
161
+
162
+ super().__init__(**kwargs)
163
+
164
+ def to_diff_dict(self) -> Dict[str, Any]:
165
+ diff_dict = super().to_diff_dict()
166
+
167
+ # remove text_config and audio_config if text_model_id and audio_model_id are present
168
+ if self.text_model_id is not None:
169
+ diff_dict.pop("text_config", None)
170
+ if self.audio_model_id is not None:
171
+ diff_dict.pop("audio_config", None)
172
+
173
+ return diff_dict
checkpoint-10800/ultravox_model.py ADDED
@@ -0,0 +1,754 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import re
3
+ from typing import Any, Dict, Optional, Set, Tuple, Union
4
+
5
+ import peft
6
+ import torch
7
+ import torch.nn as nn
8
+ import torch.nn.functional as F
9
+ import transformers
10
+ import transformers.activations
11
+ import transformers.modeling_outputs
12
+ import transformers.models
13
+ from transformers.models.whisper import modeling_whisper as whisper
14
+
15
+ # We must use relative import in this directory to allow uploading to HF Hub
16
+ # Even "from . import X" pattern doesn't work (undocumented and unclear why)
17
+ from .ultravox_config import LossConfig
18
+ from .ultravox_config import LossFunction
19
+ from .ultravox_config import UltravoxConfig
20
+
21
+
22
+ class UltravoxModel(transformers.LlamaPreTrainedModel):
23
+ """
24
+ The Ultravox model which consists of an audio encoder and a language model.
25
+
26
+ Audio input is processed by the audio encoder, then every `stack_factor` frames are stacked together and
27
+ projected to the language model's embedding space using a few linear layers.
28
+ The text is embedded by the language model as usual and then the audio and text embeddings are merged together.
29
+
30
+ A special token `<|audio|>` is used to indicate the start of the audio embeddings in the merged embeddings.
31
+
32
+ Parameters:
33
+ config: Model configuration class with all the parameters of the model.
34
+ """
35
+
36
+ config_class = UltravoxConfig
37
+ config: UltravoxConfig # for type hinting
38
+ # Usually we load encoder and LLM weights from a pretrained model separately, so they are allowed to be missing
39
+ _keys_to_ignore_on_load_missing = ["audio_tower.*", "language_model.*"]
40
+ # Since we have kwargs in forward, we need to set this to False, otherwise grad_accum_steps will cause incorrect train loss to be reported
41
+ # see https://github.com/huggingface/transformers/issues/35856 and https://github.com/huggingface/trl/pull/2615/files
42
+ accepts_loss_kwargs = False
43
+
44
+ def __init__(self, config: UltravoxConfig):
45
+ super().__init__(config)
46
+ self._register_load_state_dict_pre_hook(self._pre_load_state_dict_hook)
47
+
48
+ self.keep_params: Set[str] = set()
49
+ self.vocab_size = config.vocab_size
50
+
51
+ self.audio_tower = self._create_audio_tower(config)
52
+ self.multi_modal_projector = self._create_multi_modal_projector(config)
53
+ self.language_model = self._create_language_model(config)
54
+
55
+ # Determine no_split_modules dynamically to use with FSDP auto_wrap policy.
56
+ # FSDP throws an error if some of the layer types are not found in the model.
57
+ # This would be something like ["LlamaDecoderLayer", "WhisperEncoderLayer"]
58
+ self._no_split_modules = (self.language_model._no_split_modules or []) + (
59
+ self.audio_tower._no_split_modules or []
60
+ )
61
+
62
+ self.loss_config = LossConfig()
63
+ self.post_init()
64
+
65
+ def get_input_embeddings(self):
66
+ return self.language_model.get_input_embeddings()
67
+
68
+ def set_input_embeddings(self, value):
69
+ self.language_model.set_input_embeddings(value)
70
+
71
+ def get_output_embeddings(self):
72
+ return self.language_model.get_output_embeddings()
73
+
74
+ def set_output_embeddings(self, new_embeddings):
75
+ self.language_model.set_output_embeddings(new_embeddings)
76
+
77
+ def set_decoder(self, decoder):
78
+ self.language_model.set_decoder(decoder)
79
+
80
+ def get_decoder(self):
81
+ return self.language_model.get_decoder()
82
+
83
+ def tie_weights(self):
84
+ return self.language_model.tie_weights()
85
+
86
+ def set_loss_config(self, loss_config: LossConfig):
87
+ self.loss_config = loss_config
88
+
89
+ def _setup_cache(
90
+ self, cache_cls, max_batch_size: int, max_cache_len: Optional[int] = None
91
+ ):
92
+ self.language_model._setup_cache(cache_cls, max_batch_size, max_cache_len)
93
+
94
+ def _reorder_cache(self, past_key_values, beam_idx):
95
+ return self.language_model._reorder_cache(past_key_values, beam_idx)
96
+
97
+ def resize_token_embeddings(
98
+ self,
99
+ new_num_tokens: Optional[int] = None,
100
+ pad_to_multiple_of: Optional[int] = None,
101
+ ) -> nn.Embedding:
102
+ model_embeds = self.language_model.resize_token_embeddings(
103
+ new_num_tokens, pad_to_multiple_of
104
+ )
105
+ # update vocab size
106
+ self.config.text_config.vocab_size = model_embeds.num_embeddings
107
+ self.config.vocab_size = model_embeds.num_embeddings
108
+ self.vocab_size = model_embeds.num_embeddings
109
+ return model_embeds
110
+
111
+ def _compute_kl_loss(
112
+ self,
113
+ lm_output: transformers.modeling_outputs.CausalLMOutputWithPast,
114
+ labels: Optional[torch.Tensor] = None,
115
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
116
+ alt_input_ids: Optional[torch.Tensor] = None,
117
+ alt_attention_mask: Optional[torch.Tensor] = None,
118
+ alt_labels: Optional[torch.Tensor] = None,
119
+ **kwargs,
120
+ ):
121
+ # disable gradient computation for the teacher model
122
+ with torch.no_grad():
123
+ # compute the teacher (text-only) model's distribution
124
+ alt_inputs_embeds = self.get_input_embeddings().forward(alt_input_ids)
125
+ alt_lm_output = self.language_model.forward(
126
+ inputs_embeds=alt_inputs_embeds,
127
+ labels=alt_labels,
128
+ attention_mask=alt_attention_mask,
129
+ past_key_values=past_key_values,
130
+ **kwargs,
131
+ )
132
+ # compute the KL divergence loss between the two models
133
+ kl_loss = F.kl_div(
134
+ F.log_softmax(
135
+ lm_output.logits[labels != -100] / self.loss_config.kl_temperature,
136
+ dim=-1,
137
+ ),
138
+ F.softmax(
139
+ alt_lm_output.logits[alt_labels != -100]
140
+ / self.loss_config.kl_temperature,
141
+ dim=-1,
142
+ ),
143
+ reduction="batchmean",
144
+ )
145
+ return {"loss": kl_loss}
146
+
147
+ def forward(
148
+ self,
149
+ input_ids: torch.Tensor,
150
+ audio_values: Optional[torch.FloatTensor] = None,
151
+ inputs_embeds: Optional[torch.FloatTensor] = None,
152
+ labels: Optional[torch.Tensor] = None,
153
+ attention_mask: Optional[torch.Tensor] = None,
154
+ audio_token_start_idx: Optional[torch.Tensor] = None,
155
+ audio_len: Optional[torch.Tensor] = None,
156
+ audio_token_len: Optional[torch.Tensor] = None,
157
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
158
+ # the alt_* fields are needed for KL divergence loss
159
+ alt_input_ids: Optional[torch.Tensor] = None,
160
+ alt_attention_mask: Optional[torch.Tensor] = None,
161
+ alt_labels: Optional[torch.Tensor] = None,
162
+ **kwargs,
163
+ ) -> Union[Tuple, transformers.modeling_outputs.CausalLMOutputWithPast]:
164
+ """
165
+ Forward pass for the Ultravox model.
166
+
167
+ `input_ids` are the tokenized text input. They are embedded by the language model as usual.
168
+ `audio_values` are processed by the audio encoder and then every `stack_factor` frames are stacked together and
169
+ projected to the language model's embedding space using a few linear layers.
170
+ The audio and text embeddings are merged together. A special token `<|audio|>` is used to indicate the start
171
+ of the audio embeddings in the merged embeddings.
172
+
173
+ Args:
174
+ input_ids: The tokenized text input.
175
+ audio_values: The processed audio values.
176
+ inputs_embeds: The embeddings for the input tokens.
177
+ labels: The tokenized text labels.
178
+ attention_mask: The attention mask for the input.
179
+ position_ids: The position ids for the input.
180
+ past_key_values: The past key value cache for the language model attention layers.
181
+ **kwargs: Additional keyword arguments. Passed directly to the language model.
182
+ """
183
+ if inputs_embeds is None:
184
+ # B x T -> B x T x D
185
+ inputs_embeds = self.get_input_embeddings().forward(input_ids)
186
+
187
+ if audio_values is not None:
188
+ assert (
189
+ audio_token_start_idx is not None and audio_token_len is not None
190
+ ), "audio_token_start_idx and audio_token_len must be provided if audio_values are provided."
191
+ assert (
192
+ len(audio_token_start_idx) == len(audio_token_len) == len(audio_values)
193
+ ), "audio_token_start_idx, audio_token_len, and audio_values must have the same batch size."
194
+
195
+ # B x A/3200 x D
196
+ audio_tower_output = self.audio_tower.forward(
197
+ audio_values.to(self.audio_tower.dtype),
198
+ audio_len=audio_len,
199
+ ).last_hidden_state
200
+ audio_tower_output = audio_tower_output.to(inputs_embeds.dtype)
201
+
202
+ audio_embeds = self.multi_modal_projector.forward(audio_tower_output)
203
+
204
+ # combine audio and text embeddings
205
+ for i, (audio, start, length) in enumerate(
206
+ zip(audio_embeds, audio_token_start_idx, audio_token_len)
207
+ ):
208
+ length = min(length, audio.shape[0])
209
+ inputs_embeds[i, start : start + length] = audio[:length]
210
+
211
+ lm_output = self.language_model.forward(
212
+ inputs_embeds=inputs_embeds,
213
+ labels=labels,
214
+ attention_mask=attention_mask,
215
+ past_key_values=past_key_values,
216
+ **kwargs,
217
+ )
218
+ if self.training:
219
+ if self.loss_config.loss_function == LossFunction.CrossEntropy:
220
+ return lm_output
221
+ elif self.loss_config.loss_function == LossFunction.KL_Divergence:
222
+ return self._compute_kl_loss(
223
+ lm_output=lm_output,
224
+ labels=labels,
225
+ past_key_values=past_key_values,
226
+ alt_input_ids=alt_input_ids,
227
+ alt_attention_mask=alt_attention_mask,
228
+ alt_labels=alt_labels,
229
+ **kwargs,
230
+ )
231
+ else:
232
+ raise ValueError(
233
+ f"Unsupported loss function: {self.loss_config.loss_function}"
234
+ )
235
+ else:
236
+ return lm_output
237
+
238
+ def prepare_inputs_for_generation(
239
+ self,
240
+ input_ids: torch.Tensor,
241
+ audio_values: Optional[torch.FloatTensor] = None,
242
+ audio_token_start_idx: Optional[torch.Tensor] = None,
243
+ audio_token_len: Optional[torch.Tensor] = None,
244
+ audio_len: Optional[torch.Tensor] = None,
245
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
246
+ attention_mask: Optional[torch.Tensor] = None,
247
+ inputs_embeds: Optional[torch.Tensor] = None,
248
+ cache_position: Optional[torch.Tensor] = None,
249
+ **kwargs,
250
+ ) -> Dict[str, Any]:
251
+ model_input = self.language_model.prepare_inputs_for_generation(
252
+ input_ids=input_ids,
253
+ past_key_values=past_key_values,
254
+ attention_mask=attention_mask,
255
+ inputs_embeds=inputs_embeds,
256
+ cache_position=cache_position,
257
+ **kwargs,
258
+ )
259
+
260
+ # include audio information in model_input only when it is needed during prefilling
261
+ # audio_token_start_idx should always be relative to the current cache position
262
+ prefill_start_idx = 0 if cache_position is None else cache_position[0]
263
+ if (
264
+ audio_values is not None
265
+ and audio_token_start_idx is not None
266
+ and prefill_start_idx <= torch.max(audio_token_start_idx)
267
+ ):
268
+ model_input["audio_values"] = audio_values
269
+ model_input["audio_token_start_idx"] = (
270
+ audio_token_start_idx - prefill_start_idx
271
+ )
272
+ model_input["audio_token_len"] = audio_token_len
273
+ model_input["audio_len"] = audio_len
274
+
275
+ return model_input
276
+
277
+ @classmethod
278
+ def _create_multi_modal_projector(
279
+ cls, config: UltravoxConfig
280
+ ) -> "UltravoxProjector":
281
+ projector = UltravoxProjector(config)
282
+ projector.to(config.torch_dtype)
283
+ return projector
284
+
285
+ @classmethod
286
+ def _create_audio_tower(
287
+ cls, config: UltravoxConfig
288
+ ) -> Union[transformers.Wav2Vec2Model, "ModifiedWhisperEncoder"]:
289
+ if config.audio_model_id is not None:
290
+ if "whisper" in config.audio_model_id.lower():
291
+ audio_tower = ModifiedWhisperEncoder.from_pretrained(
292
+ config.audio_model_id, torch_dtype=config.torch_dtype
293
+ )
294
+ audio_tower.init_latency_mask(
295
+ config.audio_latency_block_size, dtype=config.torch_dtype
296
+ )
297
+ else:
298
+ assert config.audio_latency_block_size in (
299
+ None,
300
+ 0,
301
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
302
+ audio_tower = transformers.AutoModel.from_pretrained(
303
+ config.audio_model_id, torch_dtype=config.torch_dtype
304
+ )
305
+ else:
306
+ if "whisper" in config.audio_config._name_or_path.lower():
307
+ audio_tower = ModifiedWhisperEncoder(config.audio_config)
308
+ audio_tower.init_latency_mask(
309
+ config.audio_latency_block_size, dtype=config.torch_dtype
310
+ )
311
+ else:
312
+ assert config.audio_latency_block_size in (
313
+ None,
314
+ 0,
315
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
316
+ with transformers.modeling_utils.no_init_weights():
317
+ # we only ever use from_config if the weights are retrained, hence initializing is not
318
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
319
+ audio_tower = transformers.AutoModel.from_config(
320
+ config.audio_config
321
+ )
322
+
323
+ if isinstance(
324
+ audio_tower,
325
+ (transformers.Wav2Vec2BertModel, transformers.WhisperModel),
326
+ ):
327
+ # For these models we only need the encoder part
328
+ # Wav2Vec2BertModel -> Wav2Vec2BertEncoder
329
+ # WhisperModel -> WhisperEncoder
330
+ audio_tower = audio_tower.encoder
331
+
332
+ audio_tower = apply_lora(audio_tower, config.audio_model_lora_config)
333
+ return audio_tower
334
+
335
+ @classmethod
336
+ def _create_language_model(
337
+ cls, config: UltravoxConfig
338
+ ) -> transformers.LlamaForCausalLM:
339
+ if config.text_model_id is not None:
340
+ language_model = transformers.AutoModelForCausalLM.from_pretrained(
341
+ config.text_model_id,
342
+ attn_implementation=config._attn_implementation,
343
+ torch_dtype=config.torch_dtype,
344
+ )
345
+ else:
346
+ with transformers.modeling_utils.no_init_weights():
347
+ # we only ever use from_config if the weights are retrained, hence initializing is not
348
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
349
+ language_model = transformers.AutoModelForCausalLM.from_config(
350
+ config.text_config,
351
+ attn_implementation=config._attn_implementation,
352
+ torch_dtype=config.torch_dtype,
353
+ )
354
+
355
+ language_model = apply_lora(language_model, config.text_model_lora_config)
356
+ return language_model
357
+
358
+ def merge_and_unload(self):
359
+ if isinstance(self.language_model, peft.PeftModel):
360
+ self.language_model = self.language_model.merge_and_unload()
361
+ # no need to download base language model weights anymore, so we can remove the id
362
+ self.config.text_model_id = None
363
+ self.keep_params.update(
364
+ set(
365
+ [
366
+ f"language_model.{name}"
367
+ for name, _ in self.language_model.named_parameters()
368
+ ]
369
+ )
370
+ )
371
+
372
+ if isinstance(self.audio_tower, peft.PeftModel):
373
+ self.audio_tower = self.audio_tower.merge_and_unload()
374
+ # no need to download base audio model weights anymore, so we can remove the id
375
+ self.config.audio_model_id = None
376
+ self.keep_params.update(
377
+ set(
378
+ [
379
+ f"audio_tower.{name}"
380
+ for name, _ in self.audio_tower.named_parameters()
381
+ ]
382
+ )
383
+ )
384
+
385
+ for param in ["text_model_lora_config", "audio_model_lora_config"]:
386
+ if hasattr(self.config, param):
387
+ delattr(self.config, param)
388
+
389
+ def push_to_hub(self, *args, **kwargs):
390
+ self.merge_and_unload()
391
+ return super().push_to_hub(*args, **kwargs)
392
+
393
+ def diff_state_dict(
394
+ self, state_dict: Optional[Dict[str, Any]] = None
395
+ ) -> Dict[str, Any]:
396
+ if state_dict is None:
397
+ state_dict = super().state_dict()
398
+
399
+ named_params = dict(self.named_parameters())
400
+
401
+ state_dict = {
402
+ k: v
403
+ for k, v in state_dict.items()
404
+ if k in self.keep_params
405
+ or (k in named_params and named_params[k].requires_grad)
406
+ }
407
+
408
+ return state_dict
409
+
410
+ def save_pretrained(
411
+ self, *args, state_dict: Optional[Dict[str, Any]] = None, **kwargs
412
+ ):
413
+ state_dict = self.diff_state_dict(state_dict)
414
+
415
+ super().save_pretrained(*args, state_dict=state_dict, **kwargs)
416
+
417
+ def _pre_load_state_dict_hook(self, state_dict: Dict[str, Any], *args, **kwargs):
418
+ self.keep_params.update(set(state_dict.keys()))
419
+
420
+ def print_trainable_parameters(self):
421
+ """
422
+ Prints the number of trainable parameters in the model (reuses Peft model's method)
423
+ """
424
+ count_params = peft.peft_model.PeftModel.get_nb_trainable_parameters
425
+
426
+ trainable_params, all_param = count_params(self)
427
+
428
+ logging.info(
429
+ f"trainable params: {trainable_params:,d} || all params: {all_param:,d}"
430
+ f" || trainable%: {100 * trainable_params / all_param:.1f}%"
431
+ )
432
+
433
+ lm_trainable_params, lm_all_params = count_params(self.language_model)
434
+ audio_trainable_params, audio_all_params = count_params(self.audio_tower)
435
+
436
+ projector_trainable_params = (
437
+ trainable_params - lm_trainable_params - audio_trainable_params
438
+ )
439
+ projector_all_params = all_param - lm_all_params - audio_all_params
440
+
441
+ logging.info(
442
+ f"Trainable%: "
443
+ f" LLM: {100 * lm_trainable_params / lm_all_params:.1f}%"
444
+ f" || Audio Encoder: {100 * audio_trainable_params / audio_all_params:.1f}%"
445
+ f" || Projector: {100 * projector_trainable_params / projector_all_params:.1f}%"
446
+ )
447
+
448
+
449
+ # TODO: refactor common parts to a shared module
450
+ def is_cache_empty(
451
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]]
452
+ ) -> bool:
453
+ """
454
+ Check if the cache is empty.
455
+ """
456
+ if past_key_values is None:
457
+ return True
458
+ if isinstance(past_key_values, tuple):
459
+ return all(len(c) == 0 for c in past_key_values)
460
+ return past_key_values.get_seq_length() == 0
461
+
462
+
463
+ def apply_lora(model: torch.nn.Module, lora_config: dict) -> torch.nn.Module:
464
+ """
465
+ Applies LoRA finetuning to the model. If the `r` parameter is set to 0, the model is frozen instead.
466
+ """
467
+ unfreeze_layers = lora_config.pop("unfreeze_layers", None)
468
+ lora_config = peft.LoraConfig(**lora_config or {})
469
+
470
+ if lora_config.r == 0:
471
+ # freeze the model entirely, except for the specified layers
472
+ for name, param in model.named_parameters():
473
+ if not unfreeze_layers or not any(
474
+ re.match(layer, name) for layer in unfreeze_layers
475
+ ):
476
+ param.requires_grad = False
477
+ else:
478
+ logging.info(f"Unfreezing layer: {name} with #{param.numel()} params")
479
+ else:
480
+ model = peft.get_peft_model(model, lora_config)
481
+
482
+ return model
483
+
484
+
485
+ class StackAudioFrames(nn.Module):
486
+ """
487
+ Stack the audio embedding frames to reduce the sequence length by a factor of `stack_factor`.
488
+
489
+ The number of output frames will be `ceil(T / stack_factor) + 1` where `T` is the number of input frames.
490
+ NOTE: the extra +1 is intentional: in case the number of audio tokens are over-estimated by the processor,
491
+ we want to make sure `processor.audio_token_replacement` (i.e. EOS) doesn't get leaked into the middle of embeddings.
492
+ In most cases this extra padding will get removed in the model's forward function so it has no effect.
493
+ """
494
+
495
+ def __init__(self, stack_factor: int = 8):
496
+ super().__init__()
497
+ self.stack_factor = stack_factor
498
+
499
+ def forward(self, audio_embeds: torch.Tensor) -> torch.Tensor:
500
+ B, T, C = audio_embeds.shape
501
+ T_pad = (T + self.stack_factor - 1) // self.stack_factor * self.stack_factor
502
+ audio_embeds = F.pad(audio_embeds, (0, 0, 0, T_pad - T + self.stack_factor))
503
+ B, T, C = audio_embeds.shape
504
+ audio_embeds = audio_embeds.view(
505
+ B, T // self.stack_factor, C * self.stack_factor
506
+ )
507
+ return audio_embeds
508
+
509
+
510
+ class RMSNorm(transformers.models.llama.modeling_llama.LlamaRMSNorm):
511
+ def __init__(self, hidden_size: int, init: float = 1, eps: float = 1e-6):
512
+ super().__init__(hidden_size=hidden_size, eps=eps)
513
+ self.weight.data.fill_(init)
514
+
515
+
516
+ class SwiGLU(nn.Module):
517
+ def forward(self, x):
518
+ x, gate = x.chunk(2, dim=-1)
519
+ return F.silu(gate) * x
520
+
521
+
522
+ class UltravoxProjector(nn.Module):
523
+ def __init__(self, config: UltravoxConfig):
524
+ super().__init__()
525
+ self.hidden_dim = config.hidden_size
526
+ self._pad_and_stack = StackAudioFrames(config.stack_factor)
527
+ dim_in = config.audio_config.hidden_size * config.stack_factor
528
+ self.ln_pre = RMSNorm(dim_in, init=config.norm_init)
529
+ self.linear_1 = nn.Linear(dim_in, self.hidden_dim, bias=False)
530
+ dim_mid = self.hidden_dim
531
+ self.act = transformers.activations.get_activation(config.projector_act)
532
+ dim_mid = dim_mid // 2 if config.projector_act == "swiglu" else dim_mid
533
+ dim_out = config.text_config.hidden_size
534
+ self.linear_2 = nn.Linear(dim_mid, dim_out, bias=False)
535
+
536
+ # Ultravox v0.4.1 and below uses layer_norm after the second linear layer,
537
+ # while v0.5.0 and above uses layer_norm after the first linear layer.
538
+ if config.projector_ln_mid:
539
+ self.ln_mid: nn.Module = RMSNorm(dim_mid, init=config.norm_init)
540
+ self.ln_post: nn.Module = nn.Identity()
541
+ else:
542
+ self.ln_mid = nn.Identity()
543
+ self.ln_post = RMSNorm(dim_out, init=config.norm_init)
544
+
545
+ def forward(self, audio_features: torch.Tensor) -> torch.Tensor:
546
+ audio_features = self._pad_and_stack(audio_features)
547
+ audio_features = self.ln_pre(audio_features)
548
+ hidden_states = self.linear_1(audio_features)
549
+ hidden_states = self.act(hidden_states)
550
+ hidden_states = self.ln_mid(hidden_states)
551
+ hidden_states = self.linear_2(hidden_states)
552
+ hidden_states = self.ln_post(hidden_states)
553
+ return hidden_states
554
+
555
+
556
+ class ModifiedWhisperEncoder(
557
+ whisper.WhisperEncoder, transformers.modeling_utils.ModuleUtilsMixin
558
+ ):
559
+ """
560
+ Encoder portion of OpenAI's Whisper model.
561
+
562
+ This implementation is a slightly modified version of HF Transformers' Whisper Encoder, with only a few fixes:
563
+ 1. base_model_prefix updated to allow for doing `.from_pretrained` directly on the encoder
564
+ 2. allow less than 30 second of audio padding to be passed in:
565
+ - relaxed ValueError check for `input_features` length to be less than or equal to `expected_seq_length` instead of strictly equal
566
+ - embed_pos is now sliced to match the length of `inputs_embeds`
567
+
568
+ Original: https://github.com/huggingface/transformers/blob/main/src/transformers/models/whisper/modeling_whisper.py
569
+ """
570
+
571
+ base_model_prefix = "model.encoder"
572
+ _no_split_modules = ["WhisperEncoderLayer"]
573
+
574
+ def __init__(self, config: transformers.WhisperConfig):
575
+ super().__init__(config)
576
+ self.config.is_decoder = False
577
+
578
+ def init_latency_mask(self, audio_latency_block_size: int, dtype: torch.dtype):
579
+ if audio_latency_block_size is None:
580
+ self.audio_streaming_mask = None
581
+ return
582
+
583
+ # maximum sequence length
584
+ max_seqlen = (
585
+ self.config.max_source_positions
586
+ * self.conv1.stride[0]
587
+ * self.conv2.stride[0]
588
+ )
589
+ assert (
590
+ max_seqlen > 0
591
+ ), f"maximum sequence length must be positive, got {max_seqlen}"
592
+ assert (
593
+ max_seqlen % audio_latency_block_size == 0
594
+ ), f"audio_latency_block_size {audio_latency_block_size} must divide {max_seqlen} evenly."
595
+ # Given the block size, we calculate number of blocks.
596
+ audio_latency_nblocks = max_seqlen // audio_latency_block_size
597
+ audio_streaming_mask = (
598
+ torch.tril(
599
+ torch.ones(audio_latency_nblocks, audio_latency_nblocks),
600
+ diagonal=0,
601
+ )
602
+ .repeat_interleave(audio_latency_block_size, dim=0)
603
+ .repeat_interleave(audio_latency_block_size, dim=1)
604
+ )
605
+ audio_streaming_mask = (1.0 - audio_streaming_mask) * torch.finfo(dtype).min
606
+ audio_streaming_mask = audio_streaming_mask[None, None, :, :]
607
+ self.register_buffer(
608
+ "audio_streaming_mask", audio_streaming_mask, persistent=False
609
+ )
610
+
611
+ def forward(
612
+ self,
613
+ input_features,
614
+ audio_len=None,
615
+ head_mask=None,
616
+ output_attentions=None,
617
+ output_hidden_states=None,
618
+ return_dict=None,
619
+ ):
620
+ expected_seq_length = (
621
+ self.config.max_source_positions
622
+ * self.conv1.stride[0]
623
+ * self.conv2.stride[0]
624
+ )
625
+ if input_features.shape[-1] > expected_seq_length:
626
+ raise ValueError(
627
+ f"Whisper expects the mel input features to be of length {expected_seq_length} or less, but found {input_features.shape[-1]}. Make sure to pad the input mel features to {expected_seq_length}."
628
+ )
629
+
630
+ output_attentions = (
631
+ output_attentions
632
+ if output_attentions is not None
633
+ else self.config.output_attentions
634
+ )
635
+ output_hidden_states = (
636
+ output_hidden_states
637
+ if output_hidden_states is not None
638
+ else self.config.output_hidden_states
639
+ )
640
+ return_dict = (
641
+ return_dict if return_dict is not None else self.config.use_return_dict
642
+ )
643
+ inputs_embeds = nn.functional.gelu(self.conv1(input_features))
644
+ inputs_embeds = nn.functional.gelu(self.conv2(inputs_embeds))
645
+
646
+ inputs_embeds = inputs_embeds.permute(0, 2, 1)
647
+ embed_pos = self.embed_positions.weight[: inputs_embeds.size(-2)]
648
+
649
+ hidden_states = inputs_embeds + embed_pos
650
+ hidden_states = nn.functional.dropout(
651
+ hidden_states, p=self.dropout, training=self.training
652
+ )
653
+
654
+ encoder_states = () if output_hidden_states else None
655
+ all_attentions = () if output_attentions else None
656
+
657
+ # Create attention mask based on audio lengths to mask out padding tokens
658
+ # For each sample in batch:
659
+ # - Convert raw audio length to feature length after convolutions
660
+ # - Create boolean mask that is True for valid positions and False for padding
661
+ # - Convert to extended attention mask format expected by transformer layers
662
+ # (1.0 for positions to attend to, large negative for positions to ignore)
663
+ # This masking ensures consistent behavior between training and inference
664
+ # by preventing the model from attending to padding tokens in both cases
665
+ attention_mask = None
666
+ if audio_len != None:
667
+ audio_feature_len = self._get_feat_extract_output_lengths(audio_len)
668
+ max_seq_len = hidden_states.shape[1]
669
+ attention_mask = torch.arange(max_seq_len, device=hidden_states.device)[
670
+ None, :
671
+ ].lt(audio_feature_len.view(-1, 1))
672
+ attention_mask = self.get_extended_attention_mask(
673
+ attention_mask,
674
+ None,
675
+ device=hidden_states.device,
676
+ dtype=hidden_states.dtype,
677
+ )
678
+
679
+ if self.audio_streaming_mask is not None:
680
+ seqlen = hidden_states.size(-2)
681
+ if attention_mask is not None:
682
+ attention_mask = torch.minimum(
683
+ self.audio_streaming_mask[:, :, :seqlen, :seqlen], attention_mask
684
+ ) # merge
685
+ else:
686
+ attention_mask = self.audio_streaming_mask[:, :, :seqlen, :seqlen]
687
+ attention_mask = attention_mask.to(hidden_states.dtype)
688
+
689
+ # check if head_mask has a correct number of layers specified if desired
690
+ if head_mask is not None:
691
+ assert head_mask.size()[0] == (
692
+ len(self.layers)
693
+ ), f"The head_mask should be specified for {len(self.layers)} layers, but it is for {head_mask.size()[0]}."
694
+
695
+ for idx, encoder_layer in enumerate(self.layers):
696
+ if output_hidden_states:
697
+ encoder_states = encoder_states + (hidden_states,)
698
+ # add LayerDrop (see https://arxiv.org/abs/1909.11556 for description)
699
+ to_drop = False
700
+ if self.training:
701
+ dropout_probability = torch.rand([])
702
+ if dropout_probability < self.layerdrop: # skip the layer
703
+ to_drop = True
704
+
705
+ if to_drop:
706
+ layer_outputs = (None, None)
707
+ else:
708
+ if self.gradient_checkpointing and self.training:
709
+ layer_outputs = self._gradient_checkpointing_func(
710
+ encoder_layer.__call__,
711
+ hidden_states,
712
+ attention_mask,
713
+ (head_mask[idx] if head_mask is not None else None),
714
+ output_attentions,
715
+ )
716
+ else:
717
+ layer_outputs = encoder_layer(
718
+ hidden_states,
719
+ attention_mask,
720
+ layer_head_mask=(
721
+ head_mask[idx] if head_mask is not None else None
722
+ ),
723
+ output_attentions=output_attentions,
724
+ )
725
+
726
+ hidden_states = layer_outputs[0]
727
+
728
+ if output_attentions:
729
+ all_attentions = all_attentions + (layer_outputs[1],)
730
+
731
+ hidden_states = self.layer_norm(hidden_states)
732
+ if output_hidden_states:
733
+ encoder_states = encoder_states + (hidden_states,)
734
+
735
+ if not return_dict:
736
+ return tuple(
737
+ v
738
+ for v in [hidden_states, encoder_states, all_attentions]
739
+ if v is not None
740
+ )
741
+ return transformers.modeling_outputs.BaseModelOutput(
742
+ last_hidden_state=hidden_states,
743
+ hidden_states=encoder_states,
744
+ attentions=all_attentions,
745
+ )
746
+
747
+
748
+ UltravoxConfig.register_for_auto_class()
749
+ UltravoxModel.register_for_auto_class()
750
+
751
+ transformers.AutoConfig.register("ultravox", UltravoxConfig)
752
+ transformers.AutoModel.register(UltravoxConfig, UltravoxModel)
753
+
754
+ transformers.activations.ACT2FN["swiglu"] = SwiGLU
checkpoint-10800/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-14400/config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UltravoxModel"
4
+ ],
5
+ "audio_latency_block_size": null,
6
+ "audio_model_id": "openai/whisper-large-v3-turbo",
7
+ "audio_model_lora_config": {
8
+ "lora_alpha": 8,
9
+ "r": 0,
10
+ "target_modules": [
11
+ "k_proj",
12
+ "q_proj",
13
+ "linear_k",
14
+ "linear_q"
15
+ ]
16
+ },
17
+ "auto_map": {
18
+ "AutoConfig": "ultravox_config.UltravoxConfig",
19
+ "AutoModel": "ultravox_model.UltravoxModel"
20
+ },
21
+ "hidden_size": 4096,
22
+ "ignore_index": -100,
23
+ "initializer_range": 0.02,
24
+ "model_type": "ultravox",
25
+ "norm_init": 0.4,
26
+ "pad_token_id": 2,
27
+ "projector_act": "swiglu",
28
+ "projector_ln_mid": false,
29
+ "stack_factor": 8,
30
+ "text_model_id": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
31
+ "text_model_lora_config": {
32
+ "lora_alpha": 8,
33
+ "r": 0,
34
+ "target_modules": [
35
+ "k_proj",
36
+ "q_proj",
37
+ "linear_k",
38
+ "linear_q"
39
+ ]
40
+ },
41
+ "torch_dtype": "bfloat16",
42
+ "transformers_version": "4.47.0",
43
+ "vocab_size": 49152
44
+ }
checkpoint-14400/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "4.47.0"
7
+ }
checkpoint-14400/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-14400/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8bdd0552282a75251fa0430873e29cc491e32579e4b6657f51579c7f5aa99ef
3
+ size 92299736
checkpoint-14400/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18631729e7d0e9597a4c02ca2b6facf9c52b83c22ea7c0e485c889fcb50a476f
3
+ size 184602962
checkpoint-14400/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:178471e10e4ada9e88a29563afc3ad35ab4ec31626343f0d29085b1cd7647911
3
+ size 14244
checkpoint-14400/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c57798d3fa88e9f7f19098498af2fbd85578814b976457ff05f5a72957807e9
3
+ size 1064
checkpoint-14400/special_tokens_map.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<|im_start|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "eos_token": {
14
+ "content": "<|im_end|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "pad_token": "<|im_end|>",
21
+ "unk_token": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ }
28
+ }
checkpoint-14400/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-14400/tokenizer_config.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<repo_name>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<reponame>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<file_sep>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<filename>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<gh_stars>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_start>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_comment>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<issue_closed>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_start>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_text>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_code>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<jupyter_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<jupyter_script>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<empty_output>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ }
140
+ },
141
+ "additional_special_tokens": [
142
+ "<|im_start|>",
143
+ "<|im_end|>"
144
+ ],
145
+ "bos_token": "<|im_start|>",
146
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
147
+ "clean_up_tokenization_spaces": false,
148
+ "eos_token": "<|im_end|>",
149
+ "extra_special_tokens": {},
150
+ "model_max_length": 8192,
151
+ "pad_token": "<|im_end|>",
152
+ "tokenizer_class": "GPT2Tokenizer",
153
+ "unk_token": "<|endoftext|>",
154
+ "vocab_size": 49152
155
+ }
checkpoint-14400/trainer_state.json ADDED
@@ -0,0 +1,1174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.11984619738002897,
5
+ "eval_steps": 1000,
6
+ "global_step": 14400,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 8.322652595835345e-06,
13
+ "grad_norm": 14.9375,
14
+ "learning_rate": 2e-06,
15
+ "loss": 0.6484,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.0008322652595835345,
20
+ "grad_norm": 0.3671875,
21
+ "learning_rate": 0.0002,
22
+ "loss": 0.4345,
23
+ "step": 100
24
+ },
25
+ {
26
+ "epoch": 0.001664530519167069,
27
+ "grad_norm": 0.1689453125,
28
+ "learning_rate": 0.0004,
29
+ "loss": 0.2537,
30
+ "step": 200
31
+ },
32
+ {
33
+ "epoch": 0.0024967957787506035,
34
+ "grad_norm": 0.55859375,
35
+ "learning_rate": 0.0006,
36
+ "loss": 0.2344,
37
+ "step": 300
38
+ },
39
+ {
40
+ "epoch": 0.003329061038334138,
41
+ "grad_norm": 0.154296875,
42
+ "learning_rate": 0.0008,
43
+ "loss": 0.222,
44
+ "step": 400
45
+ },
46
+ {
47
+ "epoch": 0.004161326297917672,
48
+ "grad_norm": 0.126953125,
49
+ "learning_rate": 0.001,
50
+ "loss": 0.2142,
51
+ "step": 500
52
+ },
53
+ {
54
+ "epoch": 0.004993591557501207,
55
+ "grad_norm": 0.12353515625,
56
+ "learning_rate": 0.0012,
57
+ "loss": 0.2011,
58
+ "step": 600
59
+ },
60
+ {
61
+ "epoch": 0.005825856817084741,
62
+ "grad_norm": 0.10693359375,
63
+ "learning_rate": 0.0014,
64
+ "loss": 0.1897,
65
+ "step": 700
66
+ },
67
+ {
68
+ "epoch": 0.006658122076668276,
69
+ "grad_norm": 0.10595703125,
70
+ "learning_rate": 0.0016,
71
+ "loss": 0.1775,
72
+ "step": 800
73
+ },
74
+ {
75
+ "epoch": 0.0074903873362518105,
76
+ "grad_norm": 0.0859375,
77
+ "learning_rate": 0.0018000000000000002,
78
+ "loss": 0.1615,
79
+ "step": 900
80
+ },
81
+ {
82
+ "epoch": 0.008322652595835344,
83
+ "grad_norm": 0.083984375,
84
+ "learning_rate": 0.002,
85
+ "loss": 0.1444,
86
+ "step": 1000
87
+ },
88
+ {
89
+ "epoch": 0.008322652595835344,
90
+ "eval_peoplespeech-clean-transcription_loss": 2.2110702991485596,
91
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
92
+ "eval_peoplespeech-clean-transcription_runtime": 9.5405,
93
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.708,
94
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
95
+ "step": 1000
96
+ },
97
+ {
98
+ "epoch": 0.009154917855418878,
99
+ "grad_norm": 0.0771484375,
100
+ "learning_rate": 0.001999725185109816,
101
+ "loss": 0.1323,
102
+ "step": 1100
103
+ },
104
+ {
105
+ "epoch": 0.009987183115002414,
106
+ "grad_norm": 0.083984375,
107
+ "learning_rate": 0.0019989008914857113,
108
+ "loss": 0.1242,
109
+ "step": 1200
110
+ },
111
+ {
112
+ "epoch": 0.010819448374585948,
113
+ "grad_norm": 0.07861328125,
114
+ "learning_rate": 0.00199752757218401,
115
+ "loss": 0.1162,
116
+ "step": 1300
117
+ },
118
+ {
119
+ "epoch": 0.011651713634169482,
120
+ "grad_norm": 0.07275390625,
121
+ "learning_rate": 0.001995605982021898,
122
+ "loss": 0.1128,
123
+ "step": 1400
124
+ },
125
+ {
126
+ "epoch": 0.012483978893753018,
127
+ "grad_norm": 0.07666015625,
128
+ "learning_rate": 0.0019931371771625545,
129
+ "loss": 0.1094,
130
+ "step": 1500
131
+ },
132
+ {
133
+ "epoch": 0.013316244153336551,
134
+ "grad_norm": 0.06201171875,
135
+ "learning_rate": 0.001990122514534651,
136
+ "loss": 0.1052,
137
+ "step": 1600
138
+ },
139
+ {
140
+ "epoch": 0.014148509412920085,
141
+ "grad_norm": 0.058837890625,
142
+ "learning_rate": 0.0019865636510865464,
143
+ "loss": 0.1022,
144
+ "step": 1700
145
+ },
146
+ {
147
+ "epoch": 0.014980774672503621,
148
+ "grad_norm": 0.0625,
149
+ "learning_rate": 0.001982462542875576,
150
+ "loss": 0.1011,
151
+ "step": 1800
152
+ },
153
+ {
154
+ "epoch": 0.015813039932087155,
155
+ "grad_norm": 0.06787109375,
156
+ "learning_rate": 0.001977821443992945,
157
+ "loss": 0.0983,
158
+ "step": 1900
159
+ },
160
+ {
161
+ "epoch": 0.01664530519167069,
162
+ "grad_norm": 0.0537109375,
163
+ "learning_rate": 0.001972642905324813,
164
+ "loss": 0.0975,
165
+ "step": 2000
166
+ },
167
+ {
168
+ "epoch": 0.01664530519167069,
169
+ "eval_peoplespeech-clean-transcription_loss": 1.6914767026901245,
170
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
171
+ "eval_peoplespeech-clean-transcription_runtime": 9.5301,
172
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.716,
173
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
174
+ "step": 2000
175
+ },
176
+ {
177
+ "epoch": 0.017477570451254223,
178
+ "grad_norm": 0.05859375,
179
+ "learning_rate": 0.0019669297731502505,
180
+ "loss": 0.0947,
181
+ "step": 2100
182
+ },
183
+ {
184
+ "epoch": 0.018309835710837757,
185
+ "grad_norm": 0.062255859375,
186
+ "learning_rate": 0.00196068518757684,
187
+ "loss": 0.0935,
188
+ "step": 2200
189
+ },
190
+ {
191
+ "epoch": 0.019142100970421294,
192
+ "grad_norm": 0.059326171875,
193
+ "learning_rate": 0.001953912580814779,
194
+ "loss": 0.0911,
195
+ "step": 2300
196
+ },
197
+ {
198
+ "epoch": 0.019974366230004828,
199
+ "grad_norm": 0.060302734375,
200
+ "learning_rate": 0.0019466156752904343,
201
+ "loss": 0.0904,
202
+ "step": 2400
203
+ },
204
+ {
205
+ "epoch": 0.020806631489588362,
206
+ "grad_norm": 0.0615234375,
207
+ "learning_rate": 0.0019387984816003866,
208
+ "loss": 0.0882,
209
+ "step": 2500
210
+ },
211
+ {
212
+ "epoch": 0.021638896749171896,
213
+ "grad_norm": 0.056884765625,
214
+ "learning_rate": 0.0019304652963070869,
215
+ "loss": 0.0874,
216
+ "step": 2600
217
+ },
218
+ {
219
+ "epoch": 0.02247116200875543,
220
+ "grad_norm": 0.049072265625,
221
+ "learning_rate": 0.0019216206995773372,
222
+ "loss": 0.0871,
223
+ "step": 2700
224
+ },
225
+ {
226
+ "epoch": 0.023303427268338964,
227
+ "grad_norm": 0.053955078125,
228
+ "learning_rate": 0.0019122695526648968,
229
+ "loss": 0.0856,
230
+ "step": 2800
231
+ },
232
+ {
233
+ "epoch": 0.0241356925279225,
234
+ "grad_norm": 0.05517578125,
235
+ "learning_rate": 0.0019024169952385887,
236
+ "loss": 0.0845,
237
+ "step": 2900
238
+ },
239
+ {
240
+ "epoch": 0.024967957787506035,
241
+ "grad_norm": 0.0546875,
242
+ "learning_rate": 0.0018920684425573864,
243
+ "loss": 0.0852,
244
+ "step": 3000
245
+ },
246
+ {
247
+ "epoch": 0.024967957787506035,
248
+ "eval_peoplespeech-clean-transcription_loss": 1.6414048671722412,
249
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
250
+ "eval_peoplespeech-clean-transcription_runtime": 9.8151,
251
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.521,
252
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.815,
253
+ "step": 3000
254
+ },
255
+ {
256
+ "epoch": 0.02580022304708957,
257
+ "grad_norm": 0.052978515625,
258
+ "learning_rate": 0.0018812295824940284,
259
+ "loss": 0.0836,
260
+ "step": 3100
261
+ },
262
+ {
263
+ "epoch": 0.026632488306673103,
264
+ "grad_norm": 0.05126953125,
265
+ "learning_rate": 0.0018699063724087904,
266
+ "loss": 0.0821,
267
+ "step": 3200
268
+ },
269
+ {
270
+ "epoch": 0.027464753566256637,
271
+ "grad_norm": 0.056884765625,
272
+ "learning_rate": 0.0018581050358751443,
273
+ "loss": 0.0816,
274
+ "step": 3300
275
+ },
276
+ {
277
+ "epoch": 0.02829701882584017,
278
+ "grad_norm": 0.045654296875,
279
+ "learning_rate": 0.0018458320592590974,
280
+ "loss": 0.0814,
281
+ "step": 3400
282
+ },
283
+ {
284
+ "epoch": 0.029129284085423705,
285
+ "grad_norm": 0.04638671875,
286
+ "learning_rate": 0.0018330941881540914,
287
+ "loss": 0.0791,
288
+ "step": 3500
289
+ },
290
+ {
291
+ "epoch": 0.029961549345007242,
292
+ "grad_norm": 0.043212890625,
293
+ "learning_rate": 0.0018198984236734246,
294
+ "loss": 0.0804,
295
+ "step": 3600
296
+ },
297
+ {
298
+ "epoch": 0.030793814604590776,
299
+ "grad_norm": 0.054931640625,
300
+ "learning_rate": 0.0018062520186022297,
301
+ "loss": 0.0802,
302
+ "step": 3700
303
+ },
304
+ {
305
+ "epoch": 0.03162607986417431,
306
+ "grad_norm": 0.054931640625,
307
+ "learning_rate": 0.0017921624734111292,
308
+ "loss": 0.0805,
309
+ "step": 3800
310
+ },
311
+ {
312
+ "epoch": 0.032458345123757844,
313
+ "grad_norm": 0.048095703125,
314
+ "learning_rate": 0.001777637532133752,
315
+ "loss": 0.079,
316
+ "step": 3900
317
+ },
318
+ {
319
+ "epoch": 0.03329061038334138,
320
+ "grad_norm": 0.0458984375,
321
+ "learning_rate": 0.0017626851781103819,
322
+ "loss": 0.0759,
323
+ "step": 4000
324
+ },
325
+ {
326
+ "epoch": 0.03329061038334138,
327
+ "eval_peoplespeech-clean-transcription_loss": 1.5952188968658447,
328
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
329
+ "eval_peoplespeech-clean-transcription_runtime": 9.4647,
330
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.762,
331
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.845,
332
+ "step": 4000
333
+ },
334
+ {
335
+ "epoch": 0.03412287564292491,
336
+ "grad_norm": 0.06494140625,
337
+ "learning_rate": 0.001747313629600077,
338
+ "loss": 0.0774,
339
+ "step": 4100
340
+ },
341
+ {
342
+ "epoch": 0.034955140902508446,
343
+ "grad_norm": 0.043701171875,
344
+ "learning_rate": 0.001731531335263669,
345
+ "loss": 0.0774,
346
+ "step": 4200
347
+ },
348
+ {
349
+ "epoch": 0.03578740616209198,
350
+ "grad_norm": 0.048095703125,
351
+ "learning_rate": 0.0017153469695201276,
352
+ "loss": 0.0769,
353
+ "step": 4300
354
+ },
355
+ {
356
+ "epoch": 0.03661967142167551,
357
+ "grad_norm": 0.051513671875,
358
+ "learning_rate": 0.0016987694277788418,
359
+ "loss": 0.0763,
360
+ "step": 4400
361
+ },
362
+ {
363
+ "epoch": 0.037451936681259054,
364
+ "grad_norm": 0.047607421875,
365
+ "learning_rate": 0.001681807821550438,
366
+ "loss": 0.0774,
367
+ "step": 4500
368
+ },
369
+ {
370
+ "epoch": 0.03828420194084259,
371
+ "grad_norm": 0.040283203125,
372
+ "learning_rate": 0.0016644714734388218,
373
+ "loss": 0.0748,
374
+ "step": 4600
375
+ },
376
+ {
377
+ "epoch": 0.03911646720042612,
378
+ "grad_norm": 0.05419921875,
379
+ "learning_rate": 0.0016467699120171987,
380
+ "loss": 0.0755,
381
+ "step": 4700
382
+ },
383
+ {
384
+ "epoch": 0.039948732460009656,
385
+ "grad_norm": 0.048828125,
386
+ "learning_rate": 0.001628712866590885,
387
+ "loss": 0.0732,
388
+ "step": 4800
389
+ },
390
+ {
391
+ "epoch": 0.04078099771959319,
392
+ "grad_norm": 0.046875,
393
+ "learning_rate": 0.0016103102618497923,
394
+ "loss": 0.0757,
395
+ "step": 4900
396
+ },
397
+ {
398
+ "epoch": 0.041613262979176724,
399
+ "grad_norm": 0.042236328125,
400
+ "learning_rate": 0.0015915722124135226,
401
+ "loss": 0.0738,
402
+ "step": 5000
403
+ },
404
+ {
405
+ "epoch": 0.041613262979176724,
406
+ "eval_peoplespeech-clean-transcription_loss": 1.5546748638153076,
407
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
408
+ "eval_peoplespeech-clean-transcription_runtime": 9.345,
409
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.849,
410
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.856,
411
+ "step": 5000
412
+ },
413
+ {
414
+ "epoch": 0.04244552823876026,
415
+ "grad_norm": 0.045166015625,
416
+ "learning_rate": 0.001572509017272072,
417
+ "loss": 0.0742,
418
+ "step": 5100
419
+ },
420
+ {
421
+ "epoch": 0.04327779349834379,
422
+ "grad_norm": 0.0556640625,
423
+ "learning_rate": 0.0015531311541251993,
424
+ "loss": 0.0746,
425
+ "step": 5200
426
+ },
427
+ {
428
+ "epoch": 0.044110058757927326,
429
+ "grad_norm": 0.043212890625,
430
+ "learning_rate": 0.0015334492736235703,
431
+ "loss": 0.073,
432
+ "step": 5300
433
+ },
434
+ {
435
+ "epoch": 0.04494232401751086,
436
+ "grad_norm": 0.044921875,
437
+ "learning_rate": 0.0015134741935148419,
438
+ "loss": 0.0727,
439
+ "step": 5400
440
+ },
441
+ {
442
+ "epoch": 0.045774589277094394,
443
+ "grad_norm": 0.05029296875,
444
+ "learning_rate": 0.0014932168926979072,
445
+ "loss": 0.0726,
446
+ "step": 5500
447
+ },
448
+ {
449
+ "epoch": 0.04660685453667793,
450
+ "grad_norm": 0.048095703125,
451
+ "learning_rate": 0.0014726885051885652,
452
+ "loss": 0.0718,
453
+ "step": 5600
454
+ },
455
+ {
456
+ "epoch": 0.04743911979626146,
457
+ "grad_norm": 0.046875,
458
+ "learning_rate": 0.0014519003139999338,
459
+ "loss": 0.0736,
460
+ "step": 5700
461
+ },
462
+ {
463
+ "epoch": 0.048271385055845,
464
+ "grad_norm": 0.051513671875,
465
+ "learning_rate": 0.0014308637449409706,
466
+ "loss": 0.0724,
467
+ "step": 5800
468
+ },
469
+ {
470
+ "epoch": 0.049103650315428536,
471
+ "grad_norm": 0.053955078125,
472
+ "learning_rate": 0.0014095903603365066,
473
+ "loss": 0.0724,
474
+ "step": 5900
475
+ },
476
+ {
477
+ "epoch": 0.04993591557501207,
478
+ "grad_norm": 0.037841796875,
479
+ "learning_rate": 0.0013880918526722496,
480
+ "loss": 0.071,
481
+ "step": 6000
482
+ },
483
+ {
484
+ "epoch": 0.04993591557501207,
485
+ "eval_peoplespeech-clean-transcription_loss": 1.5297455787658691,
486
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
487
+ "eval_peoplespeech-clean-transcription_runtime": 9.3364,
488
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.855,
489
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.857,
490
+ "step": 6000
491
+ },
492
+ {
493
+ "epoch": 0.050768180834595604,
494
+ "grad_norm": 0.05029296875,
495
+ "learning_rate": 0.0013663800381682463,
496
+ "loss": 0.0713,
497
+ "step": 6100
498
+ },
499
+ {
500
+ "epoch": 0.05160044609417914,
501
+ "grad_norm": 0.037109375,
502
+ "learning_rate": 0.0013444668502843329,
503
+ "loss": 0.0701,
504
+ "step": 6200
505
+ },
506
+ {
507
+ "epoch": 0.05243271135376267,
508
+ "grad_norm": 0.03564453125,
509
+ "learning_rate": 0.0013223643331611537,
510
+ "loss": 0.0708,
511
+ "step": 6300
512
+ },
513
+ {
514
+ "epoch": 0.053264976613346206,
515
+ "grad_norm": 0.04443359375,
516
+ "learning_rate": 0.001300084635000341,
517
+ "loss": 0.0707,
518
+ "step": 6400
519
+ },
520
+ {
521
+ "epoch": 0.05409724187292974,
522
+ "grad_norm": 0.033935546875,
523
+ "learning_rate": 0.0012776400013875004,
524
+ "loss": 0.0704,
525
+ "step": 6500
526
+ },
527
+ {
528
+ "epoch": 0.054929507132513274,
529
+ "grad_norm": 0.046142578125,
530
+ "learning_rate": 0.0012550427685616766,
531
+ "loss": 0.0707,
532
+ "step": 6600
533
+ },
534
+ {
535
+ "epoch": 0.05576177239209681,
536
+ "grad_norm": 0.04150390625,
537
+ "learning_rate": 0.0012323053566349834,
538
+ "loss": 0.0696,
539
+ "step": 6700
540
+ },
541
+ {
542
+ "epoch": 0.05659403765168034,
543
+ "grad_norm": 0.042236328125,
544
+ "learning_rate": 0.0012094402627661448,
545
+ "loss": 0.0705,
546
+ "step": 6800
547
+ },
548
+ {
549
+ "epoch": 0.057426302911263875,
550
+ "grad_norm": 0.035888671875,
551
+ "learning_rate": 0.0011864600542916813,
552
+ "loss": 0.0686,
553
+ "step": 6900
554
+ },
555
+ {
556
+ "epoch": 0.05825856817084741,
557
+ "grad_norm": 0.0498046875,
558
+ "learning_rate": 0.0011633773618185302,
559
+ "loss": 0.0687,
560
+ "step": 7000
561
+ },
562
+ {
563
+ "epoch": 0.05825856817084741,
564
+ "eval_peoplespeech-clean-transcription_loss": 1.518404483795166,
565
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
566
+ "eval_peoplespeech-clean-transcription_runtime": 9.4703,
567
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.758,
568
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.845,
569
+ "step": 7000
570
+ },
571
+ {
572
+ "epoch": 0.05909083343043095,
573
+ "grad_norm": 0.034423828125,
574
+ "learning_rate": 0.0011402048722818862,
575
+ "loss": 0.0693,
576
+ "step": 7100
577
+ },
578
+ {
579
+ "epoch": 0.059923098690014484,
580
+ "grad_norm": 0.047119140625,
581
+ "learning_rate": 0.0011169553219720827,
582
+ "loss": 0.0697,
583
+ "step": 7200
584
+ },
585
+ {
586
+ "epoch": 0.06075536394959802,
587
+ "grad_norm": 0.0576171875,
588
+ "learning_rate": 0.001093641489534351,
589
+ "loss": 0.0685,
590
+ "step": 7300
591
+ },
592
+ {
593
+ "epoch": 0.06158762920918155,
594
+ "grad_norm": 0.052490234375,
595
+ "learning_rate": 0.001070276188945293,
596
+ "loss": 0.0666,
597
+ "step": 7400
598
+ },
599
+ {
600
+ "epoch": 0.062419894468765086,
601
+ "grad_norm": 0.043212890625,
602
+ "learning_rate": 0.00104687226246994,
603
+ "loss": 0.0692,
604
+ "step": 7500
605
+ },
606
+ {
607
+ "epoch": 0.06325215972834862,
608
+ "grad_norm": 0.04052734375,
609
+ "learning_rate": 0.0010234425736032607,
610
+ "loss": 0.069,
611
+ "step": 7600
612
+ },
613
+ {
614
+ "epoch": 0.06408442498793215,
615
+ "grad_norm": 0.06298828125,
616
+ "learning_rate": 0.001,
617
+ "loss": 0.0682,
618
+ "step": 7700
619
+ },
620
+ {
621
+ "epoch": 0.06491669024751569,
622
+ "grad_norm": 0.04736328125,
623
+ "learning_rate": 0.0009765574263967396,
624
+ "loss": 0.0676,
625
+ "step": 7800
626
+ },
627
+ {
628
+ "epoch": 0.06574895550709922,
629
+ "grad_norm": 0.064453125,
630
+ "learning_rate": 0.0009531277375300599,
631
+ "loss": 0.0685,
632
+ "step": 7900
633
+ },
634
+ {
635
+ "epoch": 0.06658122076668276,
636
+ "grad_norm": 0.037109375,
637
+ "learning_rate": 0.0009297238110547074,
638
+ "loss": 0.0677,
639
+ "step": 8000
640
+ },
641
+ {
642
+ "epoch": 0.06658122076668276,
643
+ "eval_peoplespeech-clean-transcription_loss": 1.5178765058517456,
644
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
645
+ "eval_peoplespeech-clean-transcription_runtime": 9.3361,
646
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.855,
647
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.857,
648
+ "step": 8000
649
+ },
650
+ {
651
+ "epoch": 0.06741348602626629,
652
+ "grad_norm": 0.041259765625,
653
+ "learning_rate": 0.0009063585104656494,
654
+ "loss": 0.068,
655
+ "step": 8100
656
+ },
657
+ {
658
+ "epoch": 0.06824575128584982,
659
+ "grad_norm": 0.0390625,
660
+ "learning_rate": 0.0008830446780279176,
661
+ "loss": 0.0681,
662
+ "step": 8200
663
+ },
664
+ {
665
+ "epoch": 0.06907801654543336,
666
+ "grad_norm": 0.043212890625,
667
+ "learning_rate": 0.0008597951277181142,
668
+ "loss": 0.0677,
669
+ "step": 8300
670
+ },
671
+ {
672
+ "epoch": 0.06991028180501689,
673
+ "grad_norm": 0.054443359375,
674
+ "learning_rate": 0.0008366226381814697,
675
+ "loss": 0.0679,
676
+ "step": 8400
677
+ },
678
+ {
679
+ "epoch": 0.07074254706460043,
680
+ "grad_norm": 0.036865234375,
681
+ "learning_rate": 0.000813539945708319,
682
+ "loss": 0.0685,
683
+ "step": 8500
684
+ },
685
+ {
686
+ "epoch": 0.07157481232418396,
687
+ "grad_norm": 0.036865234375,
688
+ "learning_rate": 0.0007905597372338558,
689
+ "loss": 0.0678,
690
+ "step": 8600
691
+ },
692
+ {
693
+ "epoch": 0.07240707758376749,
694
+ "grad_norm": 0.03466796875,
695
+ "learning_rate": 0.0007676946433650169,
696
+ "loss": 0.0671,
697
+ "step": 8700
698
+ },
699
+ {
700
+ "epoch": 0.07323934284335103,
701
+ "grad_norm": 0.03857421875,
702
+ "learning_rate": 0.0007449572314383236,
703
+ "loss": 0.0659,
704
+ "step": 8800
705
+ },
706
+ {
707
+ "epoch": 0.07407160810293456,
708
+ "grad_norm": 0.04248046875,
709
+ "learning_rate": 0.0007223599986124993,
710
+ "loss": 0.0657,
711
+ "step": 8900
712
+ },
713
+ {
714
+ "epoch": 0.07490387336251811,
715
+ "grad_norm": 0.0517578125,
716
+ "learning_rate": 0.0006999153649996595,
717
+ "loss": 0.0662,
718
+ "step": 9000
719
+ },
720
+ {
721
+ "epoch": 0.07490387336251811,
722
+ "eval_peoplespeech-clean-transcription_loss": 1.49990975856781,
723
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
724
+ "eval_peoplespeech-clean-transcription_runtime": 9.6057,
725
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.663,
726
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.833,
727
+ "step": 9000
728
+ },
729
+ {
730
+ "epoch": 0.07573613862210164,
731
+ "grad_norm": 0.05419921875,
732
+ "learning_rate": 0.0006776356668388464,
733
+ "loss": 0.0659,
734
+ "step": 9100
735
+ },
736
+ {
737
+ "epoch": 0.07656840388168518,
738
+ "grad_norm": 0.041015625,
739
+ "learning_rate": 0.0006555331497156671,
740
+ "loss": 0.0656,
741
+ "step": 9200
742
+ },
743
+ {
744
+ "epoch": 0.07740066914126871,
745
+ "grad_norm": 0.08203125,
746
+ "learning_rate": 0.0006336199618317538,
747
+ "loss": 0.0663,
748
+ "step": 9300
749
+ },
750
+ {
751
+ "epoch": 0.07823293440085224,
752
+ "grad_norm": 0.03271484375,
753
+ "learning_rate": 0.0006119081473277501,
754
+ "loss": 0.0663,
755
+ "step": 9400
756
+ },
757
+ {
758
+ "epoch": 0.07906519966043578,
759
+ "grad_norm": 0.043212890625,
760
+ "learning_rate": 0.0005904096396634935,
761
+ "loss": 0.0642,
762
+ "step": 9500
763
+ },
764
+ {
765
+ "epoch": 0.07989746492001931,
766
+ "grad_norm": 0.03271484375,
767
+ "learning_rate": 0.0005691362550590297,
768
+ "loss": 0.0644,
769
+ "step": 9600
770
+ },
771
+ {
772
+ "epoch": 0.08072973017960285,
773
+ "grad_norm": 0.047607421875,
774
+ "learning_rate": 0.0005480996860000663,
775
+ "loss": 0.0648,
776
+ "step": 9700
777
+ },
778
+ {
779
+ "epoch": 0.08156199543918638,
780
+ "grad_norm": 0.03955078125,
781
+ "learning_rate": 0.0005273114948114346,
782
+ "loss": 0.0655,
783
+ "step": 9800
784
+ },
785
+ {
786
+ "epoch": 0.08239426069876991,
787
+ "grad_norm": 0.048095703125,
788
+ "learning_rate": 0.0005067831073020928,
789
+ "loss": 0.0651,
790
+ "step": 9900
791
+ },
792
+ {
793
+ "epoch": 0.08322652595835345,
794
+ "grad_norm": 0.0299072265625,
795
+ "learning_rate": 0.00048652580648515787,
796
+ "loss": 0.066,
797
+ "step": 10000
798
+ },
799
+ {
800
+ "epoch": 0.08322652595835345,
801
+ "eval_peoplespeech-clean-transcription_loss": 1.489192247390747,
802
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
803
+ "eval_peoplespeech-clean-transcription_runtime": 9.4911,
804
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.743,
805
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.843,
806
+ "step": 10000
807
+ },
808
+ {
809
+ "epoch": 0.08405879121793698,
810
+ "grad_norm": 0.055908203125,
811
+ "learning_rate": 0.0004665507263764299,
812
+ "loss": 0.0653,
813
+ "step": 10100
814
+ },
815
+ {
816
+ "epoch": 0.08489105647752052,
817
+ "grad_norm": 0.039794921875,
818
+ "learning_rate": 0.0004468688458748006,
819
+ "loss": 0.065,
820
+ "step": 10200
821
+ },
822
+ {
823
+ "epoch": 0.08572332173710405,
824
+ "grad_norm": 0.05322265625,
825
+ "learning_rate": 0.0004274909827279283,
826
+ "loss": 0.0654,
827
+ "step": 10300
828
+ },
829
+ {
830
+ "epoch": 0.08655558699668758,
831
+ "grad_norm": 0.0419921875,
832
+ "learning_rate": 0.0004084277875864776,
833
+ "loss": 0.0648,
834
+ "step": 10400
835
+ },
836
+ {
837
+ "epoch": 0.08738785225627112,
838
+ "grad_norm": 0.050537109375,
839
+ "learning_rate": 0.00038968973815020803,
840
+ "loss": 0.0643,
841
+ "step": 10500
842
+ },
843
+ {
844
+ "epoch": 0.08822011751585465,
845
+ "grad_norm": 0.0458984375,
846
+ "learning_rate": 0.00037128713340911534,
847
+ "loss": 0.0669,
848
+ "step": 10600
849
+ },
850
+ {
851
+ "epoch": 0.08905238277543819,
852
+ "grad_norm": 0.05029296875,
853
+ "learning_rate": 0.00035323008798280133,
854
+ "loss": 0.0657,
855
+ "step": 10700
856
+ },
857
+ {
858
+ "epoch": 0.08988464803502172,
859
+ "grad_norm": 0.039794921875,
860
+ "learning_rate": 0.00033552852656117837,
861
+ "loss": 0.0646,
862
+ "step": 10800
863
+ },
864
+ {
865
+ "epoch": 0.09071691329460525,
866
+ "grad_norm": 0.04248046875,
867
+ "learning_rate": 0.00031819217844956217,
868
+ "loss": 0.0636,
869
+ "step": 10900
870
+ },
871
+ {
872
+ "epoch": 0.09154917855418879,
873
+ "grad_norm": 0.05029296875,
874
+ "learning_rate": 0.00030123057222115836,
875
+ "loss": 0.0658,
876
+ "step": 11000
877
+ },
878
+ {
879
+ "epoch": 0.09154917855418879,
880
+ "eval_peoplespeech-clean-transcription_loss": 1.4850726127624512,
881
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
882
+ "eval_peoplespeech-clean-transcription_runtime": 9.5339,
883
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.713,
884
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
885
+ "step": 11000
886
+ },
887
+ {
888
+ "epoch": 0.09238144381377232,
889
+ "grad_norm": 0.039794921875,
890
+ "learning_rate": 0.0002846530304798727,
891
+ "loss": 0.0641,
892
+ "step": 11100
893
+ },
894
+ {
895
+ "epoch": 0.09321370907335585,
896
+ "grad_norm": 0.048095703125,
897
+ "learning_rate": 0.00026846866473633125,
898
+ "loss": 0.065,
899
+ "step": 11200
900
+ },
901
+ {
902
+ "epoch": 0.09404597433293939,
903
+ "grad_norm": 0.0458984375,
904
+ "learning_rate": 0.00025268637039992293,
905
+ "loss": 0.065,
906
+ "step": 11300
907
+ },
908
+ {
909
+ "epoch": 0.09487823959252292,
910
+ "grad_norm": 0.045166015625,
911
+ "learning_rate": 0.00023731482188961818,
912
+ "loss": 0.0654,
913
+ "step": 11400
914
+ },
915
+ {
916
+ "epoch": 0.09571050485210646,
917
+ "grad_norm": 0.04150390625,
918
+ "learning_rate": 0.00022236246786624792,
919
+ "loss": 0.0661,
920
+ "step": 11500
921
+ },
922
+ {
923
+ "epoch": 0.09654277011169,
924
+ "grad_norm": 0.036376953125,
925
+ "learning_rate": 0.00020783752658887068,
926
+ "loss": 0.066,
927
+ "step": 11600
928
+ },
929
+ {
930
+ "epoch": 0.09737503537127354,
931
+ "grad_norm": 0.044189453125,
932
+ "learning_rate": 0.0001937479813977703,
933
+ "loss": 0.0649,
934
+ "step": 11700
935
+ },
936
+ {
937
+ "epoch": 0.09820730063085707,
938
+ "grad_norm": 0.037353515625,
939
+ "learning_rate": 0.00018010157632657541,
940
+ "loss": 0.0636,
941
+ "step": 11800
942
+ },
943
+ {
944
+ "epoch": 0.0990395658904406,
945
+ "grad_norm": 0.0341796875,
946
+ "learning_rate": 0.00016690581184590858,
947
+ "loss": 0.0649,
948
+ "step": 11900
949
+ },
950
+ {
951
+ "epoch": 0.09987183115002414,
952
+ "grad_norm": 0.052001953125,
953
+ "learning_rate": 0.00015416794074090258,
954
+ "loss": 0.0663,
955
+ "step": 12000
956
+ },
957
+ {
958
+ "epoch": 0.09987183115002414,
959
+ "eval_peoplespeech-clean-transcription_loss": 1.485172986984253,
960
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
961
+ "eval_peoplespeech-clean-transcription_runtime": 9.8864,
962
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.474,
963
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.809,
964
+ "step": 12000
965
+ },
966
+ {
967
+ "epoch": 0.10070409640960767,
968
+ "grad_norm": 0.0400390625,
969
+ "learning_rate": 0.00014189496412485593,
970
+ "loss": 0.0634,
971
+ "step": 12100
972
+ },
973
+ {
974
+ "epoch": 0.10153636166919121,
975
+ "grad_norm": 0.049072265625,
976
+ "learning_rate": 0.00013009362759120978,
977
+ "loss": 0.0641,
978
+ "step": 12200
979
+ },
980
+ {
981
+ "epoch": 0.10236862692877474,
982
+ "grad_norm": 0.054931640625,
983
+ "learning_rate": 0.00011877041750597173,
984
+ "loss": 0.0635,
985
+ "step": 12300
986
+ },
987
+ {
988
+ "epoch": 0.10320089218835828,
989
+ "grad_norm": 0.041015625,
990
+ "learning_rate": 0.00010793155744261352,
991
+ "loss": 0.0656,
992
+ "step": 12400
993
+ },
994
+ {
995
+ "epoch": 0.10403315744794181,
996
+ "grad_norm": 0.042724609375,
997
+ "learning_rate": 9.758300476141169e-05,
998
+ "loss": 0.0658,
999
+ "step": 12500
1000
+ },
1001
+ {
1002
+ "epoch": 0.10486542270752534,
1003
+ "grad_norm": 0.046875,
1004
+ "learning_rate": 8.773044733510338e-05,
1005
+ "loss": 0.0655,
1006
+ "step": 12600
1007
+ },
1008
+ {
1009
+ "epoch": 0.10569768796710888,
1010
+ "grad_norm": 0.052001953125,
1011
+ "learning_rate": 7.837930042266262e-05,
1012
+ "loss": 0.0652,
1013
+ "step": 12700
1014
+ },
1015
+ {
1016
+ "epoch": 0.10652995322669241,
1017
+ "grad_norm": 0.044677734375,
1018
+ "learning_rate": 6.953470369291348e-05,
1019
+ "loss": 0.0652,
1020
+ "step": 12800
1021
+ },
1022
+ {
1023
+ "epoch": 0.10736221848627595,
1024
+ "grad_norm": 0.04443359375,
1025
+ "learning_rate": 6.120151839961363e-05,
1026
+ "loss": 0.0639,
1027
+ "step": 12900
1028
+ },
1029
+ {
1030
+ "epoch": 0.10819448374585948,
1031
+ "grad_norm": 0.03955078125,
1032
+ "learning_rate": 5.338432470956589e-05,
1033
+ "loss": 0.0648,
1034
+ "step": 13000
1035
+ },
1036
+ {
1037
+ "epoch": 0.10819448374585948,
1038
+ "eval_peoplespeech-clean-transcription_loss": 1.4848434925079346,
1039
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
1040
+ "eval_peoplespeech-clean-transcription_runtime": 9.5215,
1041
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.722,
1042
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.84,
1043
+ "step": 13000
1044
+ },
1045
+ {
1046
+ "epoch": 0.10902674900544301,
1047
+ "grad_norm": 0.04541015625,
1048
+ "learning_rate": 4.6087419185220966e-05,
1049
+ "loss": 0.0632,
1050
+ "step": 13100
1051
+ },
1052
+ {
1053
+ "epoch": 0.10985901426502655,
1054
+ "grad_norm": 0.050048828125,
1055
+ "learning_rate": 3.931481242315993e-05,
1056
+ "loss": 0.0624,
1057
+ "step": 13200
1058
+ },
1059
+ {
1060
+ "epoch": 0.11069127952461008,
1061
+ "grad_norm": 0.0439453125,
1062
+ "learning_rate": 3.307022684974936e-05,
1063
+ "loss": 0.0649,
1064
+ "step": 13300
1065
+ },
1066
+ {
1067
+ "epoch": 0.11152354478419362,
1068
+ "grad_norm": 0.047119140625,
1069
+ "learning_rate": 2.7357094675186987e-05,
1070
+ "loss": 0.0644,
1071
+ "step": 13400
1072
+ },
1073
+ {
1074
+ "epoch": 0.11235581004377715,
1075
+ "grad_norm": 0.042236328125,
1076
+ "learning_rate": 2.2178556007054874e-05,
1077
+ "loss": 0.0644,
1078
+ "step": 13500
1079
+ },
1080
+ {
1081
+ "epoch": 0.11318807530336068,
1082
+ "grad_norm": 0.03564453125,
1083
+ "learning_rate": 1.7537457124423894e-05,
1084
+ "loss": 0.0664,
1085
+ "step": 13600
1086
+ },
1087
+ {
1088
+ "epoch": 0.11402034056294422,
1089
+ "grad_norm": 0.05859375,
1090
+ "learning_rate": 1.3436348913453578e-05,
1091
+ "loss": 0.0653,
1092
+ "step": 13700
1093
+ },
1094
+ {
1095
+ "epoch": 0.11485260582252775,
1096
+ "grad_norm": 0.046875,
1097
+ "learning_rate": 9.877485465349056e-06,
1098
+ "loss": 0.0646,
1099
+ "step": 13800
1100
+ },
1101
+ {
1102
+ "epoch": 0.11568487108211128,
1103
+ "grad_norm": 0.030517578125,
1104
+ "learning_rate": 6.862822837445881e-06,
1105
+ "loss": 0.0663,
1106
+ "step": 13900
1107
+ },
1108
+ {
1109
+ "epoch": 0.11651713634169482,
1110
+ "grad_norm": 0.03759765625,
1111
+ "learning_rate": 4.394017978101905e-06,
1112
+ "loss": 0.0648,
1113
+ "step": 14000
1114
+ },
1115
+ {
1116
+ "epoch": 0.11651713634169482,
1117
+ "eval_peoplespeech-clean-transcription_loss": 1.4849343299865723,
1118
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
1119
+ "eval_peoplespeech-clean-transcription_runtime": 9.3501,
1120
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.845,
1121
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.856,
1122
+ "step": 14000
1123
+ },
1124
+ {
1125
+ "epoch": 0.11734940160127835,
1126
+ "grad_norm": 0.045166015625,
1127
+ "learning_rate": 2.472427815989886e-06,
1128
+ "loss": 0.0636,
1129
+ "step": 14100
1130
+ },
1131
+ {
1132
+ "epoch": 0.1181816668608619,
1133
+ "grad_norm": 0.0361328125,
1134
+ "learning_rate": 1.099108514288627e-06,
1135
+ "loss": 0.0646,
1136
+ "step": 14200
1137
+ },
1138
+ {
1139
+ "epoch": 0.11901393212044543,
1140
+ "grad_norm": 0.04052734375,
1141
+ "learning_rate": 2.748148901841052e-07,
1142
+ "loss": 0.0645,
1143
+ "step": 14300
1144
+ },
1145
+ {
1146
+ "epoch": 0.11984619738002897,
1147
+ "grad_norm": 0.056396484375,
1148
+ "learning_rate": 0.0,
1149
+ "loss": 0.0661,
1150
+ "step": 14400
1151
+ }
1152
+ ],
1153
+ "logging_steps": 100,
1154
+ "max_steps": 14400,
1155
+ "num_input_tokens_seen": 0,
1156
+ "num_train_epochs": 1,
1157
+ "save_steps": 3600,
1158
+ "stateful_callbacks": {
1159
+ "TrainerControl": {
1160
+ "args": {
1161
+ "should_epoch_stop": false,
1162
+ "should_evaluate": false,
1163
+ "should_log": false,
1164
+ "should_save": true,
1165
+ "should_training_stop": true
1166
+ },
1167
+ "attributes": {}
1168
+ }
1169
+ },
1170
+ "total_flos": 9.254469835026432e+17,
1171
+ "train_batch_size": 24,
1172
+ "trial_name": null,
1173
+ "trial_params": null
1174
+ }
checkpoint-14400/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37b86db64b66888697120b24a102f1ab62ab1d7da7b6bd4cd2e497d4499c3fb5
3
+ size 5688
checkpoint-14400/ultravox_config.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dataclasses
2
+ from enum import Enum
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ import transformers
6
+
7
+
8
+ @dataclasses.dataclass
9
+ class LoraConfigSimplified:
10
+ """
11
+ Low Rank Approximation (LoRA) configuration.
12
+
13
+ Used for language and audio models separately.
14
+ """
15
+
16
+ # The rank of the approximation
17
+ r: int = 0
18
+ lora_alpha: float = 8
19
+ target_modules: Optional[List[str]] = dataclasses.field(
20
+ default_factory=lambda: ["k_proj", "q_proj", "linear_k", "linear_q"]
21
+ )
22
+ # A list of module names regex patterns to unfreeze. Only used if r == 0.
23
+ unfreeze_layers: Optional[List[str]] = None
24
+
25
+
26
+ class LossFunction(str, Enum):
27
+ CrossEntropy = "ce"
28
+ KL_Divergence = "kl"
29
+
30
+
31
+ @dataclasses.dataclass
32
+ class LossConfig:
33
+ loss_function: LossFunction = LossFunction.CrossEntropy
34
+ kl_temperature: float = 2.0
35
+
36
+ @property
37
+ def requires_alt_fields(self):
38
+ return self.loss_function == LossFunction.KL_Divergence
39
+
40
+
41
+ class UltravoxConfig(transformers.PretrainedConfig):
42
+ r"""
43
+ This is the configuration class to store the configuration of a [`UltravoxForConditionalGeneration`]. It is used to instantiate an
44
+ Ultravox model according to the specified arguments, defining the model architecture.
45
+
46
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
47
+ documentation from [`PretrainedConfig`] for more information.
48
+
49
+ Args:
50
+ audio_config (`Wav2Vec2Config`, *optional*):
51
+ Custom audio config or dict
52
+ text_config (`Union[AutoConfig, dict]`, *optional*):
53
+ The config object of the text backbone. Can be any of `LlamaConfig` or `MistralConfig`.
54
+ ignore_index (`int`, *optional*, defaults to -100):
55
+ The ignore index for the loss function.
56
+ audio_token_index (`int`, *optional*, defaults to 32000):
57
+ The audio token index to encode the audio prompt.
58
+ stack_factor (`int`, *optional*, defaults to 8):
59
+ Audio downsampling factor for the multimodal projector.
60
+ norm_init (`float`, *optional*, defaults to 0.4):
61
+ The initialization value for the layer normalization.
62
+ projector_act (`str`, *optional*, defaults to `"swiglu"`):
63
+ The activation function used by the multimodal projector.
64
+ text_model_lora_config (`LoraConfigSimplified`, *optional*):
65
+ The LoRA configuration for finetuning the text model.
66
+ audio_model_lora_config (`LoraConfigSimplified`, *optional*):
67
+ The LoRA configuration for finetuning the audio model.
68
+ audio_latency_block_size (`int`, *optional*, defaults to `None`):
69
+ The latency block size for simulating audio streaming.
70
+
71
+
72
+ Example:
73
+
74
+ ```python
75
+ >>> from transformers import UltravoxModel, Wav2Vec2Config, UltravoxConfig, LlamaConfig
76
+
77
+ >>> # Initializing an audio encoder config
78
+ >>> audio_config = Wav2Vec2Config()
79
+
80
+ >>> # Initializing a Llama config
81
+ >>> text_config = LlamaConfig()
82
+
83
+ >>> # Initializing a default configuration
84
+ >>> configuration = UltravoxConfig(audio_config, text_config)
85
+
86
+ >>> # Initializing a completely untrained model from the configuration
87
+ >>> model = UltravoxModel(configuration)
88
+
89
+ >>> # Accessing the model configuration
90
+ >>> configuration = model.config
91
+
92
+ >>> # Initialize a model from pretrained checkpoints and random projector weights
93
+ >>> config = UltravoxConfig(audio_model_id="facebook/wav2vec2-base-960h", text_model_id="meta-llama/Llama-2-7b-chat-hf")
94
+ ```"""
95
+
96
+ model_type = "ultravox"
97
+ is_composition = False
98
+
99
+ def __init__(
100
+ self,
101
+ audio_config: Optional[Dict[str, Any]] = None,
102
+ text_config: Optional[Dict[str, Any]] = None,
103
+ audio_model_id: Optional[str] = None,
104
+ text_model_id: Optional[str] = None,
105
+ ignore_index: int = -100,
106
+ hidden_size: int = 4096,
107
+ stack_factor: int = 8,
108
+ norm_init: float = 0.4,
109
+ projector_act: str = "swiglu",
110
+ projector_ln_mid: bool = False, # defaults to False for compatibility with v0.4.1 and below
111
+ text_model_lora_config: Optional[LoraConfigSimplified] = None,
112
+ audio_model_lora_config: Optional[LoraConfigSimplified] = None,
113
+ audio_latency_block_size: Optional[int] = None,
114
+ **kwargs,
115
+ ):
116
+ self.ignore_index = ignore_index
117
+
118
+ self.audio_model_id = audio_model_id
119
+ self.text_model_id = text_model_id
120
+
121
+ self.hidden_size = hidden_size
122
+ self.stack_factor = stack_factor
123
+ self.norm_init = norm_init
124
+ self.projector_act = projector_act
125
+ self.projector_ln_mid = projector_ln_mid
126
+ if text_model_id is not None:
127
+ self.text_config: transformers.LlamaConfig = (
128
+ transformers.AutoConfig.from_pretrained(text_model_id)
129
+ )
130
+ else:
131
+ text_config = text_config or {}
132
+ self.text_config = transformers.CONFIG_MAPPING[
133
+ text_config.get("model_type", "llama")
134
+ ](**text_config)
135
+
136
+ if audio_model_id is not None:
137
+ self.audio_config: transformers.PretrainedConfig = (
138
+ transformers.AutoConfig.from_pretrained(audio_model_id)
139
+ )
140
+ else:
141
+ audio_config = audio_config or {}
142
+ self.audio_config = transformers.CONFIG_MAPPING[
143
+ audio_config.get("model_type", "wav2vec2")
144
+ ](**audio_config)
145
+
146
+ self.text_model_lora_config = (
147
+ text_model_lora_config
148
+ if isinstance(text_model_lora_config, dict)
149
+ else dataclasses.asdict(text_model_lora_config or LoraConfigSimplified())
150
+ )
151
+ self.audio_model_lora_config = (
152
+ audio_model_lora_config
153
+ if isinstance(audio_model_lora_config, dict)
154
+ else dataclasses.asdict(audio_model_lora_config or LoraConfigSimplified())
155
+ )
156
+ self.audio_latency_block_size = audio_latency_block_size
157
+
158
+ self.vocab_size = self.text_config.vocab_size
159
+
160
+ self.initializer_range = self.text_config.initializer_range
161
+
162
+ super().__init__(**kwargs)
163
+
164
+ def to_diff_dict(self) -> Dict[str, Any]:
165
+ diff_dict = super().to_diff_dict()
166
+
167
+ # remove text_config and audio_config if text_model_id and audio_model_id are present
168
+ if self.text_model_id is not None:
169
+ diff_dict.pop("text_config", None)
170
+ if self.audio_model_id is not None:
171
+ diff_dict.pop("audio_config", None)
172
+
173
+ return diff_dict
checkpoint-14400/ultravox_model.py ADDED
@@ -0,0 +1,754 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import re
3
+ from typing import Any, Dict, Optional, Set, Tuple, Union
4
+
5
+ import peft
6
+ import torch
7
+ import torch.nn as nn
8
+ import torch.nn.functional as F
9
+ import transformers
10
+ import transformers.activations
11
+ import transformers.modeling_outputs
12
+ import transformers.models
13
+ from transformers.models.whisper import modeling_whisper as whisper
14
+
15
+ # We must use relative import in this directory to allow uploading to HF Hub
16
+ # Even "from . import X" pattern doesn't work (undocumented and unclear why)
17
+ from .ultravox_config import LossConfig
18
+ from .ultravox_config import LossFunction
19
+ from .ultravox_config import UltravoxConfig
20
+
21
+
22
+ class UltravoxModel(transformers.LlamaPreTrainedModel):
23
+ """
24
+ The Ultravox model which consists of an audio encoder and a language model.
25
+
26
+ Audio input is processed by the audio encoder, then every `stack_factor` frames are stacked together and
27
+ projected to the language model's embedding space using a few linear layers.
28
+ The text is embedded by the language model as usual and then the audio and text embeddings are merged together.
29
+
30
+ A special token `<|audio|>` is used to indicate the start of the audio embeddings in the merged embeddings.
31
+
32
+ Parameters:
33
+ config: Model configuration class with all the parameters of the model.
34
+ """
35
+
36
+ config_class = UltravoxConfig
37
+ config: UltravoxConfig # for type hinting
38
+ # Usually we load encoder and LLM weights from a pretrained model separately, so they are allowed to be missing
39
+ _keys_to_ignore_on_load_missing = ["audio_tower.*", "language_model.*"]
40
+ # Since we have kwargs in forward, we need to set this to False, otherwise grad_accum_steps will cause incorrect train loss to be reported
41
+ # see https://github.com/huggingface/transformers/issues/35856 and https://github.com/huggingface/trl/pull/2615/files
42
+ accepts_loss_kwargs = False
43
+
44
+ def __init__(self, config: UltravoxConfig):
45
+ super().__init__(config)
46
+ self._register_load_state_dict_pre_hook(self._pre_load_state_dict_hook)
47
+
48
+ self.keep_params: Set[str] = set()
49
+ self.vocab_size = config.vocab_size
50
+
51
+ self.audio_tower = self._create_audio_tower(config)
52
+ self.multi_modal_projector = self._create_multi_modal_projector(config)
53
+ self.language_model = self._create_language_model(config)
54
+
55
+ # Determine no_split_modules dynamically to use with FSDP auto_wrap policy.
56
+ # FSDP throws an error if some of the layer types are not found in the model.
57
+ # This would be something like ["LlamaDecoderLayer", "WhisperEncoderLayer"]
58
+ self._no_split_modules = (self.language_model._no_split_modules or []) + (
59
+ self.audio_tower._no_split_modules or []
60
+ )
61
+
62
+ self.loss_config = LossConfig()
63
+ self.post_init()
64
+
65
+ def get_input_embeddings(self):
66
+ return self.language_model.get_input_embeddings()
67
+
68
+ def set_input_embeddings(self, value):
69
+ self.language_model.set_input_embeddings(value)
70
+
71
+ def get_output_embeddings(self):
72
+ return self.language_model.get_output_embeddings()
73
+
74
+ def set_output_embeddings(self, new_embeddings):
75
+ self.language_model.set_output_embeddings(new_embeddings)
76
+
77
+ def set_decoder(self, decoder):
78
+ self.language_model.set_decoder(decoder)
79
+
80
+ def get_decoder(self):
81
+ return self.language_model.get_decoder()
82
+
83
+ def tie_weights(self):
84
+ return self.language_model.tie_weights()
85
+
86
+ def set_loss_config(self, loss_config: LossConfig):
87
+ self.loss_config = loss_config
88
+
89
+ def _setup_cache(
90
+ self, cache_cls, max_batch_size: int, max_cache_len: Optional[int] = None
91
+ ):
92
+ self.language_model._setup_cache(cache_cls, max_batch_size, max_cache_len)
93
+
94
+ def _reorder_cache(self, past_key_values, beam_idx):
95
+ return self.language_model._reorder_cache(past_key_values, beam_idx)
96
+
97
+ def resize_token_embeddings(
98
+ self,
99
+ new_num_tokens: Optional[int] = None,
100
+ pad_to_multiple_of: Optional[int] = None,
101
+ ) -> nn.Embedding:
102
+ model_embeds = self.language_model.resize_token_embeddings(
103
+ new_num_tokens, pad_to_multiple_of
104
+ )
105
+ # update vocab size
106
+ self.config.text_config.vocab_size = model_embeds.num_embeddings
107
+ self.config.vocab_size = model_embeds.num_embeddings
108
+ self.vocab_size = model_embeds.num_embeddings
109
+ return model_embeds
110
+
111
+ def _compute_kl_loss(
112
+ self,
113
+ lm_output: transformers.modeling_outputs.CausalLMOutputWithPast,
114
+ labels: Optional[torch.Tensor] = None,
115
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
116
+ alt_input_ids: Optional[torch.Tensor] = None,
117
+ alt_attention_mask: Optional[torch.Tensor] = None,
118
+ alt_labels: Optional[torch.Tensor] = None,
119
+ **kwargs,
120
+ ):
121
+ # disable gradient computation for the teacher model
122
+ with torch.no_grad():
123
+ # compute the teacher (text-only) model's distribution
124
+ alt_inputs_embeds = self.get_input_embeddings().forward(alt_input_ids)
125
+ alt_lm_output = self.language_model.forward(
126
+ inputs_embeds=alt_inputs_embeds,
127
+ labels=alt_labels,
128
+ attention_mask=alt_attention_mask,
129
+ past_key_values=past_key_values,
130
+ **kwargs,
131
+ )
132
+ # compute the KL divergence loss between the two models
133
+ kl_loss = F.kl_div(
134
+ F.log_softmax(
135
+ lm_output.logits[labels != -100] / self.loss_config.kl_temperature,
136
+ dim=-1,
137
+ ),
138
+ F.softmax(
139
+ alt_lm_output.logits[alt_labels != -100]
140
+ / self.loss_config.kl_temperature,
141
+ dim=-1,
142
+ ),
143
+ reduction="batchmean",
144
+ )
145
+ return {"loss": kl_loss}
146
+
147
+ def forward(
148
+ self,
149
+ input_ids: torch.Tensor,
150
+ audio_values: Optional[torch.FloatTensor] = None,
151
+ inputs_embeds: Optional[torch.FloatTensor] = None,
152
+ labels: Optional[torch.Tensor] = None,
153
+ attention_mask: Optional[torch.Tensor] = None,
154
+ audio_token_start_idx: Optional[torch.Tensor] = None,
155
+ audio_len: Optional[torch.Tensor] = None,
156
+ audio_token_len: Optional[torch.Tensor] = None,
157
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
158
+ # the alt_* fields are needed for KL divergence loss
159
+ alt_input_ids: Optional[torch.Tensor] = None,
160
+ alt_attention_mask: Optional[torch.Tensor] = None,
161
+ alt_labels: Optional[torch.Tensor] = None,
162
+ **kwargs,
163
+ ) -> Union[Tuple, transformers.modeling_outputs.CausalLMOutputWithPast]:
164
+ """
165
+ Forward pass for the Ultravox model.
166
+
167
+ `input_ids` are the tokenized text input. They are embedded by the language model as usual.
168
+ `audio_values` are processed by the audio encoder and then every `stack_factor` frames are stacked together and
169
+ projected to the language model's embedding space using a few linear layers.
170
+ The audio and text embeddings are merged together. A special token `<|audio|>` is used to indicate the start
171
+ of the audio embeddings in the merged embeddings.
172
+
173
+ Args:
174
+ input_ids: The tokenized text input.
175
+ audio_values: The processed audio values.
176
+ inputs_embeds: The embeddings for the input tokens.
177
+ labels: The tokenized text labels.
178
+ attention_mask: The attention mask for the input.
179
+ position_ids: The position ids for the input.
180
+ past_key_values: The past key value cache for the language model attention layers.
181
+ **kwargs: Additional keyword arguments. Passed directly to the language model.
182
+ """
183
+ if inputs_embeds is None:
184
+ # B x T -> B x T x D
185
+ inputs_embeds = self.get_input_embeddings().forward(input_ids)
186
+
187
+ if audio_values is not None:
188
+ assert (
189
+ audio_token_start_idx is not None and audio_token_len is not None
190
+ ), "audio_token_start_idx and audio_token_len must be provided if audio_values are provided."
191
+ assert (
192
+ len(audio_token_start_idx) == len(audio_token_len) == len(audio_values)
193
+ ), "audio_token_start_idx, audio_token_len, and audio_values must have the same batch size."
194
+
195
+ # B x A/3200 x D
196
+ audio_tower_output = self.audio_tower.forward(
197
+ audio_values.to(self.audio_tower.dtype),
198
+ audio_len=audio_len,
199
+ ).last_hidden_state
200
+ audio_tower_output = audio_tower_output.to(inputs_embeds.dtype)
201
+
202
+ audio_embeds = self.multi_modal_projector.forward(audio_tower_output)
203
+
204
+ # combine audio and text embeddings
205
+ for i, (audio, start, length) in enumerate(
206
+ zip(audio_embeds, audio_token_start_idx, audio_token_len)
207
+ ):
208
+ length = min(length, audio.shape[0])
209
+ inputs_embeds[i, start : start + length] = audio[:length]
210
+
211
+ lm_output = self.language_model.forward(
212
+ inputs_embeds=inputs_embeds,
213
+ labels=labels,
214
+ attention_mask=attention_mask,
215
+ past_key_values=past_key_values,
216
+ **kwargs,
217
+ )
218
+ if self.training:
219
+ if self.loss_config.loss_function == LossFunction.CrossEntropy:
220
+ return lm_output
221
+ elif self.loss_config.loss_function == LossFunction.KL_Divergence:
222
+ return self._compute_kl_loss(
223
+ lm_output=lm_output,
224
+ labels=labels,
225
+ past_key_values=past_key_values,
226
+ alt_input_ids=alt_input_ids,
227
+ alt_attention_mask=alt_attention_mask,
228
+ alt_labels=alt_labels,
229
+ **kwargs,
230
+ )
231
+ else:
232
+ raise ValueError(
233
+ f"Unsupported loss function: {self.loss_config.loss_function}"
234
+ )
235
+ else:
236
+ return lm_output
237
+
238
+ def prepare_inputs_for_generation(
239
+ self,
240
+ input_ids: torch.Tensor,
241
+ audio_values: Optional[torch.FloatTensor] = None,
242
+ audio_token_start_idx: Optional[torch.Tensor] = None,
243
+ audio_token_len: Optional[torch.Tensor] = None,
244
+ audio_len: Optional[torch.Tensor] = None,
245
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
246
+ attention_mask: Optional[torch.Tensor] = None,
247
+ inputs_embeds: Optional[torch.Tensor] = None,
248
+ cache_position: Optional[torch.Tensor] = None,
249
+ **kwargs,
250
+ ) -> Dict[str, Any]:
251
+ model_input = self.language_model.prepare_inputs_for_generation(
252
+ input_ids=input_ids,
253
+ past_key_values=past_key_values,
254
+ attention_mask=attention_mask,
255
+ inputs_embeds=inputs_embeds,
256
+ cache_position=cache_position,
257
+ **kwargs,
258
+ )
259
+
260
+ # include audio information in model_input only when it is needed during prefilling
261
+ # audio_token_start_idx should always be relative to the current cache position
262
+ prefill_start_idx = 0 if cache_position is None else cache_position[0]
263
+ if (
264
+ audio_values is not None
265
+ and audio_token_start_idx is not None
266
+ and prefill_start_idx <= torch.max(audio_token_start_idx)
267
+ ):
268
+ model_input["audio_values"] = audio_values
269
+ model_input["audio_token_start_idx"] = (
270
+ audio_token_start_idx - prefill_start_idx
271
+ )
272
+ model_input["audio_token_len"] = audio_token_len
273
+ model_input["audio_len"] = audio_len
274
+
275
+ return model_input
276
+
277
+ @classmethod
278
+ def _create_multi_modal_projector(
279
+ cls, config: UltravoxConfig
280
+ ) -> "UltravoxProjector":
281
+ projector = UltravoxProjector(config)
282
+ projector.to(config.torch_dtype)
283
+ return projector
284
+
285
+ @classmethod
286
+ def _create_audio_tower(
287
+ cls, config: UltravoxConfig
288
+ ) -> Union[transformers.Wav2Vec2Model, "ModifiedWhisperEncoder"]:
289
+ if config.audio_model_id is not None:
290
+ if "whisper" in config.audio_model_id.lower():
291
+ audio_tower = ModifiedWhisperEncoder.from_pretrained(
292
+ config.audio_model_id, torch_dtype=config.torch_dtype
293
+ )
294
+ audio_tower.init_latency_mask(
295
+ config.audio_latency_block_size, dtype=config.torch_dtype
296
+ )
297
+ else:
298
+ assert config.audio_latency_block_size in (
299
+ None,
300
+ 0,
301
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
302
+ audio_tower = transformers.AutoModel.from_pretrained(
303
+ config.audio_model_id, torch_dtype=config.torch_dtype
304
+ )
305
+ else:
306
+ if "whisper" in config.audio_config._name_or_path.lower():
307
+ audio_tower = ModifiedWhisperEncoder(config.audio_config)
308
+ audio_tower.init_latency_mask(
309
+ config.audio_latency_block_size, dtype=config.torch_dtype
310
+ )
311
+ else:
312
+ assert config.audio_latency_block_size in (
313
+ None,
314
+ 0,
315
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
316
+ with transformers.modeling_utils.no_init_weights():
317
+ # we only ever use from_config if the weights are retrained, hence initializing is not
318
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
319
+ audio_tower = transformers.AutoModel.from_config(
320
+ config.audio_config
321
+ )
322
+
323
+ if isinstance(
324
+ audio_tower,
325
+ (transformers.Wav2Vec2BertModel, transformers.WhisperModel),
326
+ ):
327
+ # For these models we only need the encoder part
328
+ # Wav2Vec2BertModel -> Wav2Vec2BertEncoder
329
+ # WhisperModel -> WhisperEncoder
330
+ audio_tower = audio_tower.encoder
331
+
332
+ audio_tower = apply_lora(audio_tower, config.audio_model_lora_config)
333
+ return audio_tower
334
+
335
+ @classmethod
336
+ def _create_language_model(
337
+ cls, config: UltravoxConfig
338
+ ) -> transformers.LlamaForCausalLM:
339
+ if config.text_model_id is not None:
340
+ language_model = transformers.AutoModelForCausalLM.from_pretrained(
341
+ config.text_model_id,
342
+ attn_implementation=config._attn_implementation,
343
+ torch_dtype=config.torch_dtype,
344
+ )
345
+ else:
346
+ with transformers.modeling_utils.no_init_weights():
347
+ # we only ever use from_config if the weights are retrained, hence initializing is not
348
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
349
+ language_model = transformers.AutoModelForCausalLM.from_config(
350
+ config.text_config,
351
+ attn_implementation=config._attn_implementation,
352
+ torch_dtype=config.torch_dtype,
353
+ )
354
+
355
+ language_model = apply_lora(language_model, config.text_model_lora_config)
356
+ return language_model
357
+
358
+ def merge_and_unload(self):
359
+ if isinstance(self.language_model, peft.PeftModel):
360
+ self.language_model = self.language_model.merge_and_unload()
361
+ # no need to download base language model weights anymore, so we can remove the id
362
+ self.config.text_model_id = None
363
+ self.keep_params.update(
364
+ set(
365
+ [
366
+ f"language_model.{name}"
367
+ for name, _ in self.language_model.named_parameters()
368
+ ]
369
+ )
370
+ )
371
+
372
+ if isinstance(self.audio_tower, peft.PeftModel):
373
+ self.audio_tower = self.audio_tower.merge_and_unload()
374
+ # no need to download base audio model weights anymore, so we can remove the id
375
+ self.config.audio_model_id = None
376
+ self.keep_params.update(
377
+ set(
378
+ [
379
+ f"audio_tower.{name}"
380
+ for name, _ in self.audio_tower.named_parameters()
381
+ ]
382
+ )
383
+ )
384
+
385
+ for param in ["text_model_lora_config", "audio_model_lora_config"]:
386
+ if hasattr(self.config, param):
387
+ delattr(self.config, param)
388
+
389
+ def push_to_hub(self, *args, **kwargs):
390
+ self.merge_and_unload()
391
+ return super().push_to_hub(*args, **kwargs)
392
+
393
+ def diff_state_dict(
394
+ self, state_dict: Optional[Dict[str, Any]] = None
395
+ ) -> Dict[str, Any]:
396
+ if state_dict is None:
397
+ state_dict = super().state_dict()
398
+
399
+ named_params = dict(self.named_parameters())
400
+
401
+ state_dict = {
402
+ k: v
403
+ for k, v in state_dict.items()
404
+ if k in self.keep_params
405
+ or (k in named_params and named_params[k].requires_grad)
406
+ }
407
+
408
+ return state_dict
409
+
410
+ def save_pretrained(
411
+ self, *args, state_dict: Optional[Dict[str, Any]] = None, **kwargs
412
+ ):
413
+ state_dict = self.diff_state_dict(state_dict)
414
+
415
+ super().save_pretrained(*args, state_dict=state_dict, **kwargs)
416
+
417
+ def _pre_load_state_dict_hook(self, state_dict: Dict[str, Any], *args, **kwargs):
418
+ self.keep_params.update(set(state_dict.keys()))
419
+
420
+ def print_trainable_parameters(self):
421
+ """
422
+ Prints the number of trainable parameters in the model (reuses Peft model's method)
423
+ """
424
+ count_params = peft.peft_model.PeftModel.get_nb_trainable_parameters
425
+
426
+ trainable_params, all_param = count_params(self)
427
+
428
+ logging.info(
429
+ f"trainable params: {trainable_params:,d} || all params: {all_param:,d}"
430
+ f" || trainable%: {100 * trainable_params / all_param:.1f}%"
431
+ )
432
+
433
+ lm_trainable_params, lm_all_params = count_params(self.language_model)
434
+ audio_trainable_params, audio_all_params = count_params(self.audio_tower)
435
+
436
+ projector_trainable_params = (
437
+ trainable_params - lm_trainable_params - audio_trainable_params
438
+ )
439
+ projector_all_params = all_param - lm_all_params - audio_all_params
440
+
441
+ logging.info(
442
+ f"Trainable%: "
443
+ f" LLM: {100 * lm_trainable_params / lm_all_params:.1f}%"
444
+ f" || Audio Encoder: {100 * audio_trainable_params / audio_all_params:.1f}%"
445
+ f" || Projector: {100 * projector_trainable_params / projector_all_params:.1f}%"
446
+ )
447
+
448
+
449
+ # TODO: refactor common parts to a shared module
450
+ def is_cache_empty(
451
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]]
452
+ ) -> bool:
453
+ """
454
+ Check if the cache is empty.
455
+ """
456
+ if past_key_values is None:
457
+ return True
458
+ if isinstance(past_key_values, tuple):
459
+ return all(len(c) == 0 for c in past_key_values)
460
+ return past_key_values.get_seq_length() == 0
461
+
462
+
463
+ def apply_lora(model: torch.nn.Module, lora_config: dict) -> torch.nn.Module:
464
+ """
465
+ Applies LoRA finetuning to the model. If the `r` parameter is set to 0, the model is frozen instead.
466
+ """
467
+ unfreeze_layers = lora_config.pop("unfreeze_layers", None)
468
+ lora_config = peft.LoraConfig(**lora_config or {})
469
+
470
+ if lora_config.r == 0:
471
+ # freeze the model entirely, except for the specified layers
472
+ for name, param in model.named_parameters():
473
+ if not unfreeze_layers or not any(
474
+ re.match(layer, name) for layer in unfreeze_layers
475
+ ):
476
+ param.requires_grad = False
477
+ else:
478
+ logging.info(f"Unfreezing layer: {name} with #{param.numel()} params")
479
+ else:
480
+ model = peft.get_peft_model(model, lora_config)
481
+
482
+ return model
483
+
484
+
485
+ class StackAudioFrames(nn.Module):
486
+ """
487
+ Stack the audio embedding frames to reduce the sequence length by a factor of `stack_factor`.
488
+
489
+ The number of output frames will be `ceil(T / stack_factor) + 1` where `T` is the number of input frames.
490
+ NOTE: the extra +1 is intentional: in case the number of audio tokens are over-estimated by the processor,
491
+ we want to make sure `processor.audio_token_replacement` (i.e. EOS) doesn't get leaked into the middle of embeddings.
492
+ In most cases this extra padding will get removed in the model's forward function so it has no effect.
493
+ """
494
+
495
+ def __init__(self, stack_factor: int = 8):
496
+ super().__init__()
497
+ self.stack_factor = stack_factor
498
+
499
+ def forward(self, audio_embeds: torch.Tensor) -> torch.Tensor:
500
+ B, T, C = audio_embeds.shape
501
+ T_pad = (T + self.stack_factor - 1) // self.stack_factor * self.stack_factor
502
+ audio_embeds = F.pad(audio_embeds, (0, 0, 0, T_pad - T + self.stack_factor))
503
+ B, T, C = audio_embeds.shape
504
+ audio_embeds = audio_embeds.view(
505
+ B, T // self.stack_factor, C * self.stack_factor
506
+ )
507
+ return audio_embeds
508
+
509
+
510
+ class RMSNorm(transformers.models.llama.modeling_llama.LlamaRMSNorm):
511
+ def __init__(self, hidden_size: int, init: float = 1, eps: float = 1e-6):
512
+ super().__init__(hidden_size=hidden_size, eps=eps)
513
+ self.weight.data.fill_(init)
514
+
515
+
516
+ class SwiGLU(nn.Module):
517
+ def forward(self, x):
518
+ x, gate = x.chunk(2, dim=-1)
519
+ return F.silu(gate) * x
520
+
521
+
522
+ class UltravoxProjector(nn.Module):
523
+ def __init__(self, config: UltravoxConfig):
524
+ super().__init__()
525
+ self.hidden_dim = config.hidden_size
526
+ self._pad_and_stack = StackAudioFrames(config.stack_factor)
527
+ dim_in = config.audio_config.hidden_size * config.stack_factor
528
+ self.ln_pre = RMSNorm(dim_in, init=config.norm_init)
529
+ self.linear_1 = nn.Linear(dim_in, self.hidden_dim, bias=False)
530
+ dim_mid = self.hidden_dim
531
+ self.act = transformers.activations.get_activation(config.projector_act)
532
+ dim_mid = dim_mid // 2 if config.projector_act == "swiglu" else dim_mid
533
+ dim_out = config.text_config.hidden_size
534
+ self.linear_2 = nn.Linear(dim_mid, dim_out, bias=False)
535
+
536
+ # Ultravox v0.4.1 and below uses layer_norm after the second linear layer,
537
+ # while v0.5.0 and above uses layer_norm after the first linear layer.
538
+ if config.projector_ln_mid:
539
+ self.ln_mid: nn.Module = RMSNorm(dim_mid, init=config.norm_init)
540
+ self.ln_post: nn.Module = nn.Identity()
541
+ else:
542
+ self.ln_mid = nn.Identity()
543
+ self.ln_post = RMSNorm(dim_out, init=config.norm_init)
544
+
545
+ def forward(self, audio_features: torch.Tensor) -> torch.Tensor:
546
+ audio_features = self._pad_and_stack(audio_features)
547
+ audio_features = self.ln_pre(audio_features)
548
+ hidden_states = self.linear_1(audio_features)
549
+ hidden_states = self.act(hidden_states)
550
+ hidden_states = self.ln_mid(hidden_states)
551
+ hidden_states = self.linear_2(hidden_states)
552
+ hidden_states = self.ln_post(hidden_states)
553
+ return hidden_states
554
+
555
+
556
+ class ModifiedWhisperEncoder(
557
+ whisper.WhisperEncoder, transformers.modeling_utils.ModuleUtilsMixin
558
+ ):
559
+ """
560
+ Encoder portion of OpenAI's Whisper model.
561
+
562
+ This implementation is a slightly modified version of HF Transformers' Whisper Encoder, with only a few fixes:
563
+ 1. base_model_prefix updated to allow for doing `.from_pretrained` directly on the encoder
564
+ 2. allow less than 30 second of audio padding to be passed in:
565
+ - relaxed ValueError check for `input_features` length to be less than or equal to `expected_seq_length` instead of strictly equal
566
+ - embed_pos is now sliced to match the length of `inputs_embeds`
567
+
568
+ Original: https://github.com/huggingface/transformers/blob/main/src/transformers/models/whisper/modeling_whisper.py
569
+ """
570
+
571
+ base_model_prefix = "model.encoder"
572
+ _no_split_modules = ["WhisperEncoderLayer"]
573
+
574
+ def __init__(self, config: transformers.WhisperConfig):
575
+ super().__init__(config)
576
+ self.config.is_decoder = False
577
+
578
+ def init_latency_mask(self, audio_latency_block_size: int, dtype: torch.dtype):
579
+ if audio_latency_block_size is None:
580
+ self.audio_streaming_mask = None
581
+ return
582
+
583
+ # maximum sequence length
584
+ max_seqlen = (
585
+ self.config.max_source_positions
586
+ * self.conv1.stride[0]
587
+ * self.conv2.stride[0]
588
+ )
589
+ assert (
590
+ max_seqlen > 0
591
+ ), f"maximum sequence length must be positive, got {max_seqlen}"
592
+ assert (
593
+ max_seqlen % audio_latency_block_size == 0
594
+ ), f"audio_latency_block_size {audio_latency_block_size} must divide {max_seqlen} evenly."
595
+ # Given the block size, we calculate number of blocks.
596
+ audio_latency_nblocks = max_seqlen // audio_latency_block_size
597
+ audio_streaming_mask = (
598
+ torch.tril(
599
+ torch.ones(audio_latency_nblocks, audio_latency_nblocks),
600
+ diagonal=0,
601
+ )
602
+ .repeat_interleave(audio_latency_block_size, dim=0)
603
+ .repeat_interleave(audio_latency_block_size, dim=1)
604
+ )
605
+ audio_streaming_mask = (1.0 - audio_streaming_mask) * torch.finfo(dtype).min
606
+ audio_streaming_mask = audio_streaming_mask[None, None, :, :]
607
+ self.register_buffer(
608
+ "audio_streaming_mask", audio_streaming_mask, persistent=False
609
+ )
610
+
611
+ def forward(
612
+ self,
613
+ input_features,
614
+ audio_len=None,
615
+ head_mask=None,
616
+ output_attentions=None,
617
+ output_hidden_states=None,
618
+ return_dict=None,
619
+ ):
620
+ expected_seq_length = (
621
+ self.config.max_source_positions
622
+ * self.conv1.stride[0]
623
+ * self.conv2.stride[0]
624
+ )
625
+ if input_features.shape[-1] > expected_seq_length:
626
+ raise ValueError(
627
+ f"Whisper expects the mel input features to be of length {expected_seq_length} or less, but found {input_features.shape[-1]}. Make sure to pad the input mel features to {expected_seq_length}."
628
+ )
629
+
630
+ output_attentions = (
631
+ output_attentions
632
+ if output_attentions is not None
633
+ else self.config.output_attentions
634
+ )
635
+ output_hidden_states = (
636
+ output_hidden_states
637
+ if output_hidden_states is not None
638
+ else self.config.output_hidden_states
639
+ )
640
+ return_dict = (
641
+ return_dict if return_dict is not None else self.config.use_return_dict
642
+ )
643
+ inputs_embeds = nn.functional.gelu(self.conv1(input_features))
644
+ inputs_embeds = nn.functional.gelu(self.conv2(inputs_embeds))
645
+
646
+ inputs_embeds = inputs_embeds.permute(0, 2, 1)
647
+ embed_pos = self.embed_positions.weight[: inputs_embeds.size(-2)]
648
+
649
+ hidden_states = inputs_embeds + embed_pos
650
+ hidden_states = nn.functional.dropout(
651
+ hidden_states, p=self.dropout, training=self.training
652
+ )
653
+
654
+ encoder_states = () if output_hidden_states else None
655
+ all_attentions = () if output_attentions else None
656
+
657
+ # Create attention mask based on audio lengths to mask out padding tokens
658
+ # For each sample in batch:
659
+ # - Convert raw audio length to feature length after convolutions
660
+ # - Create boolean mask that is True for valid positions and False for padding
661
+ # - Convert to extended attention mask format expected by transformer layers
662
+ # (1.0 for positions to attend to, large negative for positions to ignore)
663
+ # This masking ensures consistent behavior between training and inference
664
+ # by preventing the model from attending to padding tokens in both cases
665
+ attention_mask = None
666
+ if audio_len != None:
667
+ audio_feature_len = self._get_feat_extract_output_lengths(audio_len)
668
+ max_seq_len = hidden_states.shape[1]
669
+ attention_mask = torch.arange(max_seq_len, device=hidden_states.device)[
670
+ None, :
671
+ ].lt(audio_feature_len.view(-1, 1))
672
+ attention_mask = self.get_extended_attention_mask(
673
+ attention_mask,
674
+ None,
675
+ device=hidden_states.device,
676
+ dtype=hidden_states.dtype,
677
+ )
678
+
679
+ if self.audio_streaming_mask is not None:
680
+ seqlen = hidden_states.size(-2)
681
+ if attention_mask is not None:
682
+ attention_mask = torch.minimum(
683
+ self.audio_streaming_mask[:, :, :seqlen, :seqlen], attention_mask
684
+ ) # merge
685
+ else:
686
+ attention_mask = self.audio_streaming_mask[:, :, :seqlen, :seqlen]
687
+ attention_mask = attention_mask.to(hidden_states.dtype)
688
+
689
+ # check if head_mask has a correct number of layers specified if desired
690
+ if head_mask is not None:
691
+ assert head_mask.size()[0] == (
692
+ len(self.layers)
693
+ ), f"The head_mask should be specified for {len(self.layers)} layers, but it is for {head_mask.size()[0]}."
694
+
695
+ for idx, encoder_layer in enumerate(self.layers):
696
+ if output_hidden_states:
697
+ encoder_states = encoder_states + (hidden_states,)
698
+ # add LayerDrop (see https://arxiv.org/abs/1909.11556 for description)
699
+ to_drop = False
700
+ if self.training:
701
+ dropout_probability = torch.rand([])
702
+ if dropout_probability < self.layerdrop: # skip the layer
703
+ to_drop = True
704
+
705
+ if to_drop:
706
+ layer_outputs = (None, None)
707
+ else:
708
+ if self.gradient_checkpointing and self.training:
709
+ layer_outputs = self._gradient_checkpointing_func(
710
+ encoder_layer.__call__,
711
+ hidden_states,
712
+ attention_mask,
713
+ (head_mask[idx] if head_mask is not None else None),
714
+ output_attentions,
715
+ )
716
+ else:
717
+ layer_outputs = encoder_layer(
718
+ hidden_states,
719
+ attention_mask,
720
+ layer_head_mask=(
721
+ head_mask[idx] if head_mask is not None else None
722
+ ),
723
+ output_attentions=output_attentions,
724
+ )
725
+
726
+ hidden_states = layer_outputs[0]
727
+
728
+ if output_attentions:
729
+ all_attentions = all_attentions + (layer_outputs[1],)
730
+
731
+ hidden_states = self.layer_norm(hidden_states)
732
+ if output_hidden_states:
733
+ encoder_states = encoder_states + (hidden_states,)
734
+
735
+ if not return_dict:
736
+ return tuple(
737
+ v
738
+ for v in [hidden_states, encoder_states, all_attentions]
739
+ if v is not None
740
+ )
741
+ return transformers.modeling_outputs.BaseModelOutput(
742
+ last_hidden_state=hidden_states,
743
+ hidden_states=encoder_states,
744
+ attentions=all_attentions,
745
+ )
746
+
747
+
748
+ UltravoxConfig.register_for_auto_class()
749
+ UltravoxModel.register_for_auto_class()
750
+
751
+ transformers.AutoConfig.register("ultravox", UltravoxConfig)
752
+ transformers.AutoModel.register(UltravoxConfig, UltravoxModel)
753
+
754
+ transformers.activations.ACT2FN["swiglu"] = SwiGLU
checkpoint-14400/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-3600/config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UltravoxModel"
4
+ ],
5
+ "audio_latency_block_size": null,
6
+ "audio_model_id": "openai/whisper-large-v3-turbo",
7
+ "audio_model_lora_config": {
8
+ "lora_alpha": 8,
9
+ "r": 0,
10
+ "target_modules": [
11
+ "k_proj",
12
+ "q_proj",
13
+ "linear_k",
14
+ "linear_q"
15
+ ]
16
+ },
17
+ "auto_map": {
18
+ "AutoConfig": "ultravox_config.UltravoxConfig",
19
+ "AutoModel": "ultravox_model.UltravoxModel"
20
+ },
21
+ "hidden_size": 4096,
22
+ "ignore_index": -100,
23
+ "initializer_range": 0.02,
24
+ "model_type": "ultravox",
25
+ "norm_init": 0.4,
26
+ "pad_token_id": 2,
27
+ "projector_act": "swiglu",
28
+ "projector_ln_mid": false,
29
+ "stack_factor": 8,
30
+ "text_model_id": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
31
+ "text_model_lora_config": {
32
+ "lora_alpha": 8,
33
+ "r": 0,
34
+ "target_modules": [
35
+ "k_proj",
36
+ "q_proj",
37
+ "linear_k",
38
+ "linear_q"
39
+ ]
40
+ },
41
+ "torch_dtype": "bfloat16",
42
+ "transformers_version": "4.47.0",
43
+ "vocab_size": 49152
44
+ }
checkpoint-3600/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "4.47.0"
7
+ }
checkpoint-3600/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-3600/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1080c1b944294199dcd5962182193892ea86e01ffb3ce2aa01c78826bf009d98
3
+ size 92299736
checkpoint-3600/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7444791357081ea9975d646a7093e47e4505a05bbeaca1d147d88d865809af4c
3
+ size 184602962
checkpoint-3600/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb9a3b64cb4cc2afb67461c1d3860326ef6cddab5e1dd39123b1af5d51fc5f9e
3
+ size 14244
checkpoint-3600/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04d44c72cd3a348b42894fd1f0aa67e10dd8fbbcc70558ee71674069905052af
3
+ size 1064
checkpoint-3600/special_tokens_map.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<|im_start|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "eos_token": {
14
+ "content": "<|im_end|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "pad_token": "<|im_end|>",
21
+ "unk_token": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ }
28
+ }
checkpoint-3600/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-3600/tokenizer_config.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<repo_name>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<reponame>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<file_sep>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<filename>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<gh_stars>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_start>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_comment>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<issue_closed>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_start>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_text>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_code>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<jupyter_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<jupyter_script>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<empty_output>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ }
140
+ },
141
+ "additional_special_tokens": [
142
+ "<|im_start|>",
143
+ "<|im_end|>"
144
+ ],
145
+ "bos_token": "<|im_start|>",
146
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
147
+ "clean_up_tokenization_spaces": false,
148
+ "eos_token": "<|im_end|>",
149
+ "extra_special_tokens": {},
150
+ "model_max_length": 8192,
151
+ "pad_token": "<|im_end|>",
152
+ "tokenizer_class": "GPT2Tokenizer",
153
+ "unk_token": "<|endoftext|>",
154
+ "vocab_size": 49152
155
+ }
checkpoint-3600/trainer_state.json ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.029961549345007242,
5
+ "eval_steps": 1000,
6
+ "global_step": 3600,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 8.322652595835345e-06,
13
+ "grad_norm": 14.9375,
14
+ "learning_rate": 2e-06,
15
+ "loss": 0.6484,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.0008322652595835345,
20
+ "grad_norm": 0.3671875,
21
+ "learning_rate": 0.0002,
22
+ "loss": 0.4345,
23
+ "step": 100
24
+ },
25
+ {
26
+ "epoch": 0.001664530519167069,
27
+ "grad_norm": 0.1689453125,
28
+ "learning_rate": 0.0004,
29
+ "loss": 0.2537,
30
+ "step": 200
31
+ },
32
+ {
33
+ "epoch": 0.0024967957787506035,
34
+ "grad_norm": 0.55859375,
35
+ "learning_rate": 0.0006,
36
+ "loss": 0.2344,
37
+ "step": 300
38
+ },
39
+ {
40
+ "epoch": 0.003329061038334138,
41
+ "grad_norm": 0.154296875,
42
+ "learning_rate": 0.0008,
43
+ "loss": 0.222,
44
+ "step": 400
45
+ },
46
+ {
47
+ "epoch": 0.004161326297917672,
48
+ "grad_norm": 0.126953125,
49
+ "learning_rate": 0.001,
50
+ "loss": 0.2142,
51
+ "step": 500
52
+ },
53
+ {
54
+ "epoch": 0.004993591557501207,
55
+ "grad_norm": 0.12353515625,
56
+ "learning_rate": 0.0012,
57
+ "loss": 0.2011,
58
+ "step": 600
59
+ },
60
+ {
61
+ "epoch": 0.005825856817084741,
62
+ "grad_norm": 0.10693359375,
63
+ "learning_rate": 0.0014,
64
+ "loss": 0.1897,
65
+ "step": 700
66
+ },
67
+ {
68
+ "epoch": 0.006658122076668276,
69
+ "grad_norm": 0.10595703125,
70
+ "learning_rate": 0.0016,
71
+ "loss": 0.1775,
72
+ "step": 800
73
+ },
74
+ {
75
+ "epoch": 0.0074903873362518105,
76
+ "grad_norm": 0.0859375,
77
+ "learning_rate": 0.0018000000000000002,
78
+ "loss": 0.1615,
79
+ "step": 900
80
+ },
81
+ {
82
+ "epoch": 0.008322652595835344,
83
+ "grad_norm": 0.083984375,
84
+ "learning_rate": 0.002,
85
+ "loss": 0.1444,
86
+ "step": 1000
87
+ },
88
+ {
89
+ "epoch": 0.008322652595835344,
90
+ "eval_peoplespeech-clean-transcription_loss": 2.2110702991485596,
91
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
92
+ "eval_peoplespeech-clean-transcription_runtime": 9.5405,
93
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.708,
94
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
95
+ "step": 1000
96
+ },
97
+ {
98
+ "epoch": 0.009154917855418878,
99
+ "grad_norm": 0.0771484375,
100
+ "learning_rate": 0.001999725185109816,
101
+ "loss": 0.1323,
102
+ "step": 1100
103
+ },
104
+ {
105
+ "epoch": 0.009987183115002414,
106
+ "grad_norm": 0.083984375,
107
+ "learning_rate": 0.0019989008914857113,
108
+ "loss": 0.1242,
109
+ "step": 1200
110
+ },
111
+ {
112
+ "epoch": 0.010819448374585948,
113
+ "grad_norm": 0.07861328125,
114
+ "learning_rate": 0.00199752757218401,
115
+ "loss": 0.1162,
116
+ "step": 1300
117
+ },
118
+ {
119
+ "epoch": 0.011651713634169482,
120
+ "grad_norm": 0.07275390625,
121
+ "learning_rate": 0.001995605982021898,
122
+ "loss": 0.1128,
123
+ "step": 1400
124
+ },
125
+ {
126
+ "epoch": 0.012483978893753018,
127
+ "grad_norm": 0.07666015625,
128
+ "learning_rate": 0.0019931371771625545,
129
+ "loss": 0.1094,
130
+ "step": 1500
131
+ },
132
+ {
133
+ "epoch": 0.013316244153336551,
134
+ "grad_norm": 0.06201171875,
135
+ "learning_rate": 0.001990122514534651,
136
+ "loss": 0.1052,
137
+ "step": 1600
138
+ },
139
+ {
140
+ "epoch": 0.014148509412920085,
141
+ "grad_norm": 0.058837890625,
142
+ "learning_rate": 0.0019865636510865464,
143
+ "loss": 0.1022,
144
+ "step": 1700
145
+ },
146
+ {
147
+ "epoch": 0.014980774672503621,
148
+ "grad_norm": 0.0625,
149
+ "learning_rate": 0.001982462542875576,
150
+ "loss": 0.1011,
151
+ "step": 1800
152
+ },
153
+ {
154
+ "epoch": 0.015813039932087155,
155
+ "grad_norm": 0.06787109375,
156
+ "learning_rate": 0.001977821443992945,
157
+ "loss": 0.0983,
158
+ "step": 1900
159
+ },
160
+ {
161
+ "epoch": 0.01664530519167069,
162
+ "grad_norm": 0.0537109375,
163
+ "learning_rate": 0.001972642905324813,
164
+ "loss": 0.0975,
165
+ "step": 2000
166
+ },
167
+ {
168
+ "epoch": 0.01664530519167069,
169
+ "eval_peoplespeech-clean-transcription_loss": 1.6914767026901245,
170
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
171
+ "eval_peoplespeech-clean-transcription_runtime": 9.5301,
172
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.716,
173
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.839,
174
+ "step": 2000
175
+ },
176
+ {
177
+ "epoch": 0.017477570451254223,
178
+ "grad_norm": 0.05859375,
179
+ "learning_rate": 0.0019669297731502505,
180
+ "loss": 0.0947,
181
+ "step": 2100
182
+ },
183
+ {
184
+ "epoch": 0.018309835710837757,
185
+ "grad_norm": 0.062255859375,
186
+ "learning_rate": 0.00196068518757684,
187
+ "loss": 0.0935,
188
+ "step": 2200
189
+ },
190
+ {
191
+ "epoch": 0.019142100970421294,
192
+ "grad_norm": 0.059326171875,
193
+ "learning_rate": 0.001953912580814779,
194
+ "loss": 0.0911,
195
+ "step": 2300
196
+ },
197
+ {
198
+ "epoch": 0.019974366230004828,
199
+ "grad_norm": 0.060302734375,
200
+ "learning_rate": 0.0019466156752904343,
201
+ "loss": 0.0904,
202
+ "step": 2400
203
+ },
204
+ {
205
+ "epoch": 0.020806631489588362,
206
+ "grad_norm": 0.0615234375,
207
+ "learning_rate": 0.0019387984816003866,
208
+ "loss": 0.0882,
209
+ "step": 2500
210
+ },
211
+ {
212
+ "epoch": 0.021638896749171896,
213
+ "grad_norm": 0.056884765625,
214
+ "learning_rate": 0.0019304652963070869,
215
+ "loss": 0.0874,
216
+ "step": 2600
217
+ },
218
+ {
219
+ "epoch": 0.02247116200875543,
220
+ "grad_norm": 0.049072265625,
221
+ "learning_rate": 0.0019216206995773372,
222
+ "loss": 0.0871,
223
+ "step": 2700
224
+ },
225
+ {
226
+ "epoch": 0.023303427268338964,
227
+ "grad_norm": 0.053955078125,
228
+ "learning_rate": 0.0019122695526648968,
229
+ "loss": 0.0856,
230
+ "step": 2800
231
+ },
232
+ {
233
+ "epoch": 0.0241356925279225,
234
+ "grad_norm": 0.05517578125,
235
+ "learning_rate": 0.0019024169952385887,
236
+ "loss": 0.0845,
237
+ "step": 2900
238
+ },
239
+ {
240
+ "epoch": 0.024967957787506035,
241
+ "grad_norm": 0.0546875,
242
+ "learning_rate": 0.0018920684425573864,
243
+ "loss": 0.0852,
244
+ "step": 3000
245
+ },
246
+ {
247
+ "epoch": 0.024967957787506035,
248
+ "eval_peoplespeech-clean-transcription_loss": 1.6414048671722412,
249
+ "eval_peoplespeech-clean-transcription_model_preparation_time": 0.0065,
250
+ "eval_peoplespeech-clean-transcription_runtime": 9.8151,
251
+ "eval_peoplespeech-clean-transcription_samples_per_second": 6.521,
252
+ "eval_peoplespeech-clean-transcription_steps_per_second": 0.815,
253
+ "step": 3000
254
+ },
255
+ {
256
+ "epoch": 0.02580022304708957,
257
+ "grad_norm": 0.052978515625,
258
+ "learning_rate": 0.0018812295824940284,
259
+ "loss": 0.0836,
260
+ "step": 3100
261
+ },
262
+ {
263
+ "epoch": 0.026632488306673103,
264
+ "grad_norm": 0.05126953125,
265
+ "learning_rate": 0.0018699063724087904,
266
+ "loss": 0.0821,
267
+ "step": 3200
268
+ },
269
+ {
270
+ "epoch": 0.027464753566256637,
271
+ "grad_norm": 0.056884765625,
272
+ "learning_rate": 0.0018581050358751443,
273
+ "loss": 0.0816,
274
+ "step": 3300
275
+ },
276
+ {
277
+ "epoch": 0.02829701882584017,
278
+ "grad_norm": 0.045654296875,
279
+ "learning_rate": 0.0018458320592590974,
280
+ "loss": 0.0814,
281
+ "step": 3400
282
+ },
283
+ {
284
+ "epoch": 0.029129284085423705,
285
+ "grad_norm": 0.04638671875,
286
+ "learning_rate": 0.0018330941881540914,
287
+ "loss": 0.0791,
288
+ "step": 3500
289
+ },
290
+ {
291
+ "epoch": 0.029961549345007242,
292
+ "grad_norm": 0.043212890625,
293
+ "learning_rate": 0.0018198984236734246,
294
+ "loss": 0.0804,
295
+ "step": 3600
296
+ }
297
+ ],
298
+ "logging_steps": 100,
299
+ "max_steps": 14400,
300
+ "num_input_tokens_seen": 0,
301
+ "num_train_epochs": 1,
302
+ "save_steps": 3600,
303
+ "stateful_callbacks": {
304
+ "TrainerControl": {
305
+ "args": {
306
+ "should_epoch_stop": false,
307
+ "should_evaluate": false,
308
+ "should_log": false,
309
+ "should_save": true,
310
+ "should_training_stop": false
311
+ },
312
+ "attributes": {}
313
+ }
314
+ },
315
+ "total_flos": 2.3112799838724096e+17,
316
+ "train_batch_size": 24,
317
+ "trial_name": null,
318
+ "trial_params": null
319
+ }
checkpoint-3600/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37b86db64b66888697120b24a102f1ab62ab1d7da7b6bd4cd2e497d4499c3fb5
3
+ size 5688
checkpoint-3600/ultravox_config.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dataclasses
2
+ from enum import Enum
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ import transformers
6
+
7
+
8
+ @dataclasses.dataclass
9
+ class LoraConfigSimplified:
10
+ """
11
+ Low Rank Approximation (LoRA) configuration.
12
+
13
+ Used for language and audio models separately.
14
+ """
15
+
16
+ # The rank of the approximation
17
+ r: int = 0
18
+ lora_alpha: float = 8
19
+ target_modules: Optional[List[str]] = dataclasses.field(
20
+ default_factory=lambda: ["k_proj", "q_proj", "linear_k", "linear_q"]
21
+ )
22
+ # A list of module names regex patterns to unfreeze. Only used if r == 0.
23
+ unfreeze_layers: Optional[List[str]] = None
24
+
25
+
26
+ class LossFunction(str, Enum):
27
+ CrossEntropy = "ce"
28
+ KL_Divergence = "kl"
29
+
30
+
31
+ @dataclasses.dataclass
32
+ class LossConfig:
33
+ loss_function: LossFunction = LossFunction.CrossEntropy
34
+ kl_temperature: float = 2.0
35
+
36
+ @property
37
+ def requires_alt_fields(self):
38
+ return self.loss_function == LossFunction.KL_Divergence
39
+
40
+
41
+ class UltravoxConfig(transformers.PretrainedConfig):
42
+ r"""
43
+ This is the configuration class to store the configuration of a [`UltravoxForConditionalGeneration`]. It is used to instantiate an
44
+ Ultravox model according to the specified arguments, defining the model architecture.
45
+
46
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
47
+ documentation from [`PretrainedConfig`] for more information.
48
+
49
+ Args:
50
+ audio_config (`Wav2Vec2Config`, *optional*):
51
+ Custom audio config or dict
52
+ text_config (`Union[AutoConfig, dict]`, *optional*):
53
+ The config object of the text backbone. Can be any of `LlamaConfig` or `MistralConfig`.
54
+ ignore_index (`int`, *optional*, defaults to -100):
55
+ The ignore index for the loss function.
56
+ audio_token_index (`int`, *optional*, defaults to 32000):
57
+ The audio token index to encode the audio prompt.
58
+ stack_factor (`int`, *optional*, defaults to 8):
59
+ Audio downsampling factor for the multimodal projector.
60
+ norm_init (`float`, *optional*, defaults to 0.4):
61
+ The initialization value for the layer normalization.
62
+ projector_act (`str`, *optional*, defaults to `"swiglu"`):
63
+ The activation function used by the multimodal projector.
64
+ text_model_lora_config (`LoraConfigSimplified`, *optional*):
65
+ The LoRA configuration for finetuning the text model.
66
+ audio_model_lora_config (`LoraConfigSimplified`, *optional*):
67
+ The LoRA configuration for finetuning the audio model.
68
+ audio_latency_block_size (`int`, *optional*, defaults to `None`):
69
+ The latency block size for simulating audio streaming.
70
+
71
+
72
+ Example:
73
+
74
+ ```python
75
+ >>> from transformers import UltravoxModel, Wav2Vec2Config, UltravoxConfig, LlamaConfig
76
+
77
+ >>> # Initializing an audio encoder config
78
+ >>> audio_config = Wav2Vec2Config()
79
+
80
+ >>> # Initializing a Llama config
81
+ >>> text_config = LlamaConfig()
82
+
83
+ >>> # Initializing a default configuration
84
+ >>> configuration = UltravoxConfig(audio_config, text_config)
85
+
86
+ >>> # Initializing a completely untrained model from the configuration
87
+ >>> model = UltravoxModel(configuration)
88
+
89
+ >>> # Accessing the model configuration
90
+ >>> configuration = model.config
91
+
92
+ >>> # Initialize a model from pretrained checkpoints and random projector weights
93
+ >>> config = UltravoxConfig(audio_model_id="facebook/wav2vec2-base-960h", text_model_id="meta-llama/Llama-2-7b-chat-hf")
94
+ ```"""
95
+
96
+ model_type = "ultravox"
97
+ is_composition = False
98
+
99
+ def __init__(
100
+ self,
101
+ audio_config: Optional[Dict[str, Any]] = None,
102
+ text_config: Optional[Dict[str, Any]] = None,
103
+ audio_model_id: Optional[str] = None,
104
+ text_model_id: Optional[str] = None,
105
+ ignore_index: int = -100,
106
+ hidden_size: int = 4096,
107
+ stack_factor: int = 8,
108
+ norm_init: float = 0.4,
109
+ projector_act: str = "swiglu",
110
+ projector_ln_mid: bool = False, # defaults to False for compatibility with v0.4.1 and below
111
+ text_model_lora_config: Optional[LoraConfigSimplified] = None,
112
+ audio_model_lora_config: Optional[LoraConfigSimplified] = None,
113
+ audio_latency_block_size: Optional[int] = None,
114
+ **kwargs,
115
+ ):
116
+ self.ignore_index = ignore_index
117
+
118
+ self.audio_model_id = audio_model_id
119
+ self.text_model_id = text_model_id
120
+
121
+ self.hidden_size = hidden_size
122
+ self.stack_factor = stack_factor
123
+ self.norm_init = norm_init
124
+ self.projector_act = projector_act
125
+ self.projector_ln_mid = projector_ln_mid
126
+ if text_model_id is not None:
127
+ self.text_config: transformers.LlamaConfig = (
128
+ transformers.AutoConfig.from_pretrained(text_model_id)
129
+ )
130
+ else:
131
+ text_config = text_config or {}
132
+ self.text_config = transformers.CONFIG_MAPPING[
133
+ text_config.get("model_type", "llama")
134
+ ](**text_config)
135
+
136
+ if audio_model_id is not None:
137
+ self.audio_config: transformers.PretrainedConfig = (
138
+ transformers.AutoConfig.from_pretrained(audio_model_id)
139
+ )
140
+ else:
141
+ audio_config = audio_config or {}
142
+ self.audio_config = transformers.CONFIG_MAPPING[
143
+ audio_config.get("model_type", "wav2vec2")
144
+ ](**audio_config)
145
+
146
+ self.text_model_lora_config = (
147
+ text_model_lora_config
148
+ if isinstance(text_model_lora_config, dict)
149
+ else dataclasses.asdict(text_model_lora_config or LoraConfigSimplified())
150
+ )
151
+ self.audio_model_lora_config = (
152
+ audio_model_lora_config
153
+ if isinstance(audio_model_lora_config, dict)
154
+ else dataclasses.asdict(audio_model_lora_config or LoraConfigSimplified())
155
+ )
156
+ self.audio_latency_block_size = audio_latency_block_size
157
+
158
+ self.vocab_size = self.text_config.vocab_size
159
+
160
+ self.initializer_range = self.text_config.initializer_range
161
+
162
+ super().__init__(**kwargs)
163
+
164
+ def to_diff_dict(self) -> Dict[str, Any]:
165
+ diff_dict = super().to_diff_dict()
166
+
167
+ # remove text_config and audio_config if text_model_id and audio_model_id are present
168
+ if self.text_model_id is not None:
169
+ diff_dict.pop("text_config", None)
170
+ if self.audio_model_id is not None:
171
+ diff_dict.pop("audio_config", None)
172
+
173
+ return diff_dict
checkpoint-3600/ultravox_model.py ADDED
@@ -0,0 +1,754 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import re
3
+ from typing import Any, Dict, Optional, Set, Tuple, Union
4
+
5
+ import peft
6
+ import torch
7
+ import torch.nn as nn
8
+ import torch.nn.functional as F
9
+ import transformers
10
+ import transformers.activations
11
+ import transformers.modeling_outputs
12
+ import transformers.models
13
+ from transformers.models.whisper import modeling_whisper as whisper
14
+
15
+ # We must use relative import in this directory to allow uploading to HF Hub
16
+ # Even "from . import X" pattern doesn't work (undocumented and unclear why)
17
+ from .ultravox_config import LossConfig
18
+ from .ultravox_config import LossFunction
19
+ from .ultravox_config import UltravoxConfig
20
+
21
+
22
+ class UltravoxModel(transformers.LlamaPreTrainedModel):
23
+ """
24
+ The Ultravox model which consists of an audio encoder and a language model.
25
+
26
+ Audio input is processed by the audio encoder, then every `stack_factor` frames are stacked together and
27
+ projected to the language model's embedding space using a few linear layers.
28
+ The text is embedded by the language model as usual and then the audio and text embeddings are merged together.
29
+
30
+ A special token `<|audio|>` is used to indicate the start of the audio embeddings in the merged embeddings.
31
+
32
+ Parameters:
33
+ config: Model configuration class with all the parameters of the model.
34
+ """
35
+
36
+ config_class = UltravoxConfig
37
+ config: UltravoxConfig # for type hinting
38
+ # Usually we load encoder and LLM weights from a pretrained model separately, so they are allowed to be missing
39
+ _keys_to_ignore_on_load_missing = ["audio_tower.*", "language_model.*"]
40
+ # Since we have kwargs in forward, we need to set this to False, otherwise grad_accum_steps will cause incorrect train loss to be reported
41
+ # see https://github.com/huggingface/transformers/issues/35856 and https://github.com/huggingface/trl/pull/2615/files
42
+ accepts_loss_kwargs = False
43
+
44
+ def __init__(self, config: UltravoxConfig):
45
+ super().__init__(config)
46
+ self._register_load_state_dict_pre_hook(self._pre_load_state_dict_hook)
47
+
48
+ self.keep_params: Set[str] = set()
49
+ self.vocab_size = config.vocab_size
50
+
51
+ self.audio_tower = self._create_audio_tower(config)
52
+ self.multi_modal_projector = self._create_multi_modal_projector(config)
53
+ self.language_model = self._create_language_model(config)
54
+
55
+ # Determine no_split_modules dynamically to use with FSDP auto_wrap policy.
56
+ # FSDP throws an error if some of the layer types are not found in the model.
57
+ # This would be something like ["LlamaDecoderLayer", "WhisperEncoderLayer"]
58
+ self._no_split_modules = (self.language_model._no_split_modules or []) + (
59
+ self.audio_tower._no_split_modules or []
60
+ )
61
+
62
+ self.loss_config = LossConfig()
63
+ self.post_init()
64
+
65
+ def get_input_embeddings(self):
66
+ return self.language_model.get_input_embeddings()
67
+
68
+ def set_input_embeddings(self, value):
69
+ self.language_model.set_input_embeddings(value)
70
+
71
+ def get_output_embeddings(self):
72
+ return self.language_model.get_output_embeddings()
73
+
74
+ def set_output_embeddings(self, new_embeddings):
75
+ self.language_model.set_output_embeddings(new_embeddings)
76
+
77
+ def set_decoder(self, decoder):
78
+ self.language_model.set_decoder(decoder)
79
+
80
+ def get_decoder(self):
81
+ return self.language_model.get_decoder()
82
+
83
+ def tie_weights(self):
84
+ return self.language_model.tie_weights()
85
+
86
+ def set_loss_config(self, loss_config: LossConfig):
87
+ self.loss_config = loss_config
88
+
89
+ def _setup_cache(
90
+ self, cache_cls, max_batch_size: int, max_cache_len: Optional[int] = None
91
+ ):
92
+ self.language_model._setup_cache(cache_cls, max_batch_size, max_cache_len)
93
+
94
+ def _reorder_cache(self, past_key_values, beam_idx):
95
+ return self.language_model._reorder_cache(past_key_values, beam_idx)
96
+
97
+ def resize_token_embeddings(
98
+ self,
99
+ new_num_tokens: Optional[int] = None,
100
+ pad_to_multiple_of: Optional[int] = None,
101
+ ) -> nn.Embedding:
102
+ model_embeds = self.language_model.resize_token_embeddings(
103
+ new_num_tokens, pad_to_multiple_of
104
+ )
105
+ # update vocab size
106
+ self.config.text_config.vocab_size = model_embeds.num_embeddings
107
+ self.config.vocab_size = model_embeds.num_embeddings
108
+ self.vocab_size = model_embeds.num_embeddings
109
+ return model_embeds
110
+
111
+ def _compute_kl_loss(
112
+ self,
113
+ lm_output: transformers.modeling_outputs.CausalLMOutputWithPast,
114
+ labels: Optional[torch.Tensor] = None,
115
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
116
+ alt_input_ids: Optional[torch.Tensor] = None,
117
+ alt_attention_mask: Optional[torch.Tensor] = None,
118
+ alt_labels: Optional[torch.Tensor] = None,
119
+ **kwargs,
120
+ ):
121
+ # disable gradient computation for the teacher model
122
+ with torch.no_grad():
123
+ # compute the teacher (text-only) model's distribution
124
+ alt_inputs_embeds = self.get_input_embeddings().forward(alt_input_ids)
125
+ alt_lm_output = self.language_model.forward(
126
+ inputs_embeds=alt_inputs_embeds,
127
+ labels=alt_labels,
128
+ attention_mask=alt_attention_mask,
129
+ past_key_values=past_key_values,
130
+ **kwargs,
131
+ )
132
+ # compute the KL divergence loss between the two models
133
+ kl_loss = F.kl_div(
134
+ F.log_softmax(
135
+ lm_output.logits[labels != -100] / self.loss_config.kl_temperature,
136
+ dim=-1,
137
+ ),
138
+ F.softmax(
139
+ alt_lm_output.logits[alt_labels != -100]
140
+ / self.loss_config.kl_temperature,
141
+ dim=-1,
142
+ ),
143
+ reduction="batchmean",
144
+ )
145
+ return {"loss": kl_loss}
146
+
147
+ def forward(
148
+ self,
149
+ input_ids: torch.Tensor,
150
+ audio_values: Optional[torch.FloatTensor] = None,
151
+ inputs_embeds: Optional[torch.FloatTensor] = None,
152
+ labels: Optional[torch.Tensor] = None,
153
+ attention_mask: Optional[torch.Tensor] = None,
154
+ audio_token_start_idx: Optional[torch.Tensor] = None,
155
+ audio_len: Optional[torch.Tensor] = None,
156
+ audio_token_len: Optional[torch.Tensor] = None,
157
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
158
+ # the alt_* fields are needed for KL divergence loss
159
+ alt_input_ids: Optional[torch.Tensor] = None,
160
+ alt_attention_mask: Optional[torch.Tensor] = None,
161
+ alt_labels: Optional[torch.Tensor] = None,
162
+ **kwargs,
163
+ ) -> Union[Tuple, transformers.modeling_outputs.CausalLMOutputWithPast]:
164
+ """
165
+ Forward pass for the Ultravox model.
166
+
167
+ `input_ids` are the tokenized text input. They are embedded by the language model as usual.
168
+ `audio_values` are processed by the audio encoder and then every `stack_factor` frames are stacked together and
169
+ projected to the language model's embedding space using a few linear layers.
170
+ The audio and text embeddings are merged together. A special token `<|audio|>` is used to indicate the start
171
+ of the audio embeddings in the merged embeddings.
172
+
173
+ Args:
174
+ input_ids: The tokenized text input.
175
+ audio_values: The processed audio values.
176
+ inputs_embeds: The embeddings for the input tokens.
177
+ labels: The tokenized text labels.
178
+ attention_mask: The attention mask for the input.
179
+ position_ids: The position ids for the input.
180
+ past_key_values: The past key value cache for the language model attention layers.
181
+ **kwargs: Additional keyword arguments. Passed directly to the language model.
182
+ """
183
+ if inputs_embeds is None:
184
+ # B x T -> B x T x D
185
+ inputs_embeds = self.get_input_embeddings().forward(input_ids)
186
+
187
+ if audio_values is not None:
188
+ assert (
189
+ audio_token_start_idx is not None and audio_token_len is not None
190
+ ), "audio_token_start_idx and audio_token_len must be provided if audio_values are provided."
191
+ assert (
192
+ len(audio_token_start_idx) == len(audio_token_len) == len(audio_values)
193
+ ), "audio_token_start_idx, audio_token_len, and audio_values must have the same batch size."
194
+
195
+ # B x A/3200 x D
196
+ audio_tower_output = self.audio_tower.forward(
197
+ audio_values.to(self.audio_tower.dtype),
198
+ audio_len=audio_len,
199
+ ).last_hidden_state
200
+ audio_tower_output = audio_tower_output.to(inputs_embeds.dtype)
201
+
202
+ audio_embeds = self.multi_modal_projector.forward(audio_tower_output)
203
+
204
+ # combine audio and text embeddings
205
+ for i, (audio, start, length) in enumerate(
206
+ zip(audio_embeds, audio_token_start_idx, audio_token_len)
207
+ ):
208
+ length = min(length, audio.shape[0])
209
+ inputs_embeds[i, start : start + length] = audio[:length]
210
+
211
+ lm_output = self.language_model.forward(
212
+ inputs_embeds=inputs_embeds,
213
+ labels=labels,
214
+ attention_mask=attention_mask,
215
+ past_key_values=past_key_values,
216
+ **kwargs,
217
+ )
218
+ if self.training:
219
+ if self.loss_config.loss_function == LossFunction.CrossEntropy:
220
+ return lm_output
221
+ elif self.loss_config.loss_function == LossFunction.KL_Divergence:
222
+ return self._compute_kl_loss(
223
+ lm_output=lm_output,
224
+ labels=labels,
225
+ past_key_values=past_key_values,
226
+ alt_input_ids=alt_input_ids,
227
+ alt_attention_mask=alt_attention_mask,
228
+ alt_labels=alt_labels,
229
+ **kwargs,
230
+ )
231
+ else:
232
+ raise ValueError(
233
+ f"Unsupported loss function: {self.loss_config.loss_function}"
234
+ )
235
+ else:
236
+ return lm_output
237
+
238
+ def prepare_inputs_for_generation(
239
+ self,
240
+ input_ids: torch.Tensor,
241
+ audio_values: Optional[torch.FloatTensor] = None,
242
+ audio_token_start_idx: Optional[torch.Tensor] = None,
243
+ audio_token_len: Optional[torch.Tensor] = None,
244
+ audio_len: Optional[torch.Tensor] = None,
245
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]] = None,
246
+ attention_mask: Optional[torch.Tensor] = None,
247
+ inputs_embeds: Optional[torch.Tensor] = None,
248
+ cache_position: Optional[torch.Tensor] = None,
249
+ **kwargs,
250
+ ) -> Dict[str, Any]:
251
+ model_input = self.language_model.prepare_inputs_for_generation(
252
+ input_ids=input_ids,
253
+ past_key_values=past_key_values,
254
+ attention_mask=attention_mask,
255
+ inputs_embeds=inputs_embeds,
256
+ cache_position=cache_position,
257
+ **kwargs,
258
+ )
259
+
260
+ # include audio information in model_input only when it is needed during prefilling
261
+ # audio_token_start_idx should always be relative to the current cache position
262
+ prefill_start_idx = 0 if cache_position is None else cache_position[0]
263
+ if (
264
+ audio_values is not None
265
+ and audio_token_start_idx is not None
266
+ and prefill_start_idx <= torch.max(audio_token_start_idx)
267
+ ):
268
+ model_input["audio_values"] = audio_values
269
+ model_input["audio_token_start_idx"] = (
270
+ audio_token_start_idx - prefill_start_idx
271
+ )
272
+ model_input["audio_token_len"] = audio_token_len
273
+ model_input["audio_len"] = audio_len
274
+
275
+ return model_input
276
+
277
+ @classmethod
278
+ def _create_multi_modal_projector(
279
+ cls, config: UltravoxConfig
280
+ ) -> "UltravoxProjector":
281
+ projector = UltravoxProjector(config)
282
+ projector.to(config.torch_dtype)
283
+ return projector
284
+
285
+ @classmethod
286
+ def _create_audio_tower(
287
+ cls, config: UltravoxConfig
288
+ ) -> Union[transformers.Wav2Vec2Model, "ModifiedWhisperEncoder"]:
289
+ if config.audio_model_id is not None:
290
+ if "whisper" in config.audio_model_id.lower():
291
+ audio_tower = ModifiedWhisperEncoder.from_pretrained(
292
+ config.audio_model_id, torch_dtype=config.torch_dtype
293
+ )
294
+ audio_tower.init_latency_mask(
295
+ config.audio_latency_block_size, dtype=config.torch_dtype
296
+ )
297
+ else:
298
+ assert config.audio_latency_block_size in (
299
+ None,
300
+ 0,
301
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
302
+ audio_tower = transformers.AutoModel.from_pretrained(
303
+ config.audio_model_id, torch_dtype=config.torch_dtype
304
+ )
305
+ else:
306
+ if "whisper" in config.audio_config._name_or_path.lower():
307
+ audio_tower = ModifiedWhisperEncoder(config.audio_config)
308
+ audio_tower.init_latency_mask(
309
+ config.audio_latency_block_size, dtype=config.torch_dtype
310
+ )
311
+ else:
312
+ assert config.audio_latency_block_size in (
313
+ None,
314
+ 0,
315
+ ), "only whisper audio tower supports audio latency masking, got non-zero value for 'audio_latency_block_size'"
316
+ with transformers.modeling_utils.no_init_weights():
317
+ # we only ever use from_config if the weights are retrained, hence initializing is not
318
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
319
+ audio_tower = transformers.AutoModel.from_config(
320
+ config.audio_config
321
+ )
322
+
323
+ if isinstance(
324
+ audio_tower,
325
+ (transformers.Wav2Vec2BertModel, transformers.WhisperModel),
326
+ ):
327
+ # For these models we only need the encoder part
328
+ # Wav2Vec2BertModel -> Wav2Vec2BertEncoder
329
+ # WhisperModel -> WhisperEncoder
330
+ audio_tower = audio_tower.encoder
331
+
332
+ audio_tower = apply_lora(audio_tower, config.audio_model_lora_config)
333
+ return audio_tower
334
+
335
+ @classmethod
336
+ def _create_language_model(
337
+ cls, config: UltravoxConfig
338
+ ) -> transformers.LlamaForCausalLM:
339
+ if config.text_model_id is not None:
340
+ language_model = transformers.AutoModelForCausalLM.from_pretrained(
341
+ config.text_model_id,
342
+ attn_implementation=config._attn_implementation,
343
+ torch_dtype=config.torch_dtype,
344
+ )
345
+ else:
346
+ with transformers.modeling_utils.no_init_weights():
347
+ # we only ever use from_config if the weights are retrained, hence initializing is not
348
+ # required. This makes the model quite creation faster since init on CPU is quite slow.
349
+ language_model = transformers.AutoModelForCausalLM.from_config(
350
+ config.text_config,
351
+ attn_implementation=config._attn_implementation,
352
+ torch_dtype=config.torch_dtype,
353
+ )
354
+
355
+ language_model = apply_lora(language_model, config.text_model_lora_config)
356
+ return language_model
357
+
358
+ def merge_and_unload(self):
359
+ if isinstance(self.language_model, peft.PeftModel):
360
+ self.language_model = self.language_model.merge_and_unload()
361
+ # no need to download base language model weights anymore, so we can remove the id
362
+ self.config.text_model_id = None
363
+ self.keep_params.update(
364
+ set(
365
+ [
366
+ f"language_model.{name}"
367
+ for name, _ in self.language_model.named_parameters()
368
+ ]
369
+ )
370
+ )
371
+
372
+ if isinstance(self.audio_tower, peft.PeftModel):
373
+ self.audio_tower = self.audio_tower.merge_and_unload()
374
+ # no need to download base audio model weights anymore, so we can remove the id
375
+ self.config.audio_model_id = None
376
+ self.keep_params.update(
377
+ set(
378
+ [
379
+ f"audio_tower.{name}"
380
+ for name, _ in self.audio_tower.named_parameters()
381
+ ]
382
+ )
383
+ )
384
+
385
+ for param in ["text_model_lora_config", "audio_model_lora_config"]:
386
+ if hasattr(self.config, param):
387
+ delattr(self.config, param)
388
+
389
+ def push_to_hub(self, *args, **kwargs):
390
+ self.merge_and_unload()
391
+ return super().push_to_hub(*args, **kwargs)
392
+
393
+ def diff_state_dict(
394
+ self, state_dict: Optional[Dict[str, Any]] = None
395
+ ) -> Dict[str, Any]:
396
+ if state_dict is None:
397
+ state_dict = super().state_dict()
398
+
399
+ named_params = dict(self.named_parameters())
400
+
401
+ state_dict = {
402
+ k: v
403
+ for k, v in state_dict.items()
404
+ if k in self.keep_params
405
+ or (k in named_params and named_params[k].requires_grad)
406
+ }
407
+
408
+ return state_dict
409
+
410
+ def save_pretrained(
411
+ self, *args, state_dict: Optional[Dict[str, Any]] = None, **kwargs
412
+ ):
413
+ state_dict = self.diff_state_dict(state_dict)
414
+
415
+ super().save_pretrained(*args, state_dict=state_dict, **kwargs)
416
+
417
+ def _pre_load_state_dict_hook(self, state_dict: Dict[str, Any], *args, **kwargs):
418
+ self.keep_params.update(set(state_dict.keys()))
419
+
420
+ def print_trainable_parameters(self):
421
+ """
422
+ Prints the number of trainable parameters in the model (reuses Peft model's method)
423
+ """
424
+ count_params = peft.peft_model.PeftModel.get_nb_trainable_parameters
425
+
426
+ trainable_params, all_param = count_params(self)
427
+
428
+ logging.info(
429
+ f"trainable params: {trainable_params:,d} || all params: {all_param:,d}"
430
+ f" || trainable%: {100 * trainable_params / all_param:.1f}%"
431
+ )
432
+
433
+ lm_trainable_params, lm_all_params = count_params(self.language_model)
434
+ audio_trainable_params, audio_all_params = count_params(self.audio_tower)
435
+
436
+ projector_trainable_params = (
437
+ trainable_params - lm_trainable_params - audio_trainable_params
438
+ )
439
+ projector_all_params = all_param - lm_all_params - audio_all_params
440
+
441
+ logging.info(
442
+ f"Trainable%: "
443
+ f" LLM: {100 * lm_trainable_params / lm_all_params:.1f}%"
444
+ f" || Audio Encoder: {100 * audio_trainable_params / audio_all_params:.1f}%"
445
+ f" || Projector: {100 * projector_trainable_params / projector_all_params:.1f}%"
446
+ )
447
+
448
+
449
+ # TODO: refactor common parts to a shared module
450
+ def is_cache_empty(
451
+ past_key_values: Optional[Union[Tuple, transformers.cache_utils.Cache]]
452
+ ) -> bool:
453
+ """
454
+ Check if the cache is empty.
455
+ """
456
+ if past_key_values is None:
457
+ return True
458
+ if isinstance(past_key_values, tuple):
459
+ return all(len(c) == 0 for c in past_key_values)
460
+ return past_key_values.get_seq_length() == 0
461
+
462
+
463
+ def apply_lora(model: torch.nn.Module, lora_config: dict) -> torch.nn.Module:
464
+ """
465
+ Applies LoRA finetuning to the model. If the `r` parameter is set to 0, the model is frozen instead.
466
+ """
467
+ unfreeze_layers = lora_config.pop("unfreeze_layers", None)
468
+ lora_config = peft.LoraConfig(**lora_config or {})
469
+
470
+ if lora_config.r == 0:
471
+ # freeze the model entirely, except for the specified layers
472
+ for name, param in model.named_parameters():
473
+ if not unfreeze_layers or not any(
474
+ re.match(layer, name) for layer in unfreeze_layers
475
+ ):
476
+ param.requires_grad = False
477
+ else:
478
+ logging.info(f"Unfreezing layer: {name} with #{param.numel()} params")
479
+ else:
480
+ model = peft.get_peft_model(model, lora_config)
481
+
482
+ return model
483
+
484
+
485
+ class StackAudioFrames(nn.Module):
486
+ """
487
+ Stack the audio embedding frames to reduce the sequence length by a factor of `stack_factor`.
488
+
489
+ The number of output frames will be `ceil(T / stack_factor) + 1` where `T` is the number of input frames.
490
+ NOTE: the extra +1 is intentional: in case the number of audio tokens are over-estimated by the processor,
491
+ we want to make sure `processor.audio_token_replacement` (i.e. EOS) doesn't get leaked into the middle of embeddings.
492
+ In most cases this extra padding will get removed in the model's forward function so it has no effect.
493
+ """
494
+
495
+ def __init__(self, stack_factor: int = 8):
496
+ super().__init__()
497
+ self.stack_factor = stack_factor
498
+
499
+ def forward(self, audio_embeds: torch.Tensor) -> torch.Tensor:
500
+ B, T, C = audio_embeds.shape
501
+ T_pad = (T + self.stack_factor - 1) // self.stack_factor * self.stack_factor
502
+ audio_embeds = F.pad(audio_embeds, (0, 0, 0, T_pad - T + self.stack_factor))
503
+ B, T, C = audio_embeds.shape
504
+ audio_embeds = audio_embeds.view(
505
+ B, T // self.stack_factor, C * self.stack_factor
506
+ )
507
+ return audio_embeds
508
+
509
+
510
+ class RMSNorm(transformers.models.llama.modeling_llama.LlamaRMSNorm):
511
+ def __init__(self, hidden_size: int, init: float = 1, eps: float = 1e-6):
512
+ super().__init__(hidden_size=hidden_size, eps=eps)
513
+ self.weight.data.fill_(init)
514
+
515
+
516
+ class SwiGLU(nn.Module):
517
+ def forward(self, x):
518
+ x, gate = x.chunk(2, dim=-1)
519
+ return F.silu(gate) * x
520
+
521
+
522
+ class UltravoxProjector(nn.Module):
523
+ def __init__(self, config: UltravoxConfig):
524
+ super().__init__()
525
+ self.hidden_dim = config.hidden_size
526
+ self._pad_and_stack = StackAudioFrames(config.stack_factor)
527
+ dim_in = config.audio_config.hidden_size * config.stack_factor
528
+ self.ln_pre = RMSNorm(dim_in, init=config.norm_init)
529
+ self.linear_1 = nn.Linear(dim_in, self.hidden_dim, bias=False)
530
+ dim_mid = self.hidden_dim
531
+ self.act = transformers.activations.get_activation(config.projector_act)
532
+ dim_mid = dim_mid // 2 if config.projector_act == "swiglu" else dim_mid
533
+ dim_out = config.text_config.hidden_size
534
+ self.linear_2 = nn.Linear(dim_mid, dim_out, bias=False)
535
+
536
+ # Ultravox v0.4.1 and below uses layer_norm after the second linear layer,
537
+ # while v0.5.0 and above uses layer_norm after the first linear layer.
538
+ if config.projector_ln_mid:
539
+ self.ln_mid: nn.Module = RMSNorm(dim_mid, init=config.norm_init)
540
+ self.ln_post: nn.Module = nn.Identity()
541
+ else:
542
+ self.ln_mid = nn.Identity()
543
+ self.ln_post = RMSNorm(dim_out, init=config.norm_init)
544
+
545
+ def forward(self, audio_features: torch.Tensor) -> torch.Tensor:
546
+ audio_features = self._pad_and_stack(audio_features)
547
+ audio_features = self.ln_pre(audio_features)
548
+ hidden_states = self.linear_1(audio_features)
549
+ hidden_states = self.act(hidden_states)
550
+ hidden_states = self.ln_mid(hidden_states)
551
+ hidden_states = self.linear_2(hidden_states)
552
+ hidden_states = self.ln_post(hidden_states)
553
+ return hidden_states
554
+
555
+
556
+ class ModifiedWhisperEncoder(
557
+ whisper.WhisperEncoder, transformers.modeling_utils.ModuleUtilsMixin
558
+ ):
559
+ """
560
+ Encoder portion of OpenAI's Whisper model.
561
+
562
+ This implementation is a slightly modified version of HF Transformers' Whisper Encoder, with only a few fixes:
563
+ 1. base_model_prefix updated to allow for doing `.from_pretrained` directly on the encoder
564
+ 2. allow less than 30 second of audio padding to be passed in:
565
+ - relaxed ValueError check for `input_features` length to be less than or equal to `expected_seq_length` instead of strictly equal
566
+ - embed_pos is now sliced to match the length of `inputs_embeds`
567
+
568
+ Original: https://github.com/huggingface/transformers/blob/main/src/transformers/models/whisper/modeling_whisper.py
569
+ """
570
+
571
+ base_model_prefix = "model.encoder"
572
+ _no_split_modules = ["WhisperEncoderLayer"]
573
+
574
+ def __init__(self, config: transformers.WhisperConfig):
575
+ super().__init__(config)
576
+ self.config.is_decoder = False
577
+
578
+ def init_latency_mask(self, audio_latency_block_size: int, dtype: torch.dtype):
579
+ if audio_latency_block_size is None:
580
+ self.audio_streaming_mask = None
581
+ return
582
+
583
+ # maximum sequence length
584
+ max_seqlen = (
585
+ self.config.max_source_positions
586
+ * self.conv1.stride[0]
587
+ * self.conv2.stride[0]
588
+ )
589
+ assert (
590
+ max_seqlen > 0
591
+ ), f"maximum sequence length must be positive, got {max_seqlen}"
592
+ assert (
593
+ max_seqlen % audio_latency_block_size == 0
594
+ ), f"audio_latency_block_size {audio_latency_block_size} must divide {max_seqlen} evenly."
595
+ # Given the block size, we calculate number of blocks.
596
+ audio_latency_nblocks = max_seqlen // audio_latency_block_size
597
+ audio_streaming_mask = (
598
+ torch.tril(
599
+ torch.ones(audio_latency_nblocks, audio_latency_nblocks),
600
+ diagonal=0,
601
+ )
602
+ .repeat_interleave(audio_latency_block_size, dim=0)
603
+ .repeat_interleave(audio_latency_block_size, dim=1)
604
+ )
605
+ audio_streaming_mask = (1.0 - audio_streaming_mask) * torch.finfo(dtype).min
606
+ audio_streaming_mask = audio_streaming_mask[None, None, :, :]
607
+ self.register_buffer(
608
+ "audio_streaming_mask", audio_streaming_mask, persistent=False
609
+ )
610
+
611
+ def forward(
612
+ self,
613
+ input_features,
614
+ audio_len=None,
615
+ head_mask=None,
616
+ output_attentions=None,
617
+ output_hidden_states=None,
618
+ return_dict=None,
619
+ ):
620
+ expected_seq_length = (
621
+ self.config.max_source_positions
622
+ * self.conv1.stride[0]
623
+ * self.conv2.stride[0]
624
+ )
625
+ if input_features.shape[-1] > expected_seq_length:
626
+ raise ValueError(
627
+ f"Whisper expects the mel input features to be of length {expected_seq_length} or less, but found {input_features.shape[-1]}. Make sure to pad the input mel features to {expected_seq_length}."
628
+ )
629
+
630
+ output_attentions = (
631
+ output_attentions
632
+ if output_attentions is not None
633
+ else self.config.output_attentions
634
+ )
635
+ output_hidden_states = (
636
+ output_hidden_states
637
+ if output_hidden_states is not None
638
+ else self.config.output_hidden_states
639
+ )
640
+ return_dict = (
641
+ return_dict if return_dict is not None else self.config.use_return_dict
642
+ )
643
+ inputs_embeds = nn.functional.gelu(self.conv1(input_features))
644
+ inputs_embeds = nn.functional.gelu(self.conv2(inputs_embeds))
645
+
646
+ inputs_embeds = inputs_embeds.permute(0, 2, 1)
647
+ embed_pos = self.embed_positions.weight[: inputs_embeds.size(-2)]
648
+
649
+ hidden_states = inputs_embeds + embed_pos
650
+ hidden_states = nn.functional.dropout(
651
+ hidden_states, p=self.dropout, training=self.training
652
+ )
653
+
654
+ encoder_states = () if output_hidden_states else None
655
+ all_attentions = () if output_attentions else None
656
+
657
+ # Create attention mask based on audio lengths to mask out padding tokens
658
+ # For each sample in batch:
659
+ # - Convert raw audio length to feature length after convolutions
660
+ # - Create boolean mask that is True for valid positions and False for padding
661
+ # - Convert to extended attention mask format expected by transformer layers
662
+ # (1.0 for positions to attend to, large negative for positions to ignore)
663
+ # This masking ensures consistent behavior between training and inference
664
+ # by preventing the model from attending to padding tokens in both cases
665
+ attention_mask = None
666
+ if audio_len != None:
667
+ audio_feature_len = self._get_feat_extract_output_lengths(audio_len)
668
+ max_seq_len = hidden_states.shape[1]
669
+ attention_mask = torch.arange(max_seq_len, device=hidden_states.device)[
670
+ None, :
671
+ ].lt(audio_feature_len.view(-1, 1))
672
+ attention_mask = self.get_extended_attention_mask(
673
+ attention_mask,
674
+ None,
675
+ device=hidden_states.device,
676
+ dtype=hidden_states.dtype,
677
+ )
678
+
679
+ if self.audio_streaming_mask is not None:
680
+ seqlen = hidden_states.size(-2)
681
+ if attention_mask is not None:
682
+ attention_mask = torch.minimum(
683
+ self.audio_streaming_mask[:, :, :seqlen, :seqlen], attention_mask
684
+ ) # merge
685
+ else:
686
+ attention_mask = self.audio_streaming_mask[:, :, :seqlen, :seqlen]
687
+ attention_mask = attention_mask.to(hidden_states.dtype)
688
+
689
+ # check if head_mask has a correct number of layers specified if desired
690
+ if head_mask is not None:
691
+ assert head_mask.size()[0] == (
692
+ len(self.layers)
693
+ ), f"The head_mask should be specified for {len(self.layers)} layers, but it is for {head_mask.size()[0]}."
694
+
695
+ for idx, encoder_layer in enumerate(self.layers):
696
+ if output_hidden_states:
697
+ encoder_states = encoder_states + (hidden_states,)
698
+ # add LayerDrop (see https://arxiv.org/abs/1909.11556 for description)
699
+ to_drop = False
700
+ if self.training:
701
+ dropout_probability = torch.rand([])
702
+ if dropout_probability < self.layerdrop: # skip the layer
703
+ to_drop = True
704
+
705
+ if to_drop:
706
+ layer_outputs = (None, None)
707
+ else:
708
+ if self.gradient_checkpointing and self.training:
709
+ layer_outputs = self._gradient_checkpointing_func(
710
+ encoder_layer.__call__,
711
+ hidden_states,
712
+ attention_mask,
713
+ (head_mask[idx] if head_mask is not None else None),
714
+ output_attentions,
715
+ )
716
+ else:
717
+ layer_outputs = encoder_layer(
718
+ hidden_states,
719
+ attention_mask,
720
+ layer_head_mask=(
721
+ head_mask[idx] if head_mask is not None else None
722
+ ),
723
+ output_attentions=output_attentions,
724
+ )
725
+
726
+ hidden_states = layer_outputs[0]
727
+
728
+ if output_attentions:
729
+ all_attentions = all_attentions + (layer_outputs[1],)
730
+
731
+ hidden_states = self.layer_norm(hidden_states)
732
+ if output_hidden_states:
733
+ encoder_states = encoder_states + (hidden_states,)
734
+
735
+ if not return_dict:
736
+ return tuple(
737
+ v
738
+ for v in [hidden_states, encoder_states, all_attentions]
739
+ if v is not None
740
+ )
741
+ return transformers.modeling_outputs.BaseModelOutput(
742
+ last_hidden_state=hidden_states,
743
+ hidden_states=encoder_states,
744
+ attentions=all_attentions,
745
+ )
746
+
747
+
748
+ UltravoxConfig.register_for_auto_class()
749
+ UltravoxModel.register_for_auto_class()
750
+
751
+ transformers.AutoConfig.register("ultravox", UltravoxConfig)
752
+ transformers.AutoModel.register(UltravoxConfig, UltravoxModel)
753
+
754
+ transformers.activations.ACT2FN["swiglu"] = SwiGLU
checkpoint-3600/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-7200/config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UltravoxModel"
4
+ ],
5
+ "audio_latency_block_size": null,
6
+ "audio_model_id": "openai/whisper-large-v3-turbo",
7
+ "audio_model_lora_config": {
8
+ "lora_alpha": 8,
9
+ "r": 0,
10
+ "target_modules": [
11
+ "k_proj",
12
+ "q_proj",
13
+ "linear_k",
14
+ "linear_q"
15
+ ]
16
+ },
17
+ "auto_map": {
18
+ "AutoConfig": "ultravox_config.UltravoxConfig",
19
+ "AutoModel": "ultravox_model.UltravoxModel"
20
+ },
21
+ "hidden_size": 4096,
22
+ "ignore_index": -100,
23
+ "initializer_range": 0.02,
24
+ "model_type": "ultravox",
25
+ "norm_init": 0.4,
26
+ "pad_token_id": 2,
27
+ "projector_act": "swiglu",
28
+ "projector_ln_mid": false,
29
+ "stack_factor": 8,
30
+ "text_model_id": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
31
+ "text_model_lora_config": {
32
+ "lora_alpha": 8,
33
+ "r": 0,
34
+ "target_modules": [
35
+ "k_proj",
36
+ "q_proj",
37
+ "linear_k",
38
+ "linear_q"
39
+ ]
40
+ },
41
+ "torch_dtype": "bfloat16",
42
+ "transformers_version": "4.47.0",
43
+ "vocab_size": 49152
44
+ }
checkpoint-7200/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "4.47.0"
7
+ }
checkpoint-7200/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-7200/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f21f8b45ee065ed6f618befeb1bfc6692a6bddd53677942d6441d37c9f2deb5
3
+ size 92299736
checkpoint-7200/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1186377a7f21ea6b553cc9792f5a5dee90bb2759021e2938268a524806e4cef
3
+ size 184602962