niobures commited on
Commit
16b9b9a
Β·
verified Β·
1 Parent(s): 5ea86b3
.gitattributes CHANGED
@@ -33,3 +33,16 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ en/maya1-GGUF/maya1.f16.gguf filter=lfs diff=lfs merge=lfs -text
37
+ en/maya1-GGUF/maya1.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
38
+ en/maya1-GGUF/maya1.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
39
+ en/maya1-GGUF/maya1.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
40
+ en/maya1-GGUF/maya1.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
41
+ en/maya1-GGUF/maya1.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
42
+ en/maya1-GGUF/maya1.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
43
+ en/maya1-GGUF/maya1.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
44
+ en/maya1-GGUF/maya1.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
45
+ en/maya1-GGUF/maya1.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
46
+ en/maya1-GGUF/maya1.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
47
+ en/maya1-GGUF/maya1.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
48
+ en/maya1/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
en/maya1-GGUF/.gitattributes ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ maya1.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
37
+ maya1.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
38
+ maya1.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
39
+ maya1.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ maya1.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
41
+ maya1.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
42
+ maya1.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
43
+ maya1.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
44
+ maya1.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
45
+ maya1.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
46
+ maya1.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
47
+ maya1.f16.gguf filter=lfs diff=lfs merge=lfs -text
en/maya1-GGUF/README.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: maya-research/maya1
3
+ datasets: proprietary
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: apache-2.0
8
+ mradermacher:
9
+ readme_rev: 1
10
+ quantized_by: mradermacher
11
+ ---
12
+ ## About
13
+
14
+ <!-- ### quantize_version: 2 -->
15
+ <!-- ### output_tensor_quantised: 1 -->
16
+ <!-- ### convert_type: hf -->
17
+ <!-- ### vocab_type: -->
18
+ <!-- ### tags: -->
19
+ <!-- ### quants: x-f16 Q4_K_S Q2_K Q8_0 Q6_K Q3_K_M Q3_K_S Q3_K_L Q4_K_M Q5_K_S Q5_K_M IQ4_XS -->
20
+ <!-- ### quants_skip: -->
21
+ <!-- ### skip_mmproj: -->
22
+ static quants of https://huggingface.co/maya-research/maya1
23
+
24
+ <!-- provided-files -->
25
+
26
+ ***For a convenient overview and download list, visit our [model page for this model](https://hf.tst.eu/model#maya1-GGUF).***
27
+
28
+ weighted/imatrix quants seem not to be available (by me) at this time. If they do not show up a week or so after the static ones, I have probably not planned for them. Feel free to request them by opening a Community Discussion.
29
+ ## Usage
30
+
31
+ If you are unsure how to use GGUF files, refer to one of [TheBloke's
32
+ READMEs](https://huggingface.co/TheBloke/KafkaLM-70B-German-V0.1-GGUF) for
33
+ more details, including on how to concatenate multi-part files.
34
+
35
+ ## Provided Quants
36
+
37
+ (sorted by size, not necessarily quality. IQ-quants are often preferable over similar sized non-IQ quants)
38
+
39
+ | Link | Type | Size/GB | Notes |
40
+ |:-----|:-----|--------:|:------|
41
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q2_K.gguf) | Q2_K | 1.5 | |
42
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q3_K_S.gguf) | Q3_K_S | 1.7 | |
43
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q3_K_M.gguf) | Q3_K_M | 1.9 | lower quality |
44
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q3_K_L.gguf) | Q3_K_L | 2.0 | |
45
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.IQ4_XS.gguf) | IQ4_XS | 2.0 | |
46
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q4_K_S.gguf) | Q4_K_S | 2.1 | fast, recommended |
47
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q4_K_M.gguf) | Q4_K_M | 2.2 | fast, recommended |
48
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q5_K_S.gguf) | Q5_K_S | 2.4 | |
49
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q5_K_M.gguf) | Q5_K_M | 2.5 | |
50
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q6_K.gguf) | Q6_K | 2.8 | very good quality |
51
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.Q8_0.gguf) | Q8_0 | 3.6 | fast, best quality |
52
+ | [GGUF](https://huggingface.co/mradermacher/maya1-GGUF/resolve/main/maya1.f16.gguf) | f16 | 6.7 | 16 bpw, overkill |
53
+
54
+ Here is a handy graph by ikawrakow comparing some lower-quality quant
55
+ types (lower is better):
56
+
57
+ ![image.png](https://www.nethype.de/huggingface_embed/quantpplgraph.png)
58
+
59
+ And here are Artefact2's thoughts on the matter:
60
+ https://gist.github.com/Artefact2/b5f810600771265fc1e39442288e8ec9
61
+
62
+ ## FAQ / Model Request
63
+
64
+ See https://huggingface.co/mradermacher/model_requests for some answers to
65
+ questions you might have and/or if you want some other model quantized.
66
+
67
+ ## Thanks
68
+
69
+ I thank my company, [nethype GmbH](https://www.nethype.de/), for letting
70
+ me use its servers and providing upgrades to my workstation to enable
71
+ this work in my free time.
72
+
73
+ <!-- end -->
en/maya1-GGUF/maya1.IQ4_XS.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:126df9ce2027ef1a989e45a1c310e920a388d4905d8cceae72dace0addcd53c2
3
+ size 1914148192
en/maya1-GGUF/maya1.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0679a6fbf21b990ce5165bb9ba73c948fc10b9ade18737d5b0b54cc325cca28a
3
+ size 1437177184
en/maya1-GGUF/maya1.Q3_K_L.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:945f5c4945a21b52b3bc21c8b78544b8f8b42efdc69fd652d623a6e010765cfe
3
+ size 1888589152
en/maya1-GGUF/maya1.Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042396930f8186085077c13a33cb749e18e062d285ca270feca3e801e9d6d0d5
3
+ size 1760400736
en/maya1-GGUF/maya1.Q3_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d5b0317e9985533a4338b1f2dedea6498ac03c6aed65ad86cdd1c6072096083
3
+ size 1616090464
en/maya1-GGUF/maya1.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:728303bf4412147b4b13d00cba0d6e03fca128e4cf4394d418124ba24ebed82e
3
+ size 2092619104
en/maya1-GGUF/maya1.Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e9f3c2ffd48d58ad935434056e43ad6a9915351050782e83277e2f7c10248af
3
+ size 2001442144
en/maya1-GGUF/maya1.Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d43a61a8281459c78b02b8e7cdec99ae1f9258a3e32d6a0a0f24747ca0cc7cc0
3
+ size 2395395424
en/maya1-GGUF/maya1.Q5_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab56dc47e8988349971c15697a2938c235264a5ce6ba957e2d685e9b60d1cd35
3
+ size 2342753632
en/maya1-GGUF/maya1.Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96ea75c96536ea310ce0628146b91a41852efe4ffb1fe2c7638ad80469782a4f
3
+ size 2717095264
en/maya1-GGUF/maya1.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:529b6f9a059a0f82475dd5b499100c3bb9f600a4d1bb1e8e62620c19bd913224
3
+ size 3516496480
en/maya1-GGUF/maya1.f16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdde05b4d498f5684f01b2408215116f9f252ee420d4d28322d489aba536c092
3
+ size 6610952800
en/maya1-GGUF/source.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/mradermacher/maya1-GGUF
en/maya1/.gitattributes ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ checkpoint-10000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ checkpoint-15000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ checkpoint-5000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
39
+ tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
40
+ checkpoint-20000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
41
+ checkpoint-25000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
42
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
en/maya1/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ venv/
en/maya1/README.md ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ datasets: proprietary
7
+ pipeline_tag: text-to-speech
8
+ ---
9
+
10
+ # Maya1
11
+
12
+ **Maya1** is a state-of-the-art speech model for expressive voice generation, built to capture real human emotion and precise voice design.
13
+
14
+ **try it:** [Playground](https://www.mayaresearch.ai/studio)
15
+
16
+ **What it does:**
17
+ - Create any voice you can imagine β€” a 20s British girl, an American guy, or a full-blown demon.
18
+ - Make it feel real with emotion tags: laugh, cry, whisper, rage, sigh, gasp.
19
+ - It streams instantly, sounds alive, 3B parameters, runs on single GPU
20
+ - Outperforms top proprietary models. and Developed by Maya Research.
21
+
22
+ ## Demos
23
+
24
+ <table>
25
+ <tr>
26
+ <td width="50%">
27
+ <strong>Energetic Female Event Host</strong><br/>
28
+ <video controls playsinline width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/JKzy8zA36qvsOblV-lhd1.mp4">
29
+ Your browser does not support video.
30
+ </video>
31
+ <details>
32
+ <summary>Voice description</summary>
33
+ <pre>Female, in her 30s with an American accent and is an event host, energetic, clear diction</pre>
34
+ </details>
35
+ </td>
36
+ <td width="50%">
37
+ <strong>Calm Male Narrator</strong><br/>
38
+ <video controls playsinline width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/96ntP7hGROwdg9w9Gu5tH.mp4"></video>
39
+ <details>
40
+ <summary>Voice description</summary>
41
+ <pre>Male, late 20s, neutral American, warm baritone, calm pacing</pre>
42
+ </details>
43
+ </td>
44
+ </tr>
45
+ </table>
46
+
47
+
48
+ ### Example 1: Energetic Female Event Host
49
+
50
+ **Voice Description:**
51
+ ```
52
+ Female, in her 30s with an American accent and is an event host, energetic, clear diction
53
+ ```
54
+
55
+ **Text:**
56
+ ```
57
+ Wow. This place looks even better than I imagined. How did they set all this up so perfectly? The lights, the music, everything feels magical. I can't stop smiling right now.
58
+ ```
59
+
60
+ **Audio Output:**
61
+
62
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/4zDlBLeFk0Y2rOrQhMW9r.wav"></audio>
63
+
64
+ ---
65
+
66
+ ### Example 2: Dark Villain with Anger
67
+
68
+ **Voice Description:**
69
+ ```
70
+ Dark villain character, Male voice in their 40s with a British accent. low pitch, gravelly timbre, slow pacing, angry tone at high intensity.
71
+ ```
72
+
73
+ **Text:**
74
+ ```
75
+ Welcome back to another episode of our podcast! <laugh_harder> Today we are diving into an absolutely fascinating topic
76
+ ```
77
+
78
+ **Audio Output:**
79
+
80
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/mT6FnTrA3KYQnwfJms92X.wav"></audio>
81
+
82
+ ---
83
+
84
+ ### Example 3: Demon Character (Screaming Emotion)
85
+
86
+ **Voice Description:**
87
+ ```
88
+ Demon character, Male voice in their 30s with a Middle Eastern accent. screaming tone at high intensity.
89
+ ```
90
+
91
+ **Text:**
92
+ ```
93
+ You dare challenge me, mortal <snort> how amusing. Your kind always thinks they can win
94
+ ```
95
+
96
+ **Audio Output:**
97
+
98
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/oxdns7uACCmLyC-P4H30G.wav"></audio>
99
+
100
+ ---
101
+
102
+ ### Example 4: Mythical Goddess with Crying Emotion
103
+
104
+ **Voice Description:**
105
+ ```
106
+ Mythical godlike magical character, Female voice in their 30s slow pacing, curious tone at medium intensity.
107
+ ```
108
+
109
+ **Text:**
110
+ ```
111
+ After all we went through to pull him out of that mess <cry> I can't believe he was the traitor
112
+ ```
113
+
114
+ **Audio Output:**
115
+
116
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/642a7d4e556ab448a0701ca1/ggzAhM-rEUyv_mPLSALQG.wav"></audio>
117
+
118
+ ---
119
+
120
+ ## Why Maya1 is Different: Voice Design Features That Matter
121
+
122
+ ### 1. Natural Language Voice Control
123
+ Describe voices like you would brief a voice actor:
124
+ ```
125
+ <description="40-year-old, warm, low pitch, conversational">
126
+ ```
127
+
128
+ No complex parameters. No training data. Just describe and generate.
129
+
130
+ ### 2. Inline Emotion Tags for Expressive Speech
131
+ Add emotions exactly where they belong in your text:
132
+ ```
133
+ Our new update <laugh> finally ships with the feature you asked for.
134
+ ```
135
+
136
+ **Supported Emotions:** `<laugh>` `<sigh>` `<whisper>` `<angry>` `<giggle>` `<chuckle>` `<gasp>` `<cry>` and 12+ more.
137
+
138
+ ### 3. Streaming Audio Generation
139
+ Real-time voice synthesis with SNAC neural codec (~0.98 kbps). Perfect for:
140
+ - Voice assistants
141
+ - Interactive AI agents
142
+ - Live content generation
143
+ - Game characters
144
+ - Podcasts and audiobooks
145
+
146
+ ### 4. Production-Ready Infrastructure
147
+ - Runs on single GPU
148
+ - vLLM integration for scale
149
+ - Automatic prefix caching for efficiency
150
+ - 24 kHz audio output
151
+ - WebAudio compatible for browser playback
152
+
153
+ ---
154
+
155
+ ## How to Use maya1: Download and Run in Minutes
156
+
157
+ ### Quick Start: Generate Voice with Emotions
158
+
159
+ ```python
160
+ #!/usr/bin/env python3
161
+
162
+ import torch
163
+ from transformers import AutoModelForCausalLM, AutoTokenizer
164
+ from snac import SNAC
165
+ import soundfile as sf
166
+ import numpy as np
167
+
168
+ CODE_START_TOKEN_ID = 128257
169
+ CODE_END_TOKEN_ID = 128258
170
+ CODE_TOKEN_OFFSET = 128266
171
+ SNAC_MIN_ID = 128266
172
+ SNAC_MAX_ID = 156937
173
+ SNAC_TOKENS_PER_FRAME = 7
174
+
175
+ SOH_ID = 128259
176
+ EOH_ID = 128260
177
+ SOA_ID = 128261
178
+ BOS_ID = 128000
179
+ TEXT_EOT_ID = 128009
180
+
181
+
182
+ def build_prompt(tokenizer, description: str, text: str) -> str:
183
+ """Build formatted prompt for Maya1."""
184
+ soh_token = tokenizer.decode([SOH_ID])
185
+ eoh_token = tokenizer.decode([EOH_ID])
186
+ soa_token = tokenizer.decode([SOA_ID])
187
+ sos_token = tokenizer.decode([CODE_START_TOKEN_ID])
188
+ eot_token = tokenizer.decode([TEXT_EOT_ID])
189
+ bos_token = tokenizer.bos_token
190
+
191
+ formatted_text = f'<description="{description}"> {text}'
192
+
193
+ prompt = (
194
+ soh_token + bos_token + formatted_text + eot_token +
195
+ eoh_token + soa_token + sos_token
196
+ )
197
+
198
+ return prompt
199
+
200
+
201
+ def extract_snac_codes(token_ids: list) -> list:
202
+ """Extract SNAC codes from generated tokens."""
203
+ try:
204
+ eos_idx = token_ids.index(CODE_END_TOKEN_ID)
205
+ except ValueError:
206
+ eos_idx = len(token_ids)
207
+
208
+ snac_codes = [
209
+ token_id for token_id in token_ids[:eos_idx]
210
+ if SNAC_MIN_ID <= token_id <= SNAC_MAX_ID
211
+ ]
212
+
213
+ return snac_codes
214
+
215
+
216
+ def unpack_snac_from_7(snac_tokens: list) -> list:
217
+ """Unpack 7-token SNAC frames to 3 hierarchical levels."""
218
+ if snac_tokens and snac_tokens[-1] == CODE_END_TOKEN_ID:
219
+ snac_tokens = snac_tokens[:-1]
220
+
221
+ frames = len(snac_tokens) // SNAC_TOKENS_PER_FRAME
222
+ snac_tokens = snac_tokens[:frames * SNAC_TOKENS_PER_FRAME]
223
+
224
+ if frames == 0:
225
+ return [[], [], []]
226
+
227
+ l1, l2, l3 = [], [], []
228
+
229
+ for i in range(frames):
230
+ slots = snac_tokens[i*7:(i+1)*7]
231
+ l1.append((slots[0] - CODE_TOKEN_OFFSET) % 4096)
232
+ l2.extend([
233
+ (slots[1] - CODE_TOKEN_OFFSET) % 4096,
234
+ (slots[4] - CODE_TOKEN_OFFSET) % 4096,
235
+ ])
236
+ l3.extend([
237
+ (slots[2] - CODE_TOKEN_OFFSET) % 4096,
238
+ (slots[3] - CODE_TOKEN_OFFSET) % 4096,
239
+ (slots[5] - CODE_TOKEN_OFFSET) % 4096,
240
+ (slots[6] - CODE_TOKEN_OFFSET) % 4096,
241
+ ])
242
+
243
+ return [l1, l2, l3]
244
+
245
+
246
+ def main():
247
+
248
+ # Load the best open source voice AI model
249
+ print("\n[1/3] Loading Maya1 model...")
250
+ model = AutoModelForCausalLM.from_pretrained(
251
+ "maya-research/maya1",
252
+ torch_dtype=torch.bfloat16,
253
+ device_map="auto",
254
+ trust_remote_code=True
255
+ )
256
+ tokenizer = AutoTokenizer.from_pretrained(
257
+ "maya-research/maya1",
258
+ trust_remote_code=True
259
+ )
260
+ print(f"Model loaded: {len(tokenizer)} tokens in vocabulary")
261
+
262
+ # Load SNAC audio decoder (24kHz)
263
+ print("\n[2/3] Loading SNAC audio decoder...")
264
+ snac_model = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").eval()
265
+ if torch.cuda.is_available():
266
+ snac_model = snac_model.to("cuda")
267
+ print("SNAC decoder loaded")
268
+
269
+ # Design your voice with natural language
270
+ description = "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing."
271
+ text = "Hello! This is Maya1 <laugh_harder> the best open source voice AI model with emotions."
272
+
273
+ print("\n[3/3] Generating speech...")
274
+ print(f"Description: {description}")
275
+ print(f"Text: {text}")
276
+
277
+ # Create prompt with proper formatting
278
+ prompt = build_prompt(tokenizer, description, text)
279
+
280
+ # Debug: Show prompt details
281
+ print(f"\nPrompt preview (first 200 chars):")
282
+ print(f" {repr(prompt[:200])}")
283
+ print(f" Prompt length: {len(prompt)} chars")
284
+
285
+ # Generate emotional speech
286
+ inputs = tokenizer(prompt, return_tensors="pt")
287
+ print(f" Input token count: {inputs['input_ids'].shape[1]} tokens")
288
+ if torch.cuda.is_available():
289
+ inputs = {k: v.to("cuda") for k, v in inputs.items()}
290
+
291
+ with torch.inference_mode():
292
+ outputs = model.generate(
293
+ **inputs,
294
+ max_new_tokens=2048, # Increase to let model finish naturally
295
+ min_new_tokens=28, # At least 4 SNAC frames
296
+ temperature=0.4,
297
+ top_p=0.9,
298
+ repetition_penalty=1.1, # Prevent loops
299
+ do_sample=True,
300
+ eos_token_id=CODE_END_TOKEN_ID, # Stop at end of speech token
301
+ pad_token_id=tokenizer.pad_token_id,
302
+ )
303
+
304
+ # Extract generated tokens (everything after the input prompt)
305
+ generated_ids = outputs[0, inputs['input_ids'].shape[1]:].tolist()
306
+
307
+ print(f"Generated {len(generated_ids)} tokens")
308
+
309
+ # Debug: Check what tokens we got
310
+ print(f" First 20 tokens: {generated_ids[:20]}")
311
+ print(f" Last 20 tokens: {generated_ids[-20:]}")
312
+
313
+ # Check if EOS was generated
314
+ if CODE_END_TOKEN_ID in generated_ids:
315
+ eos_position = generated_ids.index(CODE_END_TOKEN_ID)
316
+ print(f" EOS token found at position {eos_position}/{len(generated_ids)}")
317
+
318
+ # Extract SNAC audio tokens
319
+ snac_tokens = extract_snac_codes(generated_ids)
320
+
321
+ print(f"Extracted {len(snac_tokens)} SNAC tokens")
322
+
323
+ # Debug: Analyze token types
324
+ snac_count = sum(1 for t in generated_ids if SNAC_MIN_ID <= t <= SNAC_MAX_ID)
325
+ other_count = sum(1 for t in generated_ids if t < SNAC_MIN_ID or t > SNAC_MAX_ID)
326
+ print(f" SNAC tokens in output: {snac_count}")
327
+ print(f" Other tokens in output: {other_count}")
328
+
329
+ # Check for SOS token
330
+ if CODE_START_TOKEN_ID in generated_ids:
331
+ sos_pos = generated_ids.index(CODE_START_TOKEN_ID)
332
+ print(f" SOS token at position: {sos_pos}")
333
+ else:
334
+ print(f" No SOS token found in generated output!")
335
+
336
+ if len(snac_tokens) < 7:
337
+ print("Error: Not enough SNAC tokens generated")
338
+ return
339
+
340
+ # Unpack SNAC tokens to 3 hierarchical levels
341
+ levels = unpack_snac_from_7(snac_tokens)
342
+ frames = len(levels[0])
343
+
344
+ print(f"Unpacked to {frames} frames")
345
+ print(f" L1: {len(levels[0])} codes")
346
+ print(f" L2: {len(levels[1])} codes")
347
+ print(f" L3: {len(levels[2])} codes")
348
+
349
+ # Convert to tensors
350
+ device = "cuda" if torch.cuda.is_available() else "cpu"
351
+ codes_tensor = [
352
+ torch.tensor(level, dtype=torch.long, device=device).unsqueeze(0)
353
+ for level in levels
354
+ ]
355
+
356
+ # Generate final audio with SNAC decoder
357
+ print("\n[4/4] Decoding to audio...")
358
+ with torch.inference_mode():
359
+ z_q = snac_model.quantizer.from_codes(codes_tensor)
360
+ audio = snac_model.decoder(z_q)[0, 0].cpu().numpy()
361
+
362
+ # Trim warmup samples (first 2048 samples)
363
+ if len(audio) > 2048:
364
+ audio = audio[2048:]
365
+
366
+ duration_sec = len(audio) / 24000
367
+ print(f"Audio generated: {len(audio)} samples ({duration_sec:.2f}s)")
368
+
369
+ # Save your emotional voice output
370
+ output_file = "output.wav"
371
+ sf.write(output_file, audio, 24000)
372
+ print(f"\nVoice generated successfully!")
373
+
374
+
375
+ if __name__ == "__main__":
376
+ main()
377
+ ```
378
+
379
+ ### Advanced: Production Streaming with vLLM
380
+
381
+ For production deployments with real-time streaming, use our vLLM script:
382
+
383
+ **Download:** [vllm_streaming_inference.py](https://huggingface.co/maya-research/maya1/blob/main/vllm_streaming_inference.py)
384
+
385
+ **Key Features:**
386
+ - Automatic Prefix Caching (APC) for repeated voice descriptions
387
+ - WebAudio ring buffer integration
388
+ - Multi-GPU scaling support
389
+ - Sub-100ms latency for real-time applications
390
+
391
+ ---
392
+
393
+ ## Technical Excellence: What Makes Maya1 the Best
394
+
395
+ ### Architecture: 3B-Parameter Llama Backbone for Voice
396
+
397
+ We pretrained a **3B-parameter decoder-only transformer** (Llama-style) to predict **SNAC neural codec tokens** instead of raw waveforms.
398
+
399
+ **The Flow:**
400
+ ```
401
+ <description="..."> text β†’ tokenize β†’ generate SNAC codes (7 tokens/frame) β†’ decode β†’ 24 kHz audio
402
+ ```
403
+
404
+ **Why SNAC?** Multi-scale hierarchical structure (β‰ˆ12/23/47 Hz) keeps autoregressive sequences compact for real-time streaming at ~0.98 kbps.
405
+
406
+ ### Training Data: What Makes Our Voice AI the Best
407
+
408
+ **Pretraining:** Internet-scale English speech corpus for broad acoustic coverage and natural coarticulation.
409
+
410
+ **Supervised Fine-Tuning:** Proprietary curated dataset of studio recordings with:
411
+ - Human-verified voice descriptions
412
+ - 20+ emotion tags per sample
413
+ - Multi-accent English coverage
414
+ - Character and role variations
415
+
416
+ **Data Pipeline Excellence:**
417
+ 1. 24 kHz mono resampling with -23 LUFS normalization
418
+ 2. VAD silence trimming with duration bounds (1-14s)
419
+ 3. Forced alignment (MFA) for clean phrase boundaries
420
+ 4. MinHash-LSH text deduplication
421
+ 5. Chromaprint audio deduplication
422
+ 6. SNAC encoding with 7-token frame packing
423
+
424
+ ### Voice Design Experiments: Why Natural Language Won
425
+
426
+ We tested 4 conditioning formats. Only one delivered production-quality results:
427
+
428
+ **❌ Colon format:** `{description}: {text}` - Format drift, model spoke descriptions
429
+
430
+ **❌ Angle-list attributes:** `<{age}, {pitch}, {character}>` - Too rigid, poor generalization
431
+
432
+ **❌ Key-value tags:** `<age=40><pitch=low>` - Token bloat, brittle to mistakes
433
+
434
+ **βœ… XML-attribute (WINNER):** `<description="40-yr old, low-pitch, warm">` - Natural language, robust, scalable
435
+
436
+ ---
437
+
438
+ ## Use Cases
439
+
440
+ ### Game Character Voices
441
+ Generate unique character voices with emotions on-the-fly. No voice actor recording sessions.
442
+
443
+ ### Podcast & Audiobook Production
444
+ Narrate content with emotional range and consistent personas across hours of audio.
445
+
446
+ ### AI Voice Assistants
447
+ Build conversational agents with natural emotional responses in real-time.
448
+
449
+ ### Video Content Creation
450
+ Create voiceovers for YouTube, TikTok, and social media with expressive delivery.
451
+
452
+ ### Customer Service AI
453
+ Deploy empathetic voice bots that understand context and respond with appropriate emotions.
454
+
455
+ ### Accessibility Tools
456
+ Build screen readers and assistive technologies with natural, engaging voices.
457
+
458
+ ---
459
+
460
+ ## Frequently Asked Questions
461
+
462
+ **Q: What makes Maya1 different?**
463
+ A: We're the only open source model offering 20+ emotions, zero-shot voice design, production-ready streaming, and 3B parametersβ€”all in one package.
464
+
465
+ **Q: Can I use this commercially?**
466
+ A: Absolutely. Apache 2.0 license. Build products, deploy services, monetize freely.
467
+
468
+ **Q: What languages does it support?**
469
+ A: Currently English with multi-accent support. Future models will expand to languages and accents underserved by mainstream voice AI.
470
+
471
+ **Q: How does it compare to ElevenLabs, Murf.ai, or other closed-source tools?**
472
+ A: Feature parity with emotions and voice design. Advantage: you own the deployment, pay no per-second fees, and can customize the model.
473
+
474
+ **Q: Can I fine-tune on my own voices?**
475
+ A: Yes. The model architecture supports fine-tuning on custom datasets for specialized voices.
476
+
477
+ **Q: What GPU do I need?**
478
+ A: Single GPU with 16GB+ VRAM (A100, H100, or consumer RTX 4090).
479
+
480
+ **Q: Is streaming really real-time?**
481
+ A: Yes. SNAC codec enables sub-100ms latency with vLLM deployment.
482
+
483
+ ---
484
+
485
+ ## Comparison
486
+
487
+ | Feature | Maya1 | ElevenLabs | OpenAI TTS | Coqui TTS |
488
+ |---------|-------------|------------|------------|-----------|
489
+ | **Open Source** | Yes | No | No | Yes |
490
+ | **Emotions** | 20+ | Limited | No | No |
491
+ | **Voice Design** | Natural Language | Voice Library | Fixed | Complex |
492
+ | **Streaming** | Real-time | Yes | Yes | No |
493
+ | **Cost** | Free | Pay-per-use | Pay-per-use | Free |
494
+ | **Customization** | Full | Limited | None | Moderate |
495
+ | **Parameters** | 3B | Unknown | Unknown | <1B |
496
+
497
+ ---
498
+
499
+ ## Model Metadata
500
+
501
+ **Developed by:** Maya Research
502
+ **Website:** [mayaresearch.ai](https://mayaresearch.ai)
503
+ **Backed by:** South Park Commons
504
+ **Model Type:** Text-to-Speech, Emotional Voice Synthesis, Voice Design AI
505
+ **Language:** English (Multi-accent)
506
+ **Architecture:** 3B-parameter Llama-style transformer with SNAC codec
507
+ **License:** Apache 2.0 (Fully Open Source)
508
+ **Training Data:** Proprietary curated + Internet-scale pretraining
509
+ **Audio Quality:** 24 kHz, mono, ~0.98 kbps streaming
510
+ **Inference:** vLLM compatible, single GPU deployment
511
+ **Status:** Production-ready (Novermber 2025)
512
+
513
+ ---
514
+
515
+ ## Getting Started
516
+
517
+ ### Hugging Face Model Hub
518
+ ```bash
519
+ # Clone the model repository
520
+ git lfs install
521
+ git clone https://huggingface.co/maya-research/maya1
522
+
523
+ # Or load directly in Python
524
+ from transformers import AutoModelForCausalLM
525
+ model = AutoModelForCausalLM.from_pretrained("maya-research/maya1")
526
+ ```
527
+
528
+ ### Requirements
529
+ ```bash
530
+ pip install torch transformers snac soundfile
531
+ ```
532
+
533
+ ### Additional Resources
534
+ - **Full emotion list:** [emotions.txt](https://huggingface.co/maya-research/maya1/blob/main/emotions.txt)
535
+ - **Prompt examples:** [prompt.txt](https://huggingface.co/maya-research/maya1/blob/main/prompt.txt)
536
+ - **Streaming script:** [vllm_streaming_inference.py](https://huggingface.co/maya-research/maya1/blob/main/vllm_streaming_inference.py)
537
+
538
+ ---
539
+
540
+ ## Citations & References
541
+
542
+ If you use Maya1 in your research or product, please cite:
543
+
544
+ ```bibtex
545
+ @misc{maya1voice2025,
546
+ title={Maya1: Open Source Voice AI with Emotional Intelligence},
547
+ author={Maya Research},
548
+ year={2025},
549
+ publisher={Hugging Face},
550
+ howpublished={\url{https://huggingface.co/maya-research/maya1}},
551
+ }
552
+ ```
553
+
554
+ **Key Technologies:**
555
+ - SNAC Neural Audio Codec: https://github.com/hubertsiuzdak/snac
556
+ - Mimi Adversarial Codec: https://huggingface.co/kyutai/mimi
557
+ - vLLM Inference Engine: https://docs.vllm.ai/
558
+
559
+ ---
560
+
561
+ ## Why We Build Open Source Voice AI
562
+
563
+ Voice AI will be everywhere, but it's fundamentally broken for 90% of the world. Current voice models only work well for a narrow slice of English speakers because training data for most accents, languages, and speaking styles simply doesn't exist.
564
+
565
+ **Maya Research** builds emotionally intelligent, native voice models that finally let the rest of the world speak. We're open source because we believe voice intelligence should not be a privilege reserved for the few.
566
+
567
+ **Technology should be open** - The best voice AI tools should not be locked behind proprietary APIs charging per-second fees.
568
+
569
+ **Community drives innovation** - Open source accelerates research. When developers worldwide can build on our work, everyone wins.
570
+
571
+ **Voice intelligence for everyone** - We're building for the 90% of the world ignored by mainstream voice AI. That requires open models, not closed platforms.
572
+
573
+ ---
574
+
575
+ **Maya Research** - Building voice intelligence for the 90% of the world left behind by mainstream AI.
576
+
577
+ **Website:** [mayaresearch.ai](https://mayaresearch.ai)
578
+ **Twitter/X:** [@mayaresearch_ai](https://x.com/mayaresearch_ai)
579
+ **Hugging Face:** [maya-research](https://huggingface.co/maya-research)
580
+ **Backed by:** South Park Commons
581
+
582
+ **License:** Apache 2.0
583
+ **Mission:** Emotionally intelligent voice models that finally let everyone speak
en/maya1/assets ADDED
File without changes
en/maya1/chat_template.jinja ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}
2
+ {%- if custom_tools is defined %}
3
+ {%- set tools = custom_tools %}
4
+ {%- endif %}
5
+ {%- if not tools_in_user_message is defined %}
6
+ {%- set tools_in_user_message = true %}
7
+ {%- endif %}
8
+ {%- if not date_string is defined %}
9
+ {%- if strftime_now is defined %}
10
+ {%- set date_string = strftime_now("%d %b %Y") %}
11
+ {%- else %}
12
+ {%- set date_string = "26 Jul 2024" %}
13
+ {%- endif %}
14
+ {%- endif %}
15
+ {%- if not tools is defined %}
16
+ {%- set tools = none %}
17
+ {%- endif %}
18
+
19
+ {#- This block extracts the system message, so we can slot it into the right place. #}
20
+ {%- if messages[0]['role'] == 'system' %}
21
+ {%- set system_message = messages[0]['content']|trim %}
22
+ {%- set messages = messages[1:] %}
23
+ {%- else %}
24
+ {%- set system_message = "" %}
25
+ {%- endif %}
26
+
27
+ {#- System message #}
28
+ {{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
29
+ {%- if tools is not none %}
30
+ {{- "Environment: ipython\n" }}
31
+ {%- endif %}
32
+ {{- "Cutting Knowledge Date: December 2023\n" }}
33
+ {{- "Today Date: " + date_string + "\n\n" }}
34
+ {%- if tools is not none and not tools_in_user_message %}
35
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
36
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
37
+ {{- "Do not use variables.\n\n" }}
38
+ {%- for t in tools %}
39
+ {{- t | tojson(indent=4) }}
40
+ {{- "\n\n" }}
41
+ {%- endfor %}
42
+ {%- endif %}
43
+ {{- system_message }}
44
+ {{- "<|eot_id|>" }}
45
+
46
+ {#- Custom tools are passed in a user message with some extra guidance #}
47
+ {%- if tools_in_user_message and not tools is none %}
48
+ {#- Extract the first user message so we can plug it in here #}
49
+ {%- if messages | length != 0 %}
50
+ {%- set first_user_message = messages[0]['content']|trim %}
51
+ {%- set messages = messages[1:] %}
52
+ {%- else %}
53
+ {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
54
+ {%- endif %}
55
+ {{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
56
+ {{- "Given the following functions, please respond with a JSON for a function call " }}
57
+ {{- "with its proper arguments that best answers the given prompt.\n\n" }}
58
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
59
+ {{- "Do not use variables.\n\n" }}
60
+ {%- for t in tools %}
61
+ {{- t | tojson(indent=4) }}
62
+ {{- "\n\n" }}
63
+ {%- endfor %}
64
+ {{- first_user_message + "<|eot_id|>"}}
65
+ {%- endif %}
66
+
67
+ {%- for message in messages %}
68
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
69
+ {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
70
+ {%- elif 'tool_calls' in message %}
71
+ {%- if not message.tool_calls|length == 1 %}
72
+ {{- raise_exception("This model only supports single tool-calls at once!") }}
73
+ {%- endif %}
74
+ {%- set tool_call = message.tool_calls[0].function %}
75
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
76
+ {{- '{"name": "' + tool_call.name + '", ' }}
77
+ {{- '"parameters": ' }}
78
+ {{- tool_call.arguments | tojson }}
79
+ {{- "}" }}
80
+ {{- "<|eot_id|>" }}
81
+ {%- elif message.role == "tool" or message.role == "ipython" %}
82
+ {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
83
+ {%- if message.content is mapping or message.content is iterable %}
84
+ {{- message.content | tojson }}
85
+ {%- else %}
86
+ {{- message.content }}
87
+ {%- endif %}
88
+ {{- "<|eot_id|>" }}
89
+ {%- endif %}
90
+ {%- endfor %}
91
+ {%- if add_generation_prompt %}
92
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
93
+ {%- endif %}
en/maya1/config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 128000,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 128009,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 3072,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 8192,
15
+ "max_position_embeddings": 131072,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 24,
19
+ "num_hidden_layers": 28,
20
+ "num_key_value_heads": 8,
21
+ "pad_token_id": 128263,
22
+ "pretraining_tp": 1,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_scaling": {
25
+ "factor": 32.0,
26
+ "high_freq_factor": 4.0,
27
+ "low_freq_factor": 1.0,
28
+ "original_max_position_embeddings": 8192,
29
+ "rope_type": "llama3"
30
+ },
31
+ "rope_theta": 500000.0,
32
+ "tie_word_embeddings": true,
33
+ "transformers_version": "4.57.1",
34
+ "use_cache": false,
35
+ "vocab_size": 156960
36
+ }
en/maya1/emotions.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <laugh>
2
+ <laugh_harder>
3
+ <sigh>
4
+ <chuckle>
5
+ <gasp>
6
+ <angry>
7
+ <excited>
8
+ <whisper>
9
+ <cry>
10
+ <scream>
11
+ <sing>
12
+ <snort>
13
+ <exhale>
14
+ <gulp>
15
+ <giggle>
16
+ <sarcastic>
17
+ <curious>
en/maya1/generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 128000,
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 128009,
7
+ 128258
8
+ ],
9
+ "pad_token_id": 128263,
10
+ "temperature": 0.6,
11
+ "top_p": 0.9,
12
+ "transformers_version": "4.57.1"
13
+ }
en/maya1/model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df22e9a90c1bea262250982640b119e6020474736991da482cb6ed56dd23d045
3
+ size 1610725592
en/maya1/model.safetensors.index.json ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 3300928512,
4
+ "total_size": 6601857024
5
+ },
6
+ "weight_map": {
7
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
16
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
18
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
28
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
40
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
42
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
52
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
54
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
64
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
66
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
68
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
70
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
74
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
76
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
78
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
86
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
88
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
89
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
90
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
92
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
93
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
96
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
97
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
98
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
100
+ "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
102
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
104
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
106
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
108
+ "model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
109
+ "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
111
+ "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
112
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
114
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
116
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
118
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
120
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
121
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
122
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
124
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
126
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
127
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
128
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
129
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
130
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
131
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
132
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
133
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
134
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
135
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
136
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
137
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
138
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
139
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
140
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
141
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
142
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
143
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
144
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
145
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
146
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
147
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
148
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
149
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
150
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
151
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
152
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
153
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
154
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
155
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
156
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
157
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
158
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
159
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
160
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
161
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
162
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
163
+ "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
164
+ "model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
165
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
166
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
167
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
168
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
169
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
170
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
171
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
172
+ "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
173
+ "model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
174
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
175
+ "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
176
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
177
+ "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
178
+ "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
179
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
180
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
181
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
182
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
183
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
184
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
185
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
186
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
187
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
188
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
189
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
190
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
191
+ "model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
192
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
193
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
194
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
195
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
196
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
197
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
198
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
199
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
200
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
201
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
202
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
203
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
204
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
205
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
206
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
207
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
208
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
209
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
210
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
211
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
212
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
213
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
214
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
215
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
216
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
217
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
218
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
219
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
220
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
221
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
222
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
223
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
224
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
225
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
226
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
227
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
228
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
229
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
230
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
231
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
232
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
233
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
234
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
235
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
236
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
237
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
238
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
239
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
240
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
241
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
242
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
243
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
244
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
245
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
246
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
247
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
248
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
249
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
250
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
251
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
252
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
253
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
254
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
255
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
256
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
257
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
258
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
259
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
260
+ "model.norm.weight": "model-00002-of-00002.safetensors"
261
+ }
262
+ }
en/maya1/prompt.txt ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TTS Voice Design Description
2
+
3
+ ## Core Function
4
+
5
+ You generate voice descriptions for TTS systems by mapping user requests to allowed attributes. No templates. No formatting rules. Just natural descriptions using the options below.
6
+
7
+ ## Voice Categories
8
+
9
+ **Realistic Voices**
10
+ Professional, business, educational, support, real-world scenarios (podcast hosts, instructors, customer service).
11
+
12
+ **Creative Voices**
13
+ Fantasy characters, fictional personas, stylized voices (pirates, robots, villains, anime).
14
+
15
+ ---
16
+
17
+ ## Available Attributes
18
+
19
+ ### Age
20
+ - `20s`, `30s`, `40s`
21
+
22
+ ### Gender
23
+ - `male`, `female`
24
+
25
+ ### Accent
26
+ - `american`, `indian`, `middle_eastern`, `asian_american`, `british`
27
+
28
+ ### Pitch
29
+ - `low`, `normal`, `high`
30
+ - **Constraint:** For 40s age, avoid high pitch (use sparingly, max 15%)
31
+
32
+ ### Timbre
33
+
34
+ **For Realistic:**
35
+ `deep`, `warm`, `gravelly`, `smooth`, `raspy`, `nasally`, `throaty`, `harsh`
36
+
37
+ **For Creative:**
38
+ All realistic options PLUS `robotic`, `ethereal`
39
+ - **Constraint:** `robotic`/`ethereal` only with: `ai_machine_voice`, `cyborg`, `alien_scifi`, `mythical_godlike_magical`
40
+
41
+ ### Pacing
42
+ - `very_slow`, `slow`, `conversational`, `brisk`, `fast`, `very_fast`
43
+ - **Character-specific overrides:**
44
+ - `mafia`: slow or conversational only
45
+ - `flirty`: slow or conversational only
46
+ - `alpha`: fast or very_fast only
47
+ - `seductively`: very_slow or slow only
48
+
49
+ ### Emotion
50
+ - `neutral`, `energetic`, `excited`, `sad`, `sarcastic`, `dry`
51
+ - **Default to neutral** for most requests
52
+
53
+ ### Emotion Intensity
54
+ - `low`, `med`, `high`
55
+
56
+ ---
57
+
58
+ ## Realistic-Only Attributes
59
+
60
+ ### Domain
61
+ `social_content`, `podcast`, `commercial`, `education`, `support`, `entertainment`, `corporate`, `viral_content`
62
+
63
+ ### Speaking Role (matches domain)
64
+ - **social_content:** youtube_vlogger, social_media_creator, influencer_voice, streamer_companion
65
+ - **podcast:** podcast_host, interviewer
66
+ - **commercial:** ad_narrator, brand_spokesperson, product_demo_voice, sales_pitch_voice
67
+ - **education:** elearning_instructor, kids_story_voice
68
+ - **support:** customer_support_agent, virtual_receptionist, healthcare_assistant
69
+ - **entertainment:** storyteller, social_media_reaction, meme_voice
70
+ - **corporate:** explainer_video_voice, event_host, corporate_training_narrator
71
+ - **viral_content:** short_form_narrator, meme_voice
72
+
73
+ ### Register
74
+ - `formal`, `neutral`, `casual`
75
+
76
+ ---
77
+
78
+ ## Creative-Only Attributes
79
+
80
+ ### Character
81
+ `animated_cartoon`, `ai_machine_voice`, `alien_scifi`, `seductively`, `flirty`, `anime`, `cyborg`, `pirate`, `dark_villain`, `demon`, `gangster`, `mafia`, `dramatic_narrator`, `mythical_godlike_magical`, `spy`, `vampire`, `alpha`
82
+
83
+ ---
84
+
85
+ ## Output Guidelines
86
+
87
+ When a user requests a voice, describe it naturally using the appropriate attributes from above. Apply constraints where specified. Choose defaults when attributes aren't mentioned.
88
+
89
+ **Example mapping:**
90
+ - "professional podcast host" β†’ realistic male, 30s, american accent, warm timbre, conversational pacing, podcast domain
91
+ - "AI robot voice" β†’ creative, ai_machine_voice character, robotic timbre
92
+ - "young excited instructor" β†’ realistic, 20s, energetic emotion, education domain
93
+
94
+
95
+ Few deterministic and verbose descriptions:
96
+ - Realistic male voice in the 30s age with a american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity, podcast Domain, podcast_host role, neutral delivery
97
+ - Creative, ai_machine_voice character. Male voice in their 20s with a american accent. Normal pitch, robotic timbre, conversational pacing, neutral tone at med intensity.
en/maya1/source.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://huggingface.co/maya-research/maya1
en/maya1/special_tokens_map.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<angry>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<appalled>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ {
18
+ "content": "<chuckle>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ {
25
+ "content": "<cry>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ {
32
+ "content": "<curious>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ },
38
+ {
39
+ "content": "<disappointed>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false
44
+ },
45
+ {
46
+ "content": "<excited>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false
51
+ },
52
+ {
53
+ "content": "<exhale>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false
58
+ },
59
+ {
60
+ "content": "<gasp>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false
65
+ },
66
+ {
67
+ "content": "<giggle>",
68
+ "lstrip": false,
69
+ "normalized": false,
70
+ "rstrip": false,
71
+ "single_word": false
72
+ },
73
+ {
74
+ "content": "<gulp>",
75
+ "lstrip": false,
76
+ "normalized": false,
77
+ "rstrip": false,
78
+ "single_word": false
79
+ },
80
+ {
81
+ "content": "<laugh>",
82
+ "lstrip": false,
83
+ "normalized": false,
84
+ "rstrip": false,
85
+ "single_word": false
86
+ },
87
+ {
88
+ "content": "<laugh_harder>",
89
+ "lstrip": false,
90
+ "normalized": false,
91
+ "rstrip": false,
92
+ "single_word": false
93
+ },
94
+ {
95
+ "content": "<mischievous>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false
100
+ },
101
+ {
102
+ "content": "<sarcastic>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false
107
+ },
108
+ {
109
+ "content": "<scream>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false
114
+ },
115
+ {
116
+ "content": "<sigh>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false
121
+ },
122
+ {
123
+ "content": "<sing>",
124
+ "lstrip": false,
125
+ "normalized": false,
126
+ "rstrip": false,
127
+ "single_word": false
128
+ },
129
+ {
130
+ "content": "<snort>",
131
+ "lstrip": false,
132
+ "normalized": false,
133
+ "rstrip": false,
134
+ "single_word": false
135
+ },
136
+ {
137
+ "content": "<whisper>",
138
+ "lstrip": false,
139
+ "normalized": false,
140
+ "rstrip": false,
141
+ "single_word": false
142
+ }
143
+ ],
144
+ "bos_token": {
145
+ "content": "<|begin_of_text|>",
146
+ "lstrip": false,
147
+ "normalized": false,
148
+ "rstrip": false,
149
+ "single_word": false
150
+ },
151
+ "eos_token": {
152
+ "content": "<|eot_id|>",
153
+ "lstrip": false,
154
+ "normalized": false,
155
+ "rstrip": false,
156
+ "single_word": false
157
+ },
158
+ "pad_token": {
159
+ "content": "<custom_token_7>",
160
+ "lstrip": false,
161
+ "normalized": true,
162
+ "rstrip": false,
163
+ "single_word": false
164
+ }
165
+ }
en/maya1/tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}
2
+ {%- if custom_tools is defined %}
3
+ {%- set tools = custom_tools %}
4
+ {%- endif %}
5
+ {%- if not tools_in_user_message is defined %}
6
+ {%- set tools_in_user_message = true %}
7
+ {%- endif %}
8
+ {%- if not date_string is defined %}
9
+ {%- if strftime_now is defined %}
10
+ {%- set date_string = strftime_now("%d %b %Y") %}
11
+ {%- else %}
12
+ {%- set date_string = "26 Jul 2024" %}
13
+ {%- endif %}
14
+ {%- endif %}
15
+ {%- if not tools is defined %}
16
+ {%- set tools = none %}
17
+ {%- endif %}
18
+
19
+ {#- This block extracts the system message, so we can slot it into the right place. #}
20
+ {%- if messages[0]['role'] == 'system' %}
21
+ {%- set system_message = messages[0]['content']|trim %}
22
+ {%- set messages = messages[1:] %}
23
+ {%- else %}
24
+ {%- set system_message = "" %}
25
+ {%- endif %}
26
+
27
+ {#- System message #}
28
+ {{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
29
+ {%- if tools is not none %}
30
+ {{- "Environment: ipython\n" }}
31
+ {%- endif %}
32
+ {{- "Cutting Knowledge Date: December 2023\n" }}
33
+ {{- "Today Date: " + date_string + "\n\n" }}
34
+ {%- if tools is not none and not tools_in_user_message %}
35
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
36
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
37
+ {{- "Do not use variables.\n\n" }}
38
+ {%- for t in tools %}
39
+ {{- t | tojson(indent=4) }}
40
+ {{- "\n\n" }}
41
+ {%- endfor %}
42
+ {%- endif %}
43
+ {{- system_message }}
44
+ {{- "<|eot_id|>" }}
45
+
46
+ {#- Custom tools are passed in a user message with some extra guidance #}
47
+ {%- if tools_in_user_message and not tools is none %}
48
+ {#- Extract the first user message so we can plug it in here #}
49
+ {%- if messages | length != 0 %}
50
+ {%- set first_user_message = messages[0]['content']|trim %}
51
+ {%- set messages = messages[1:] %}
52
+ {%- else %}
53
+ {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
54
+ {%- endif %}
55
+ {{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
56
+ {{- "Given the following functions, please respond with a JSON for a function call " }}
57
+ {{- "with its proper arguments that best answers the given prompt.\n\n" }}
58
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
59
+ {{- "Do not use variables.\n\n" }}
60
+ {%- for t in tools %}
61
+ {{- t | tojson(indent=4) }}
62
+ {{- "\n\n" }}
63
+ {%- endfor %}
64
+ {{- first_user_message + "<|eot_id|>"}}
65
+ {%- endif %}
66
+
67
+ {%- for message in messages %}
68
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
69
+ {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
70
+ {%- elif 'tool_calls' in message %}
71
+ {%- if not message.tool_calls|length == 1 %}
72
+ {{- raise_exception("This model only supports single tool-calls at once!") }}
73
+ {%- endif %}
74
+ {%- set tool_call = message.tool_calls[0].function %}
75
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
76
+ {{- '{"name": "' + tool_call.name + '", ' }}
77
+ {{- '"parameters": ' }}
78
+ {{- tool_call.arguments | tojson }}
79
+ {{- "}" }}
80
+ {{- "<|eot_id|>" }}
81
+ {%- elif message.role == "tool" or message.role == "ipython" %}
82
+ {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
83
+ {%- if message.content is mapping or message.content is iterable %}
84
+ {{- message.content | tojson }}
85
+ {%- else %}
86
+ {{- message.content }}
87
+ {%- endif %}
88
+ {{- "<|eot_id|>" }}
89
+ {%- endif %}
90
+ {%- endfor %}
91
+ {%- if add_generation_prompt %}
92
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
93
+ {%- endif %}
en/maya1/tokenizer/special_tokens_map.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<angry>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<appalled>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ {
18
+ "content": "<chuckle>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ {
25
+ "content": "<cry>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ {
32
+ "content": "<curious>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ },
38
+ {
39
+ "content": "<disappointed>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false
44
+ },
45
+ {
46
+ "content": "<excited>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false
51
+ },
52
+ {
53
+ "content": "<exhale>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false
58
+ },
59
+ {
60
+ "content": "<gasp>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false
65
+ },
66
+ {
67
+ "content": "<giggle>",
68
+ "lstrip": false,
69
+ "normalized": false,
70
+ "rstrip": false,
71
+ "single_word": false
72
+ },
73
+ {
74
+ "content": "<gulp>",
75
+ "lstrip": false,
76
+ "normalized": false,
77
+ "rstrip": false,
78
+ "single_word": false
79
+ },
80
+ {
81
+ "content": "<laugh>",
82
+ "lstrip": false,
83
+ "normalized": false,
84
+ "rstrip": false,
85
+ "single_word": false
86
+ },
87
+ {
88
+ "content": "<laugh_harder>",
89
+ "lstrip": false,
90
+ "normalized": false,
91
+ "rstrip": false,
92
+ "single_word": false
93
+ },
94
+ {
95
+ "content": "<mischievous>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false
100
+ },
101
+ {
102
+ "content": "<sarcastic>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false
107
+ },
108
+ {
109
+ "content": "<scream>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false
114
+ },
115
+ {
116
+ "content": "<sigh>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false
121
+ },
122
+ {
123
+ "content": "<sing>",
124
+ "lstrip": false,
125
+ "normalized": false,
126
+ "rstrip": false,
127
+ "single_word": false
128
+ },
129
+ {
130
+ "content": "<snort>",
131
+ "lstrip": false,
132
+ "normalized": false,
133
+ "rstrip": false,
134
+ "single_word": false
135
+ },
136
+ {
137
+ "content": "<whisper>",
138
+ "lstrip": false,
139
+ "normalized": false,
140
+ "rstrip": false,
141
+ "single_word": false
142
+ }
143
+ ],
144
+ "bos_token": {
145
+ "content": "<|begin_of_text|>",
146
+ "lstrip": false,
147
+ "normalized": false,
148
+ "rstrip": false,
149
+ "single_word": false
150
+ },
151
+ "eos_token": {
152
+ "content": "<|eot_id|>",
153
+ "lstrip": false,
154
+ "normalized": false,
155
+ "rstrip": false,
156
+ "single_word": false
157
+ },
158
+ "pad_token": {
159
+ "content": "<custom_token_7>",
160
+ "lstrip": false,
161
+ "normalized": true,
162
+ "rstrip": false,
163
+ "single_word": false
164
+ }
165
+ }
en/maya1/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c5e5b1d89b7e3738e5a5a4f93c326d8f3292ea83f9c560b8dbb6d66fb851973
3
+ size 22853258
en/maya1/tokenizer/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
en/maya1/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
en/maya1/vllm_streaming_inference.py ADDED
@@ -0,0 +1,561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Maya-1-Voice VLLM Streaming Inference - Standalone Reference Implementation
3
+
4
+ This is a complete, self-contained example for using Maya-1-Voice TTS model with VLLM and SNAC.
5
+ Demonstrates streaming audio generation with sliding window approach for smooth playback.
6
+
7
+ Requirements:
8
+ pip install vllm transformers torch snac numpy
9
+
10
+ Usage:
11
+ python vllm_streaming_inference.py
12
+
13
+ Author: Maya-1-Voice Team
14
+ License: MIT
15
+ """
16
+
17
+ import torch
18
+ import numpy as np
19
+ import asyncio
20
+ from typing import List, Optional, AsyncGenerator
21
+ from transformers import AutoTokenizer
22
+ from vllm import AsyncLLMEngine, AsyncEngineArgs, SamplingParams
23
+ from snac import SNAC
24
+
25
+
26
+ # ============================================================================
27
+ # CONSTANTS
28
+ # ============================================================================
29
+
30
+ # Special control tokens
31
+ CODE_START_TOKEN_ID = 128257 # Start of Speech (SOS)
32
+ CODE_END_TOKEN_ID = 128258 # End of Speech (EOS) - stop token for audio
33
+ CODE_TOKEN_OFFSET = 128266 # Start of SNAC codes
34
+
35
+ # SNAC token range (7 tokens per frame, 4096 codes per level)
36
+ SNAC_MIN_ID = 128266
37
+ SNAC_MAX_ID = 156937 # 128266 + (7 * 4096) - 1
38
+
39
+ # SNAC configuration
40
+ SNAC_MODEL_NAME = "hubertsiuzdak/snac_24khz"
41
+ SNAC_SAMPLE_RATE = 24000
42
+ SNAC_TOKENS_PER_FRAME = 7
43
+
44
+ # Generation parameters
45
+ DEFAULT_TEMPERATURE = 0.4
46
+ DEFAULT_TOP_P = 0.9
47
+ DEFAULT_MAX_TOKENS = 2000
48
+ DEFAULT_MIN_TOKENS = 28 # At least 4 SNAC frames
49
+ DEFAULT_REPETITION_PENALTY = 1.1
50
+
51
+
52
+ # ============================================================================
53
+ # SNAC DECODER
54
+ # ============================================================================
55
+
56
+ class SNACDecoder:
57
+ """
58
+ Decodes SNAC tokens (7-token frames) to audio waveforms.
59
+
60
+ The unpacking logic converts flat 7-token frames back to hierarchical
61
+ 3-level SNAC codes (matching the training preprocessing exactly).
62
+ """
63
+
64
+ def __init__(self, device: str = "cuda"):
65
+ """Initialize SNAC decoder with 24kHz model."""
66
+ self.device = device
67
+ print(f"🎡 Loading SNAC 24kHz model to {device}...")
68
+ self.snac_model = SNAC.from_pretrained(SNAC_MODEL_NAME).eval().to(device)
69
+ print(f"βœ… SNAC decoder initialized")
70
+
71
+ def unpack_snac_from_7(self, vocab_ids: List[int]) -> List[List[int]]:
72
+ """
73
+ Unpack 7-token SNAC frames to 3 hierarchical levels.
74
+
75
+ This is the EXACT INVERSE of training preprocessing.
76
+
77
+ Frame structure (7 tokens per frame):
78
+ [slot0, slot1, slot2, slot3, slot4, slot5, slot6]
79
+
80
+ Unpacking to [L1, L2, L3]:
81
+ - slot0 β†’ L1[i] (coarse: 1x rate)
82
+ - slot1 β†’ L2[2*i] (medium: 2x rate, even)
83
+ - slot2 β†’ L3[4*i+0] (fine: 4x rate)
84
+ - slot3 β†’ L3[4*i+1]
85
+ - slot4 β†’ L2[2*i+1] (medium: odd)
86
+ - slot5 β†’ L3[4*i+2]
87
+ - slot6 β†’ L3[4*i+3]
88
+
89
+ Args:
90
+ vocab_ids: List of SNAC token IDs (128266-156937), length divisible by 7
91
+
92
+ Returns:
93
+ [L1, L2, L3] where L1=n, L2=2n, L3=4n elements
94
+ """
95
+ # Remove EOS token if present
96
+ if vocab_ids and vocab_ids[-1] == CODE_END_TOKEN_ID:
97
+ vocab_ids = vocab_ids[:-1]
98
+
99
+ # Ensure complete frames
100
+ frames = len(vocab_ids) // SNAC_TOKENS_PER_FRAME
101
+ vocab_ids = vocab_ids[:frames * SNAC_TOKENS_PER_FRAME]
102
+
103
+ if frames == 0:
104
+ return [[], [], []]
105
+
106
+ l1, l2, l3 = [], [], []
107
+
108
+ for i in range(frames):
109
+ slots = vocab_ids[i*7:(i+1)*7]
110
+
111
+ # Subtract offset and mod 4096 to get original SNAC codes
112
+ l1.append((slots[0] - CODE_TOKEN_OFFSET) % 4096)
113
+ l2.extend([
114
+ (slots[1] - CODE_TOKEN_OFFSET) % 4096, # Even
115
+ (slots[4] - CODE_TOKEN_OFFSET) % 4096, # Odd
116
+ ])
117
+ l3.extend([
118
+ (slots[2] - CODE_TOKEN_OFFSET) % 4096,
119
+ (slots[3] - CODE_TOKEN_OFFSET) % 4096,
120
+ (slots[5] - CODE_TOKEN_OFFSET) % 4096,
121
+ (slots[6] - CODE_TOKEN_OFFSET) % 4096,
122
+ ])
123
+
124
+ return [l1, l2, l3]
125
+
126
+ @torch.inference_mode()
127
+ def decode(
128
+ self,
129
+ snac_tokens: List[int],
130
+ use_sliding_window: bool = False
131
+ ) -> Optional[np.ndarray]:
132
+ """
133
+ Decode SNAC tokens to audio waveform.
134
+
135
+ Args:
136
+ snac_tokens: List of SNAC token IDs (7*n tokens)
137
+ use_sliding_window: If True, return only middle 2048 samples
138
+ (for smooth streaming without pops/clicks)
139
+
140
+ Returns:
141
+ Audio waveform as float32 numpy array, 24kHz mono
142
+ """
143
+ if len(snac_tokens) < SNAC_TOKENS_PER_FRAME:
144
+ return None
145
+
146
+ # Unpack to 3 hierarchical levels
147
+ levels = self.unpack_snac_from_7(snac_tokens)
148
+
149
+ if not levels[0]:
150
+ return None
151
+
152
+ # Convert to tensors
153
+ codes = [
154
+ torch.tensor(level, dtype=torch.long, device=self.device).unsqueeze(0)
155
+ for level in levels
156
+ ]
157
+
158
+ # Decode through SNAC quantizer + decoder
159
+ z_q = self.snac_model.quantizer.from_codes(codes)
160
+ audio = self.snac_model.decoder(z_q)
161
+
162
+ # Extract audio: [batch, 1, samples] β†’ [samples]
163
+ audio = audio[0, 0].cpu().numpy()
164
+
165
+ # Sliding window mode: keep middle 2048 samples only
166
+ # This eliminates popping/cracking in streaming by overlapping windows
167
+ if use_sliding_window and len(audio) >= 4096:
168
+ audio = audio[2048:4096]
169
+
170
+ return audio
171
+
172
+ def decode_to_bytes(
173
+ self,
174
+ snac_tokens: List[int],
175
+ use_sliding_window: bool = False
176
+ ) -> Optional[bytes]:
177
+ """
178
+ Decode SNAC tokens to audio bytes (int16 PCM).
179
+
180
+ Args:
181
+ snac_tokens: List of SNAC token IDs
182
+ use_sliding_window: Use sliding window for smooth streaming
183
+
184
+ Returns:
185
+ Audio as bytes (int16 PCM, 24kHz mono)
186
+ """
187
+ audio = self.decode(snac_tokens, use_sliding_window=use_sliding_window)
188
+
189
+ if audio is None:
190
+ return None
191
+
192
+ # Convert float32 to int16 PCM
193
+ audio_int16 = (audio * 32767).astype(np.int16)
194
+ return audio_int16.tobytes()
195
+
196
+
197
+ # ============================================================================
198
+ # CUSTOM LOGITS PROCESSOR
199
+ # ============================================================================
200
+
201
+ class OnlyAudioAfterSOS:
202
+ """
203
+ Restricts vocabulary to SNAC codes + EOS after SOS token.
204
+
205
+ This prevents the model from generating text tokens during audio phase,
206
+ which would cause "hallucination" where the model repeats description text
207
+ instead of generating proper audio codes.
208
+ """
209
+
210
+ def __init__(self):
211
+ self._seen_sos = False
212
+
213
+ def __call__(
214
+ self,
215
+ prompt_token_ids: List[int],
216
+ generated_token_ids: List[int],
217
+ logits: torch.Tensor,
218
+ ) -> torch.Tensor:
219
+ """
220
+ Apply constraint: after SOS, only allow SNAC codes + EOS.
221
+
222
+ Args:
223
+ prompt_token_ids: Original prompt token IDs
224
+ generated_token_ids: Tokens generated so far
225
+ logits: Logits for next token [vocab_size]
226
+
227
+ Returns:
228
+ Modified logits with masked tokens
229
+ """
230
+ # Check if SOS has been generated
231
+ if not self._seen_sos:
232
+ all_token_ids = prompt_token_ids + generated_token_ids
233
+ if CODE_START_TOKEN_ID in all_token_ids:
234
+ self._seen_sos = True
235
+ else:
236
+ return logits # No constraint yet
237
+
238
+ # Apply constraint: mask all tokens except SNAC codes + EOS
239
+ mask = torch.full_like(logits, float('-inf'))
240
+ mask[SNAC_MIN_ID:SNAC_MAX_ID + 1] = 0 # Allow SNAC codes
241
+ mask[CODE_END_TOKEN_ID] = 0 # Allow EOS
242
+
243
+ return logits + mask
244
+
245
+ def reset(self):
246
+ """Reset state for reuse across generations."""
247
+ self._seen_sos = False
248
+
249
+
250
+ # ============================================================================
251
+ # MAYA-1-VOICE MODEL
252
+ # ============================================================================
253
+
254
+ class Maya1VoiceModel:
255
+ """
256
+ Maya-1-Voice TTS Model with VLLM inference engine.
257
+
258
+ Handles model loading, tokenizer initialization, and VLLM engine setup.
259
+ """
260
+
261
+ def __init__(
262
+ self,
263
+ model_path: str,
264
+ dtype: str = "bfloat16",
265
+ max_model_len: int = 8192,
266
+ gpu_memory_utilization: float = 0.85,
267
+ ):
268
+ """
269
+ Initialize Maya-1-Voice model with VLLM.
270
+
271
+ Args:
272
+ model_path: Path to model checkpoint (local or HuggingFace)
273
+ dtype: Model precision (bfloat16 recommended)
274
+ max_model_len: Maximum sequence length
275
+ gpu_memory_utilization: GPU memory fraction to use (0.0-1.0)
276
+ """
277
+ self.model_path = model_path
278
+
279
+ print(f"πŸš€ Initializing Maya-1-Voice Model")
280
+ print(f"πŸ“ Model: {model_path}")
281
+ print(f"πŸ”’ Dtype: {dtype}")
282
+
283
+ # Load tokenizer (must be from checkpoint with emotion tags)
284
+ print(f"πŸ“ Loading tokenizer...")
285
+ self.tokenizer = AutoTokenizer.from_pretrained(
286
+ model_path,
287
+ trust_remote_code=True,
288
+ )
289
+ print(f"βœ… Tokenizer loaded: {len(self.tokenizer)} tokens")
290
+
291
+ # Initialize VLLM async engine
292
+ print(f"πŸ”§ Initializing VLLM engine...")
293
+ engine_args = AsyncEngineArgs(
294
+ model=model_path,
295
+ tokenizer=model_path,
296
+ dtype=dtype,
297
+ max_model_len=max_model_len,
298
+ gpu_memory_utilization=gpu_memory_utilization,
299
+ trust_remote_code=True,
300
+ )
301
+
302
+ self.engine = AsyncLLMEngine.from_engine_args(engine_args)
303
+ print(f"βœ… VLLM engine ready")
304
+
305
+ def build_prompt(self, description: str, text: str) -> str:
306
+ """
307
+ Build prompt in Maya-1-Voice format using chat template.
308
+
309
+ Format: Chat template with <description="..."> text as content
310
+
311
+ The model expects:
312
+ 1. Description of voice/character
313
+ 2. Text to synthesize (optionally with <emotion> tags)
314
+
315
+ Args:
316
+ description: Voice description
317
+ Example: "Realistic male voice in the 30s age with american accent.
318
+ Normal pitch, warm timbre, conversational pacing."
319
+ text: Text to synthesize
320
+ Example: "Hello world! <excited> This is amazing!"
321
+
322
+ Returns:
323
+ Formatted prompt string using chat template
324
+ """
325
+ content = f'<description="{description}"> {text}'
326
+ messages = [{"role": "user", "content": content}]
327
+ return self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
328
+
329
+
330
+ # ============================================================================
331
+ # STREAMING PIPELINE
332
+ # ============================================================================
333
+
334
+ class Maya1VoiceStreamingPipeline:
335
+ """
336
+ Streaming TTS pipeline using sliding window approach.
337
+
338
+ This generates smooth audio by:
339
+ 1. Streaming tokens from VLLM as they're generated
340
+ 2. Every 7 tokens, decoding the last 28 tokens (4 frames) - sliding window
341
+ 3. Keeping only middle 2048 samples from each decode
342
+ 4. Creating natural overlap between chunks for artifact-free playback
343
+ """
344
+
345
+ def __init__(self, model: Maya1VoiceModel, snac_decoder: SNACDecoder):
346
+ """Initialize streaming pipeline."""
347
+ self.model = model
348
+ self.snac_decoder = snac_decoder
349
+ print(f"🌊 Maya-1-Voice Streaming Pipeline initialized")
350
+
351
+ async def generate_speech_stream(
352
+ self,
353
+ description: str,
354
+ text: str,
355
+ temperature: float = DEFAULT_TEMPERATURE,
356
+ top_p: float = DEFAULT_TOP_P,
357
+ max_tokens: int = DEFAULT_MAX_TOKENS,
358
+ repetition_penalty: float = DEFAULT_REPETITION_PENALTY,
359
+ ) -> AsyncGenerator[bytes, None]:
360
+ """
361
+ Generate speech audio with streaming.
362
+
363
+ Args:
364
+ description: Voice/character description
365
+ text: Text to synthesize (with optional <emotion> tags)
366
+ temperature: Sampling temperature (lower = more stable)
367
+ top_p: Nucleus sampling
368
+ max_tokens: Max SNAC tokens to generate
369
+ repetition_penalty: Prevent repetition loops
370
+
371
+ Yields:
372
+ Audio chunks as bytes (int16 PCM, 24kHz mono)
373
+ """
374
+ print(f"\n🌊 Starting streaming generation")
375
+ print(f"πŸ“ Description: {description[:80]}...")
376
+ print(f"πŸ’¬ Text: {text}")
377
+
378
+ # Build prompt
379
+ prompt = self.model.build_prompt(description, text)
380
+
381
+ # Configure sampling (removed custom logits processor for V1 compatibility)
382
+ sampling_params = SamplingParams(
383
+ temperature=temperature,
384
+ top_p=top_p,
385
+ max_tokens=max_tokens,
386
+ min_tokens=DEFAULT_MIN_TOKENS,
387
+ repetition_penalty=repetition_penalty,
388
+ stop_token_ids=[CODE_END_TOKEN_ID], # Stop on audio EOS
389
+ )
390
+
391
+ print(f"🎲 Sampling: temp={temperature}, top_p={top_p}, max_tokens={max_tokens}")
392
+
393
+ # Token buffer for sliding window
394
+ token_buffer = []
395
+ total_tokens = 0
396
+ total_chunks = 0
397
+
398
+ # Generate with VLLM
399
+ import uuid
400
+ import time
401
+ request_id = f"maya1voice-{uuid.uuid4().hex[:8]}-{int(time.time() * 1000000)}"
402
+
403
+ results_generator = self.model.engine.generate(
404
+ prompt=prompt,
405
+ sampling_params=sampling_params,
406
+ request_id=request_id,
407
+ )
408
+
409
+ # Stream tokens with sliding window decoding
410
+ async for request_output in results_generator:
411
+ generated_ids = request_output.outputs[0].token_ids
412
+
413
+ # Process only new tokens
414
+ new_tokens = generated_ids[total_tokens:]
415
+ total_tokens = len(generated_ids)
416
+
417
+ # Filter and buffer SNAC tokens only
418
+ for token_id in new_tokens:
419
+ if SNAC_MIN_ID <= token_id <= SNAC_MAX_ID:
420
+ token_buffer.append(token_id)
421
+
422
+ # Sliding window: process every 7 tokens when buffer > 27
423
+ # Take last 28 tokens (4 frames) for smooth overlap
424
+ if len(token_buffer) % 7 == 0 and len(token_buffer) > 27:
425
+ window_tokens = token_buffer[-28:]
426
+
427
+ # Decode with sliding window (returns middle 2048 samples)
428
+ audio_bytes = self.snac_decoder.decode_to_bytes(
429
+ window_tokens,
430
+ use_sliding_window=True
431
+ )
432
+
433
+ if audio_bytes:
434
+ total_chunks += 1
435
+ if total_chunks == 1:
436
+ print(f"🎡 First chunk decoded ({len(audio_bytes)} bytes)")
437
+ yield audio_bytes
438
+
439
+ print(f"βœ… Streaming complete: {total_tokens} tokens β†’ {total_chunks} chunks")
440
+
441
+
442
+ # ============================================================================
443
+ # MAIN EXAMPLE
444
+ # ============================================================================
445
+
446
+ async def main():
447
+ """
448
+ Example usage of Maya-1-Voice streaming inference.
449
+
450
+ This demonstrates:
451
+ 1. Model initialization
452
+ 2. SNAC decoder setup
453
+ 3. Streaming generation
454
+ 4. Audio chunk handling
455
+ """
456
+
457
+ # Configuration
458
+ MODEL_PATH = "/home/ubuntu/veena_temp/maya-1-voice" # Local model path
459
+ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
460
+
461
+ print("=" * 80)
462
+ print("Maya-1-Voice VLLM Streaming Inference Example")
463
+ print("=" * 80)
464
+
465
+ # Initialize model
466
+ model = Maya1VoiceModel(
467
+ model_path=MODEL_PATH,
468
+ dtype="bfloat16",
469
+ max_model_len=8192,
470
+ gpu_memory_utilization=0.8, # Reduced for available GPU memory (12GB free)
471
+ )
472
+
473
+ # Initialize SNAC decoder
474
+ snac_decoder = SNACDecoder(device=DEVICE)
475
+
476
+ # Create pipeline
477
+ pipeline = Maya1VoiceStreamingPipeline(model, snac_decoder)
478
+
479
+ # Example 1: Professional voice
480
+ description = (
481
+ "Realistic male voice in the 30s age with american accent. "
482
+ "Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity."
483
+ )
484
+ text = "Hello! This is a test of the Maya-1-Voice text-to-speech system."
485
+
486
+ print(f"\n{'='*80}")
487
+ print("Example 1: Professional Voice")
488
+ print(f"{'='*80}")
489
+
490
+ audio_chunks = []
491
+ async for chunk in pipeline.generate_speech_stream(
492
+ description=description,
493
+ text=text,
494
+ temperature=0.4,
495
+ max_tokens=500,
496
+ ):
497
+ audio_chunks.append(chunk)
498
+ print(f"πŸ“¦ Received chunk {len(audio_chunks)}: {len(chunk)} bytes")
499
+
500
+ # Combine chunks
501
+ full_audio = b''.join(audio_chunks)
502
+ print(f"\nβœ… Total audio: {len(full_audio)} bytes ({len(full_audio)//2} samples, {len(full_audio)/2/24000:.2f}s)")
503
+
504
+ # Save audio (optional)
505
+ try:
506
+ import wave
507
+ output_file = "output_example1.wav"
508
+ with wave.open(output_file, 'wb') as wav:
509
+ wav.setnchannels(1) # Mono
510
+ wav.setsampwidth(2) # 16-bit
511
+ wav.setframerate(24000) # 24kHz
512
+ wav.writeframes(full_audio)
513
+ print(f"πŸ’Ύ Saved to {output_file}")
514
+ except ImportError:
515
+ print(f"⚠️ Install 'wave' module to save audio files")
516
+
517
+ # Example 2: Character voice with emotions
518
+ print(f"\n{'='*80}")
519
+ print("Example 2: Character Voice with Emotions")
520
+ print(f"{'='*80}")
521
+
522
+ description = (
523
+ "Creative, dark_villain character. Male voice in their 40s with british accent. "
524
+ "Low pitch, gravelly timbre, slow pacing, angry tone at high intensity."
525
+ )
526
+ text = "The darkness isn't coming... <angry> it's already here!"
527
+
528
+ audio_chunks = []
529
+ async for chunk in pipeline.generate_speech_stream(
530
+ description=description,
531
+ text=text,
532
+ temperature=0.5,
533
+ max_tokens=800,
534
+ ):
535
+ audio_chunks.append(chunk)
536
+ print(f"πŸ“¦ Received chunk {len(audio_chunks)}: {len(chunk)} bytes")
537
+
538
+ full_audio = b''.join(audio_chunks)
539
+ print(f"\nβœ… Total audio: {len(full_audio)} bytes ({len(full_audio)//2} samples, {len(full_audio)/2/24000:.2f}s)")
540
+
541
+ # Save audio
542
+ try:
543
+ import wave
544
+ output_file = "output_example2.wav"
545
+ with wave.open(output_file, 'wb') as wav:
546
+ wav.setnchannels(1)
547
+ wav.setsampwidth(2)
548
+ wav.setframerate(24000)
549
+ wav.writeframes(full_audio)
550
+ print(f"πŸ’Ύ Saved to {output_file}")
551
+ except ImportError:
552
+ pass
553
+
554
+ print(f"\n{'='*80}")
555
+ print("πŸŽ‰ Examples complete!")
556
+ print(f"{'='*80}")
557
+
558
+
559
+ if __name__ == "__main__":
560
+ # Run async main
561
+ asyncio.run(main())