mohantesting commited on
Commit
d507f3c
·
verified ·
1 Parent(s): 1a76e10

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. Dockerfile +87 -0
  2. README.md +1 -0
  3. __pycache__/server.cpython-310.pyc +0 -0
  4. attention_mask_research.md +186 -0
  5. compare_generation.py +129 -0
  6. hotkey.txt +1 -0
  7. models/Llama-3.2-1B-Instruct/.gitattributes +35 -0
  8. models/Llama-3.2-1B-Instruct/LICENSE.txt +111 -0
  9. models/Llama-3.2-1B-Instruct/README.md +481 -0
  10. models/Llama-3.2-1B-Instruct/USE_POLICY.md +52 -0
  11. models/Llama-3.2-1B-Instruct/config.json +39 -0
  12. models/Llama-3.2-1B-Instruct/generation_config.json +12 -0
  13. models/Llama-3.2-1B-Instruct/original/params.json +12 -0
  14. models/Llama-3.2-1B-Instruct/special_tokens_map.json +16 -0
  15. models/Llama-3.2-1B-Instruct/tokenizer_config.json +2062 -0
  16. models/Qwen2.5-1.5B/LICENSE +202 -0
  17. models/Qwen2.5-1.5B/README.md +69 -0
  18. models/Qwen2.5-1.5B/config.json +28 -0
  19. models/Qwen2.5-1.5B/generation_config.json +7 -0
  20. models/Qwen2.5-1.5B/merges.txt +0 -0
  21. models/Qwen2.5-1.5B/tokenizer.json +0 -0
  22. models/Qwen2.5-1.5B/tokenizer_config.json +207 -0
  23. models/Qwen2.5-1.5B/vocab.json +0 -0
  24. models/VibeVoice-1.5B/.gitattributes +37 -0
  25. models/VibeVoice-1.5B/README.md +90 -0
  26. models/VibeVoice-1.5B/config.json +115 -0
  27. models/VibeVoice-1.5B/preprocessor_config.json +13 -0
  28. models/VoxCPM-0.5B/.gitattributes +36 -0
  29. models/VoxCPM-0.5B/README.md +238 -0
  30. models/VoxCPM-0.5B/assets/modelbest_logo.png +0 -0
  31. models/VoxCPM-0.5B/assets/thuhcsi_logo.png +0 -0
  32. models/VoxCPM-0.5B/assets/voxcpm_logo.png +0 -0
  33. models/VoxCPM-0.5B/config.json +52 -0
  34. models/VoxCPM-0.5B/special_tokens_map.json +81 -0
  35. models/VoxCPM-0.5B/tokenizer_config.json +212 -0
  36. models/dsp/config.json +31 -0
  37. models/iic/SenseVoiceSmall/.msc +0 -0
  38. models/iic/SenseVoiceSmall/.mv +1 -0
  39. models/iic/SenseVoiceSmall/README.md +219 -0
  40. models/iic/SenseVoiceSmall/am.mvn +8 -0
  41. models/iic/SenseVoiceSmall/config.yaml +97 -0
  42. models/iic/SenseVoiceSmall/configuration.json +14 -0
  43. models/iic/SenseVoiceSmall/tokens.json +0 -0
  44. models/iic/speech_zipenhancer_ans_multiloss_16k_base/description/model.jpg +0 -0
  45. models/v10/config.json +36 -0
  46. models/v10/special_tokens_map.json +0 -0
  47. models/v10/tokenizer_config.json +0 -0
  48. requirements.txt +13 -0
  49. server.py +854 -0
  50. test_local.py +234 -0
Dockerfile ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04
2
+
3
+ # Set environment variables
4
+ ENV PYTHONUNBUFFERED=1 \
5
+ DEBIAN_FRONTEND=noninteractive \
6
+ CUDA_HOME=/usr/local/cuda \
7
+ PATH=/usr/local/cuda/bin:$PATH \
8
+ LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
9
+ NVIDIA_VISIBLE_DEVICES=all \
10
+ NVIDIA_DRIVER_CAPABILITIES=compute,utility \
11
+ HF_HOME=/app/models \
12
+ TRITON_CACHE_DIR=/tmp/triton_cache \
13
+ XDG_CACHE_HOME=/tmp \
14
+ NUMBA_CACHE_DIR=/tmp/numba_cache \
15
+ TOKENIZERS_PARALLELISM=false \
16
+ OMP_NUM_THREADS=4 \
17
+ MKL_NUM_THREADS=4 \
18
+ OPENBLAS_NUM_THREADS=4 \
19
+ NUMEXPR_NUM_THREADS=4 \
20
+ RAYON_NUM_THREADS=4 \
21
+ HF_HUB_OFFLINE=1 \
22
+ TRANSFORMERS_OFFLINE=1 \
23
+ TORCH_COMPILE_DISABLE=1 \
24
+ TRITON_DISABLE_LINE_INFO=1 \
25
+ CUDA_LAUNCH_BLOCKING=1
26
+
27
+ # Install system dependencies
28
+ RUN apt-get update && apt-get install -y --no-install-recommends \
29
+ python3 \
30
+ python3-pip \
31
+ python3-dev \
32
+ build-essential \
33
+ git \
34
+ git-lfs \
35
+ ffmpeg \
36
+ libsndfile1 \
37
+ curl \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
+ # Upgrade pip and install build tools
41
+ RUN python3 -m pip install --upgrade pip setuptools wheel uv
42
+
43
+ WORKDIR /app
44
+
45
+ # Create Numba cache directory
46
+ RUN mkdir -p /tmp/numba_cache /tmp/triton_cache && \
47
+ chown nobody:nogroup /tmp/numba_cache /tmp/triton_cache && \
48
+ chmod 700 /tmp/numba_cache /tmp/triton_cache
49
+
50
+ COPY requirements.txt .
51
+
52
+ # Install other requirements
53
+ RUN python3 -m uv pip install --no-cache-dir -r requirements.txt --prerelease=allow
54
+
55
+ COPY . .
56
+
57
+ # Check for LFS pointers and pull actual files if needed
58
+ RUN \
59
+ has_lfs_pointer=false; \
60
+ for file in $(find models -type f \( -name "*.pt" -o -name "*.bin" -o -name "*.safetensors" \) 2>/dev/null | head -10); do \
61
+ if [ -f "$file" ] && head -1 "$file" 2>/dev/null | grep -q "version https://git-lfs.github.com/spec/v1"; then \
62
+ has_lfs_pointer=true; \
63
+ break; \
64
+ fi; \
65
+ done; \
66
+ if [ "$has_lfs_pointer" = "true" ]; then \
67
+ echo "Detected LFS pointers, initializing git and pulling LFS files..."; \
68
+ git lfs install || true; \
69
+ if [ ! -d .git ]; then \
70
+ git init && \
71
+ git config user.email "docker@example.com" && \
72
+ git config user.name "Docker" && \
73
+ git remote add origin https://huggingface.co/momfun/pumpnotfun-01-47 2>/dev/null || true; \
74
+ fi; \
75
+ git add -A 2>/dev/null || true; \
76
+ git commit -m "Initial" 2>/dev/null || true; \
77
+ git fetch origin 2>/dev/null || true; \
78
+ git lfs fetch origin 2>/dev/null || true; \
79
+ git lfs checkout || true; \
80
+ echo "LFS files pulled successfully"; \
81
+ else \
82
+ echo "No LFS pointers detected, skipping git-lfs pull"; \
83
+ fi
84
+
85
+ EXPOSE 8000
86
+
87
+ CMD ["python3", "server.py"]
README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ sprint #5000
__pycache__/server.cpython-310.pyc ADDED
Binary file (23.4 kB). View file
 
attention_mask_research.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Attention Masks and Pad Tokens in Transformer Generation: Research Questions
2
+
3
+ ## Core Problem Statement
4
+
5
+ When running transformer models (specifically Llama-3.2-1B-Instruct) for text generation, we encounter warnings about missing attention masks and pad tokens, even for single input sequences. This leads to inconsistent generation outputs despite identical inputs.
6
+
7
+ ### Warning Messages Observed
8
+ ```
9
+ The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
10
+ Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.
11
+ The attention mask is not set and cannot be inferred from input because pad token is same as eos token.
12
+ ```
13
+
14
+ ## Key Research Questions
15
+
16
+ ### 1. Why do single inputs require attention masks?
17
+ **Initial Assumption**: Single sequences without padding shouldn't need attention masks.
18
+ **Observed Reality**: Even single inputs show different generation outputs when attention masks are missing.
19
+
20
+ ### 2. What is the relationship between pad tokens and attention masks?
21
+ **Question**: How do pad_token_id and attention_mask work together in the generation process?
22
+
23
+ ### 3. Why does pad_token_id = eos_token_id cause issues?
24
+ **Specific Issue**: When padding token equals end-of-sequence token, what ambiguity does this create?
25
+
26
+ ## Code Analysis
27
+
28
+ ### Current Implementation (Problematic)
29
+ ```python
30
+ def chat_current(system_prompt: str, user_prompt: str) -> str:
31
+ messages = [
32
+ {"role": "system", "content": system_prompt},
33
+ {"role": "user", "content": user_prompt},
34
+ ]
35
+
36
+ # Only returns input_ids tensor
37
+ input_ids = tok.apply_chat_template(
38
+ messages,
39
+ add_generation_prompt=True,
40
+ return_tensors="pt"
41
+ ).to(lm.device)
42
+
43
+ with torch.inference_mode():
44
+ output_ids = lm.generate(
45
+ input_ids, # Missing: attention_mask, pad_token_id
46
+ max_new_tokens=2048,
47
+ do_sample=True,
48
+ temperature=0.2,
49
+ repetition_penalty=1.1,
50
+ top_k=100,
51
+ top_p=0.95,
52
+ )
53
+
54
+ return tok.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=True)
55
+ ```
56
+
57
+ ### Fixed Implementation
58
+ ```python
59
+ def chat_fixed(system_prompt: str, user_prompt: str) -> str:
60
+ messages = [
61
+ {"role": "system", "content": system_prompt},
62
+ {"role": "user", "content": user_prompt},
63
+ ]
64
+
65
+ # Returns dictionary with input_ids AND attention_mask
66
+ inputs = tok.apply_chat_template(
67
+ messages,
68
+ add_generation_prompt=True,
69
+ return_tensors="pt",
70
+ return_dict=True # KEY CHANGE: Get both components
71
+ )
72
+
73
+ input_ids = inputs["input_ids"].to(lm.device)
74
+ attention_mask = inputs["attention_mask"].to(lm.device)
75
+
76
+ with torch.inference_mode():
77
+ output_ids = lm.generate(
78
+ input_ids=input_ids,
79
+ attention_mask=attention_mask, # Explicit attention guidance
80
+ pad_token_id=tok.eos_token_id, # Explicit pad token
81
+ max_new_tokens=2048,
82
+ do_sample=True,
83
+ temperature=0.2,
84
+ repetition_penalty=1.1,
85
+ top_k=100,
86
+ top_p=0.95,
87
+ )
88
+
89
+ return tok.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=True)
90
+ ```
91
+
92
+ ### Model and Tokenizer Setup
93
+ ```python
94
+ model_name = "models/Llama-3.2-1B-Instruct"
95
+ tok = AutoTokenizer.from_pretrained(model_name)
96
+ # Critical: Set pad token if not available
97
+ if tok.pad_token is None:
98
+ tok.pad_token = tok.eos_token
99
+
100
+ lm = AutoModelForCausalLM.from_pretrained(
101
+ model_name,
102
+ torch_dtype=torch.bfloat16,
103
+ device_map="cuda",
104
+ ).eval()
105
+ ```
106
+
107
+ ## Observed Behavioral Differences
108
+
109
+ ### Input Structure Analysis
110
+ ```python
111
+ # Single input contains multiple components:
112
+ messages = [
113
+ {"role": "system", "content": "You are a helpful assistant..."},
114
+ {"role": "user", "content": "What is the capital of France?"},
115
+ ]
116
+
117
+ # After apply_chat_template, becomes token sequence:
118
+ # [system_tokens, user_tokens, assistant_start_token]
119
+ ```
120
+
121
+ ## Technical Hypotheses for Investigation
122
+
123
+ ### Hypothesis 1: Internal Masking Ambiguity
124
+ When attention_mask is missing, the model cannot distinguish between:
125
+ - Real input tokens that should influence generation
126
+ - Structural tokens (system prompts, role markers)
127
+ - Token boundaries between different message roles
128
+
129
+ ### Hypothesis 2: EOS Token Dual Purpose Confusion
130
+ When `pad_token_id == eos_token_id`, the model faces ambiguity:
131
+ ```python
132
+ # Same token (128001) serves dual purposes:
133
+ # 1. End of sequence marker
134
+ # 2. Padding token for batch processing
135
+ # Model cannot infer which purpose applies in context
136
+ ```
137
+
138
+ ### Hypothesis 3: Autoregressive Generation Context Boundary Issues
139
+ During generation, model needs to know:
140
+ - Which input tokens provide valid context for next token prediction
141
+ - Where the "prompt" ends and "generation" begins
142
+ - How to weight attention across different input components
143
+
144
+ ## Research Objectives
145
+
146
+ ### Primary Questions
147
+ 1. **Mechanism Analysis**: How exactly does missing attention_mask affect the internal attention computation?
148
+ 2. **Consistency Impact**: Why do identical inputs produce different outputs without proper masking?
149
+ 3. **Single vs Batch Behavior**: What differences exist between single sequence and batched sequence processing?
150
+
151
+ ### Secondary Questions
152
+ 1. **Model-Specific Behavior**: Do different transformer architectures handle missing attention masks differently?
153
+ 2. **Generation Parameter Interaction**: How do attention mask issues interact with sampling parameters (temperature, top_p, etc.)?
154
+ 3. **Performance Impact**: What computational overhead does proper attention masking add?
155
+
156
+ ## Key Technical Areas for Deep Research
157
+
158
+ ### Attention Mechanism Internals
159
+ - How attention weights are computed with/without explicit masks
160
+ - Impact on multi-head attention distributions
161
+ - Interaction with causal masking in autoregressive models
162
+
163
+ ### Tokenizer Behavior
164
+ - How `apply_chat_template` constructs input sequences
165
+ - Default attention mask generation behavior
166
+ - Role of special tokens in attention computation
167
+
168
+ ### Generation Process
169
+ - How `model.generate()` handles missing parameters
170
+ - Internal assumptions and fallback behaviors
171
+ - Impact on sampling and beam search algorithms
172
+
173
+ ## Expected Research Outcomes
174
+
175
+ Understanding of:
176
+ 1. Exact mechanism causing output inconsistency
177
+ 2. Best practices for single sequence generation
178
+ 3. Relationship between attention masking and generation quality
179
+ 4. Guidelines for production transformer deployment
180
+
181
+ ## References for Deep Research
182
+
183
+ - Hugging Face Transformers documentation on attention masks
184
+ - Technical blogs on transformer attention mechanisms (2024)
185
+ - Community discussions on pad token vs attention mask differences
186
+ - Official model documentation for Llama architecture attention handling
compare_generation.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ import torch
4
+ from transformers import AutoModelForCausalLM, AutoTokenizer
5
+
6
+ # Load model and tokenizer (same as server.py)
7
+ model_name = "models/Llama-3.2-1B-Instruct"
8
+ tok = AutoTokenizer.from_pretrained(model_name)
9
+ lm = AutoModelForCausalLM.from_pretrained(
10
+ model_name,
11
+ torch_dtype=torch.bfloat16,
12
+ device_map="cuda",
13
+ ).eval()
14
+
15
+ def chat_current(system_prompt: str, user_prompt: str) -> str:
16
+ """
17
+ Current implementation (same as server.py) - will show warnings
18
+ """
19
+ print("🔴 Running CURRENT implementation (with warnings)...")
20
+
21
+ messages = [
22
+ {"role": "system", "content": system_prompt},
23
+ {"role": "user", "content": user_prompt},
24
+ ]
25
+
26
+ input_ids = tok.apply_chat_template(
27
+ messages,
28
+ add_generation_prompt=True,
29
+ return_tensors="pt"
30
+ ).to(lm.device)
31
+
32
+ with torch.inference_mode():
33
+ output_ids = lm.generate(
34
+ input_ids, # No attention_mask, no pad_token_id
35
+ max_new_tokens=2048,
36
+ do_sample=True,
37
+ temperature=0.2,
38
+ repetition_penalty=1.1,
39
+ top_k=100,
40
+ top_p=0.95,
41
+ )
42
+
43
+ answer = tok.decode(
44
+ output_ids[0][input_ids.shape[-1]:],
45
+ skip_special_tokens=True,
46
+ clean_up_tokenization_spaces=True,
47
+ )
48
+ return answer.strip()
49
+
50
+
51
+ def chat_fixed(system_prompt: str, user_prompt: str) -> str:
52
+ """
53
+ Fixed implementation - proper attention mask and pad token
54
+ """
55
+ print("🟢 Running FIXED implementation (no warnings)...")
56
+
57
+ messages = [
58
+ {"role": "system", "content": system_prompt},
59
+ {"role": "user", "content": user_prompt},
60
+ ]
61
+
62
+ # Get both input_ids and attention_mask
63
+ inputs = tok.apply_chat_template(
64
+ messages,
65
+ add_generation_prompt=True,
66
+ return_tensors="pt",
67
+ return_dict=True # Returns dict with input_ids and attention_mask
68
+ )
69
+
70
+ # Move to device
71
+ input_ids = inputs["input_ids"].to(lm.device)
72
+ attention_mask = inputs["attention_mask"].to(lm.device)
73
+
74
+ with torch.inference_mode():
75
+ output_ids = lm.generate(
76
+ input_ids=input_ids,
77
+ attention_mask=attention_mask, # Proper attention mask
78
+ pad_token_id=tok.eos_token_id, # Explicit pad token
79
+ max_new_tokens=2048,
80
+ do_sample=True,
81
+ temperature=0.2,
82
+ repetition_penalty=1.1,
83
+ top_k=100,
84
+ top_p=0.95,
85
+ )
86
+
87
+ answer = tok.decode(
88
+ output_ids[0][input_ids.shape[-1]:],
89
+ skip_special_tokens=True,
90
+ clean_up_tokenization_spaces=True,
91
+ )
92
+ return answer.strip()
93
+
94
+
95
+ def compare_generations():
96
+ """Compare both implementations"""
97
+ system_prompt = "You are a helpful assistant who tries to help answer the user's question."
98
+ user_prompt = "Create a report on anxiety in work. How do I manage time and stress effectively?"
99
+
100
+ print("=" * 60)
101
+ print("COMPARING GENERATION METHODS")
102
+ print("=" * 60)
103
+ print(f"System: {system_prompt}")
104
+ print(f"User: {user_prompt}")
105
+ print("=" * 60)
106
+
107
+ # Test current implementation
108
+ print("\n" + "=" * 60)
109
+ current_output = chat_current(system_prompt, user_prompt)
110
+ print(f"CURRENT OUTPUT:\n{current_output}")
111
+
112
+ print("\n" + "=" * 60)
113
+ # Test fixed implementation
114
+ fixed_output = chat_fixed(system_prompt, user_prompt)
115
+ print(f"FIXED OUTPUT:\n{fixed_output}")
116
+
117
+ print("\n" + "=" * 60)
118
+ print("COMPARISON:")
119
+ print(f"Outputs are identical: {current_output == fixed_output}")
120
+ print(f"Current length: {len(current_output)} chars")
121
+ print(f"Fixed length: {len(fixed_output)} chars")
122
+
123
+
124
+ if __name__ == "__main__":
125
+ # Set pad token for the fixed version
126
+ if tok.pad_token is None:
127
+ tok.pad_token = tok.eos_token
128
+
129
+ compare_generations()
hotkey.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 5ChyzJbeE11qE2UR8pq2AsyLM1w3qNnFf4HVaxvZK4Dhbxbd
models/Llama-3.2-1B-Instruct/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
models/Llama-3.2-1B-Instruct/LICENSE.txt ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LLAMA 3.2 COMMUNITY LICENSE AGREEMENT
2
+ Llama 3.2 Version Release Date: September 25, 2024
3
+
4
+ “Agreement” means the terms and conditions for use, reproduction, distribution
5
+ and modification of the Llama Materials set forth herein.
6
+
7
+ “Documentation” means the specifications, manuals and documentation accompanying Llama 3.2
8
+ distributed by Meta at https://llama.meta.com/doc/overview.
9
+
10
+ “Licensee” or “you” means you, or your employer or any other person or entity (if you are
11
+ entering into this Agreement on such person or entity’s behalf), of the age required under
12
+ applicable laws, rules or regulations to provide legal consent and that has legal authority
13
+ to bind your employer or such other person or entity if you are entering in this Agreement
14
+ on their behalf.
15
+
16
+ “Llama 3.2” means the foundational large language models and software and algorithms, including
17
+ machine-learning model code, trained model weights, inference-enabling code, training-enabling code,
18
+ fine-tuning enabling code and other elements of the foregoing distributed by Meta at
19
+ https://www.llama.com/llama-downloads.
20
+
21
+ “Llama Materials” means, collectively, Meta’s proprietary Llama 3.2 and Documentation (and
22
+ any portion thereof) made available under this Agreement.
23
+
24
+ “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or,
25
+ if you are an entity, your principal place of business is in the EEA or Switzerland)
26
+ and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
27
+
28
+
29
+ By clicking “I Accept” below or by using or distributing any portion or element of the Llama Materials,
30
+ you agree to be bound by this Agreement.
31
+
32
+
33
+ 1. License Rights and Redistribution.
34
+
35
+ a. Grant of Rights. You are granted a non-exclusive, worldwide,
36
+ non-transferable and royalty-free limited license under Meta’s intellectual property or other rights
37
+ owned by Meta embodied in the Llama Materials to use, reproduce, distribute, copy, create derivative works
38
+ of, and make modifications to the Llama Materials.
39
+
40
+ b. Redistribution and Use.
41
+
42
+ i. If you distribute or make available the Llama Materials (or any derivative works thereof),
43
+ or a product or service (including another AI model) that contains any of them, you shall (A) provide
44
+ a copy of this Agreement with any such Llama Materials; and (B) prominently display “Built with Llama”
45
+ on a related website, user interface, blogpost, about page, or product documentation. If you use the
46
+ Llama Materials or any outputs or results of the Llama Materials to create, train, fine tune, or
47
+ otherwise improve an AI model, which is distributed or made available, you shall also include “Llama”
48
+ at the beginning of any such AI model name.
49
+
50
+ ii. If you receive Llama Materials, or any derivative works thereof, from a Licensee as part
51
+ of an integrated end user product, then Section 2 of this Agreement will not apply to you.
52
+
53
+ iii. You must retain in all copies of the Llama Materials that you distribute the
54
+ following attribution notice within a “Notice” text file distributed as a part of such copies:
55
+ “Llama 3.2 is licensed under the Llama 3.2 Community License, Copyright © Meta Platforms,
56
+ Inc. All Rights Reserved.”
57
+
58
+ iv. Your use of the Llama Materials must comply with applicable laws and regulations
59
+ (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for
60
+ the Llama Materials (available at https://www.llama.com/llama3_2/use-policy), which is hereby
61
+ incorporated by reference into this Agreement.
62
+
63
+ 2. Additional Commercial Terms. If, on the Llama 3.2 version release date, the monthly active users
64
+ of the products or services made available by or for Licensee, or Licensee’s affiliates,
65
+ is greater than 700 million monthly active users in the preceding calendar month, you must request
66
+ a license from Meta, which Meta may grant to you in its sole discretion, and you are not authorized to
67
+ exercise any of the rights under this Agreement unless or until Meta otherwise expressly grants you such rights.
68
+
69
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND
70
+ RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS
71
+ ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES
72
+ OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE
73
+ FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED
74
+ WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
75
+
76
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY,
77
+ WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT,
78
+ FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN
79
+ IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
80
+
81
+ 5. Intellectual Property.
82
+
83
+ a. No trademark licenses are granted under this Agreement, and in connection with the Llama Materials,
84
+ neither Meta nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates,
85
+ except as required for reasonable and customary use in describing and redistributing the Llama Materials or as
86
+ set forth in this Section 5(a). Meta hereby grants you a license to use “Llama” (the “Mark”) solely as required
87
+ to comply with the last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines (currently accessible
88
+ at https://about.meta.com/brand/resources/meta/company-brand/). All goodwill arising out of your use of the Mark
89
+ will inure to the benefit of Meta.
90
+
91
+ b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with respect to any
92
+ derivative works and modifications of the Llama Materials that are made by you, as between you and Meta,
93
+ you are and will be the owner of such derivative works and modifications.
94
+
95
+ c. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or
96
+ counterclaim in a lawsuit) alleging that the Llama Materials or Llama 3.2 outputs or results, or any portion
97
+ of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable
98
+ by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or
99
+ claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third
100
+ party arising out of or related to your use or distribution of the Llama Materials.
101
+
102
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access
103
+ to the Llama Materials and will continue in full force and effect until terminated in accordance with the terms
104
+ and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this
105
+ Agreement. Upon termination of this Agreement, you shall delete and cease use of the Llama Materials. Sections 3,
106
+ 4 and 7 shall survive the termination of this Agreement.
107
+
108
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of
109
+ California without regard to choice of law principles, and the UN Convention on Contracts for the International
110
+ Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of
111
+ any dispute arising out of this Agreement.
models/Llama-3.2-1B-Instruct/README.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - de
5
+ - fr
6
+ - it
7
+ - pt
8
+ - hi
9
+ - es
10
+ - th
11
+ library_name: transformers
12
+ pipeline_tag: text-generation
13
+ tags:
14
+ - facebook
15
+ - meta
16
+ - pytorch
17
+ - llama
18
+ - llama-3
19
+ license: llama3.2
20
+ extra_gated_prompt: >-
21
+ ### LLAMA 3.2 COMMUNITY LICENSE AGREEMENT
22
+
23
+
24
+ Llama 3.2 Version Release Date: September 25, 2024
25
+
26
+
27
+ “Agreement” means the terms and conditions for use, reproduction, distribution
28
+ and modification of the Llama Materials set forth herein.
29
+
30
+
31
+ “Documentation” means the specifications, manuals and documentation accompanying Llama 3.2
32
+ distributed by Meta at https://llama.meta.com/doc/overview.
33
+
34
+
35
+ “Licensee” or “you” means you, or your employer or any other person or entity (if you are
36
+ entering into this Agreement on such person or entity’s behalf), of the age required under
37
+ applicable laws, rules or regulations to provide legal consent and that has legal authority
38
+ to bind your employer or such other person or entity if you are entering in this Agreement
39
+ on their behalf.
40
+
41
+
42
+ “Llama 3.2” means the foundational large language models and software and algorithms, including
43
+ machine-learning model code, trained model weights, inference-enabling code, training-enabling code,
44
+ fine-tuning enabling code and other elements of the foregoing distributed by Meta at
45
+ https://www.llama.com/llama-downloads.
46
+
47
+
48
+ “Llama Materials” means, collectively, Meta’s proprietary Llama 3.2 and Documentation (and
49
+ any portion thereof) made available under this Agreement.
50
+
51
+
52
+ “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or,
53
+ if you are an entity, your principal place of business is in the EEA or Switzerland)
54
+ and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
55
+
56
+
57
+ By clicking “I Accept” below or by using or distributing any portion or element of the Llama Materials,
58
+ you agree to be bound by this Agreement.
59
+
60
+
61
+ 1. License Rights and Redistribution.
62
+
63
+ a. Grant of Rights. You are granted a non-exclusive, worldwide,
64
+ non-transferable and royalty-free limited license under Meta’s intellectual property or other rights
65
+ owned by Meta embodied in the Llama Materials to use, reproduce, distribute, copy, create derivative works
66
+ of, and make modifications to the Llama Materials.
67
+
68
+ b. Redistribution and Use.
69
+
70
+ i. If you distribute or make available the Llama Materials (or any derivative works thereof),
71
+ or a product or service (including another AI model) that contains any of them, you shall (A) provide
72
+ a copy of this Agreement with any such Llama Materials; and (B) prominently display “Built with Llama”
73
+ on a related website, user interface, blogpost, about page, or product documentation. If you use the
74
+ Llama Materials or any outputs or results of the Llama Materials to create, train, fine tune, or
75
+ otherwise improve an AI model, which is distributed or made available, you shall also include “Llama”
76
+ at the beginning of any such AI model name.
77
+
78
+ ii. If you receive Llama Materials, or any derivative works thereof, from a Licensee as part
79
+ of an integrated end user product, then Section 2 of this Agreement will not apply to you.
80
+
81
+ iii. You must retain in all copies of the Llama Materials that you distribute the
82
+ following attribution notice within a “Notice” text file distributed as a part of such copies:
83
+ “Llama 3.2 is licensed under the Llama 3.2 Community License, Copyright © Meta Platforms,
84
+ Inc. All Rights Reserved.”
85
+
86
+ iv. Your use of the Llama Materials must comply with applicable laws and regulations
87
+ (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for
88
+ the Llama Materials (available at https://www.llama.com/llama3_2/use-policy), which is hereby
89
+ incorporated by reference into this Agreement.
90
+
91
+ 2. Additional Commercial Terms. If, on the Llama 3.2 version release date, the monthly active users
92
+ of the products or services made available by or for Licensee, or Licensee’s affiliates,
93
+ is greater than 700 million monthly active users in the preceding calendar month, you must request
94
+ a license from Meta, which Meta may grant to you in its sole discretion, and you are not authorized to
95
+ exercise any of the rights under this Agreement unless or until Meta otherwise expressly grants you such rights.
96
+
97
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND
98
+ RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS
99
+ ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES
100
+ OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE
101
+ FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED
102
+ WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
103
+
104
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY,
105
+ WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT,
106
+ FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN
107
+ IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
108
+
109
+ 5. Intellectual Property.
110
+
111
+ a. No trademark licenses are granted under this Agreement, and in connection with the Llama Materials,
112
+ neither Meta nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates,
113
+ except as required for reasonable and customary use in describing and redistributing the Llama Materials or as
114
+ set forth in this Section 5(a). Meta hereby grants you a license to use “Llama” (the “Mark”) solely as required
115
+ to comply with the last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines (currently accessible
116
+ at https://about.meta.com/brand/resources/meta/company-brand/). All goodwill arising out of your use of the Mark
117
+ will inure to the benefit of Meta.
118
+
119
+ b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with respect to any
120
+ derivative works and modifications of the Llama Materials that are made by you, as between you and Meta,
121
+ you are and will be the owner of such derivative works and modifications.
122
+
123
+ c. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or
124
+ counterclaim in a lawsuit) alleging that the Llama Materials or Llama 3.2 outputs or results, or any portion
125
+ of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable
126
+ by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or
127
+ claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third
128
+ party arising out of or related to your use or distribution of the Llama Materials.
129
+
130
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access
131
+ to the Llama Materials and will continue in full force and effect until terminated in accordance with the terms
132
+ and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this
133
+ Agreement. Upon termination of this Agreement, you shall delete and cease use of the Llama Materials. Sections 3,
134
+ 4 and 7 shall survive the termination of this Agreement.
135
+
136
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of
137
+ California without regard to choice of law principles, and the UN Convention on Contracts for the International
138
+ Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of
139
+ any dispute arising out of this Agreement.
140
+
141
+ ### Llama 3.2 Acceptable Use Policy
142
+
143
+ Meta is committed to promoting safe and fair use of its tools and features, including Llama 3.2.
144
+ If you access or use Llama 3.2, you agree to this Acceptable Use Policy (“**Policy**”).
145
+ The most recent copy of this policy can be found at
146
+ [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).
147
+
148
+ #### Prohibited Uses
149
+
150
+ We want everyone to use Llama 3.2 safely and responsibly. You agree you will not use, or allow others to use, Llama 3.2 to:
151
+
152
+ 1. Violate the law or others’ rights, including to:
153
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
154
+ 1. Violence or terrorism
155
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
156
+ 3. Human trafficking, exploitation, and sexual violence
157
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
158
+ 5. Sexual solicitation
159
+ 6. Any other criminal activity
160
+ 1. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
161
+ 2. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
162
+ 3. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
163
+ 4. Collect, process, disclose, generate, or infer private or sensitive information about individuals, including information about individuals’ identity, health, or demographic information, unless you have obtained the right to do so in accordance with applicable law
164
+ 5. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials
165
+ 6. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
166
+ 7. Engage in any action, or facilitate any action, to intentionally circumvent or remove usage restrictions or other safety measures, or to enable functionality disabled by Meta 
167
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 3.2 related to the following:
168
+ 8. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State or to the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons Convention Implementation Act of 1997
169
+ 9. Guns and illegal weapons (including weapon development)
170
+ 10. Illegal drugs and regulated/controlled substances
171
+ 11. Operation of critical infrastructure, transportation technologies, or heavy machinery
172
+ 12. Self-harm or harm to others, including suicide, cutting, and eating disorders
173
+ 13. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
174
+ 3. Intentionally deceive or mislead others, including use of Llama 3.2 related to the following:
175
+ 14. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
176
+ 15. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
177
+ 16. Generating, promoting, or further distributing spam
178
+ 17. Impersonating another individual without consent, authorization, or legal right
179
+ 18. Representing that the use of Llama 3.2 or outputs are human-generated
180
+ 19. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement 
181
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
182
+ 5. Interact with third party tools, models, or software designed to generate unlawful content or engage in unlawful or harmful conduct and/or represent that the outputs of such tools, models, or software are associated with Meta or Llama 3.2
183
+
184
+
185
+ With respect to any multimodal models included in Llama 3.2, the rights granted under Section 1(a) of the Llama 3.2 Community License Agreement are not being granted to you if you are an individual domiciled in, or a company with a principal place of business in, the European Union. This restriction does not apply to end users of a product or service that incorporates any such multimodal models.
186
+
187
+
188
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
189
+
190
+
191
+ * Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues&h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)
192
+
193
+ * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
194
+
195
+ * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
196
+
197
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama 3.2: LlamaUseReport@meta.com
198
+ extra_gated_fields:
199
+ First Name: text
200
+ Last Name: text
201
+ Date of birth: date_picker
202
+ Country: country
203
+ Affiliation: text
204
+ Job title:
205
+ type: select
206
+ options:
207
+ - Student
208
+ - Research Graduate
209
+ - AI researcher
210
+ - AI developer/engineer
211
+ - Reporter
212
+ - Other
213
+ geo: ip_location
214
+ By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox
215
+ extra_gated_description: >-
216
+ The information you provide will be collected, stored, processed and shared in
217
+ accordance with the [Meta Privacy
218
+ Policy](https://www.facebook.com/privacy/policy/).
219
+ extra_gated_button_content: Submit
220
+ ---
221
+
222
+ ## Model Information
223
+
224
+ The Llama 3.2 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction-tuned generative models in 1B and 3B sizes (text in/text out). The Llama 3.2 instruction-tuned text only models are optimized for multilingual dialogue use cases, including agentic retrieval and summarization tasks. They outperform many of the available open source and closed chat models on common industry benchmarks.
225
+
226
+ **Model Developer:** Meta
227
+
228
+ **Model Architecture:** Llama 3.2 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.
229
+
230
+ | | Training Data | Params | Input modalities | Output modalities | Context Length | GQA | Shared Embeddings | Token count | Knowledge cutoff |
231
+ | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- |
232
+ | Llama 3.2 (text only) | A new mix of publicly available online data. | 1B (1.23B) | Multilingual Text | Multilingual Text and code | 128k | Yes | Yes | Up to 9T tokens | December 2023 |
233
+ | | | 3B (3.21B) | Multilingual Text | Multilingual Text and code | | | | | |
234
+ | Llama 3.2 Quantized (text only) | A new mix of publicly available online data. | 1B (1.23B) | Multilingual Text | Multilingual Text and code | 8k | Yes | Yes | Up to 9T tokens | December 2023 |
235
+ | | | 3B (3.21B) | Multilingual Text | Multilingual Text and code | | | | | |
236
+
237
+ **Supported Languages:** English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai are officially supported. Llama 3.2 has been trained on a broader collection of languages than these 8 supported languages. Developers may fine-tune Llama 3.2 models for languages beyond these supported languages, provided they comply with the Llama 3.2 Community License and the Acceptable Use Policy. Developers are always expected to ensure that their deployments, including those that involve additional languages, are completed safely and responsibly.
238
+
239
+ **Llama 3.2 Model Family:** Token counts refer to pretraining data only. All model versions use Grouped-Query Attention (GQA) for improved inference scalability.
240
+
241
+ **Model Release Date:** Sept 25, 2024
242
+
243
+ **Status:** This is a static model trained on an offline dataset. Future versions may be released that improve model capabilities and safety.
244
+
245
+ **License:** Use of Llama 3.2 is governed by the [Llama 3.2 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_2/LICENSE) (a custom, commercial license agreement).
246
+
247
+ **Feedback:** Instructions on how to provide feedback or comments on the model can be found in the Llama Models [README](https://github.com/meta-llama/llama-models/blob/main/README.md). For more technical information about generation parameters and recipes for how to use Llama 3.2 in applications, please go [here](https://github.com/meta-llama/llama-recipes).
248
+
249
+ ## Intended Use
250
+
251
+ **Intended Use Cases:** Llama 3.2 is intended for commercial and research use in multiple languages. Instruction tuned text only models are intended for assistant-like chat and agentic applications like knowledge retrieval and summarization, mobile AI powered writing assistants and query and prompt rewriting. Pretrained models can be adapted for a variety of additional natural language generation tasks. Similarly, quantized models can be adapted for a variety of on-device use-cases with limited compute resources.
252
+
253
+ **Out of Scope:** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3.2 Community License. Use in languages beyond those explicitly referenced as supported in this model card.
254
+
255
+ ## How to use
256
+
257
+ This repository contains two versions of Llama-3.2-1B-Instruct, for use with transformers and with the original `llama` codebase.
258
+
259
+ ### Use with transformers
260
+
261
+ Starting with `transformers >= 4.43.0` onward, you can run conversational inference using the Transformers `pipeline` abstraction or by leveraging the Auto classes with the `generate()` function.
262
+
263
+ Make sure to update your transformers installation via `pip install --upgrade transformers`.
264
+
265
+ ```python
266
+ import torch
267
+ from transformers import pipeline
268
+
269
+ model_id = "meta-llama/Llama-3.2-1B-Instruct"
270
+ pipe = pipeline(
271
+ "text-generation",
272
+ model=model_id,
273
+ torch_dtype=torch.bfloat16,
274
+ device_map="auto",
275
+ )
276
+ messages = [
277
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
278
+ {"role": "user", "content": "Who are you?"},
279
+ ]
280
+ outputs = pipe(
281
+ messages,
282
+ max_new_tokens=256,
283
+ )
284
+ print(outputs[0]["generated_text"][-1])
285
+ ```
286
+
287
+ Note: You can also find detailed recipes on how to use the model locally, with `torch.compile()`, assisted generations, quantised and more at [`huggingface-llama-recipes`](https://github.com/huggingface/huggingface-llama-recipes)
288
+
289
+ ### Use with `llama`
290
+
291
+ Please, follow the instructions in the [repository](https://github.com/meta-llama/llama)
292
+
293
+ To download Original checkpoints, see the example command below leveraging `huggingface-cli`:
294
+
295
+ ```
296
+ huggingface-cli download meta-llama/Llama-3.2-1B-Instruct --include "original/*" --local-dir Llama-3.2-1B-Instruct
297
+ ```
298
+
299
+ ## Hardware and Software
300
+
301
+ **Training Factors:** We used custom training libraries, Meta's custom built GPU cluster, and production infrastructure for pretraining. Fine-tuning, quantization, annotation, and evaluation were also performed on production infrastructure.
302
+
303
+ **Training Energy Use:** Training utilized a cumulative of **916k** GPU hours of computation on H100-80GB (TDP of 700W) type hardware, per the table below. Training time is the total GPU time required for training each model and power consumption is the peak power capacity per GPU device used, adjusted for power usage efficiency.
304
+
305
+ **Training Greenhouse Gas Emissions:** Estimated total location-based greenhouse gas emissions were **240** tons CO2eq for training. Since 2020, Meta has maintained net zero greenhouse gas emissions in its global operations and matched 100% of its electricity use with renewable energy; therefore, the total market-based greenhouse gas emissions for training were 0 tons CO2eq.
306
+
307
+ | | Training Time (GPU hours) | Logit Generation Time (GPU Hours) | Training Power Consumption (W) | Training Location-Based Greenhouse Gas Emissions (tons CO2eq) | Training Market-Based Greenhouse Gas Emissions (tons CO2eq) |
308
+ | :---- | :---: | ----- | :---: | :---: | :---: |
309
+ | Llama 3.2 1B | 370k | \- | 700 | 107 | 0 |
310
+ | Llama 3.2 3B | 460k | \- | 700 | 133 | 0 |
311
+ | Llama 3.2 1B SpinQuant | 1.7 | 0 | 700 | *Negligible*\*\* | 0 |
312
+ | Llama 3.2 3B SpinQuant | 2.4 | 0 | 700 | *Negligible*\*\* | 0 |
313
+ | Llama 3.2 1B QLora | 1.3k | 0 | 700 | 0.381 | 0 |
314
+ | Llama 3.2 3B QLora | 1.6k | 0 | 700 | 0.461 | 0 |
315
+ | Total | 833k | 86k | | 240 | 0 |
316
+
317
+ \*\* The location-based CO2e emissions of Llama 3.2 1B SpinQuant and Llama 3.2 3B SpinQuant are less than 0.001 metric tonnes each. This is due to the minimal training GPU hours that are required.
318
+
319
+ The methodology used to determine training energy use and greenhouse gas emissions can be found [here](https://arxiv.org/pdf/2204.05149). Since Meta is openly releasing these models, the training energy use and greenhouse gas emissions will not be incurred by others.
320
+
321
+ ## Training Data
322
+
323
+ **Overview:** Llama 3.2 was pretrained on up to 9 trillion tokens of data from publicly available sources. For the 1B and 3B Llama 3.2 models, we incorporated logits from the Llama 3.1 8B and 70B models into the pretraining stage of the model development, where outputs (logits) from these larger models were used as token-level targets. Knowledge distillation was used after pruning to recover performance. In post-training we used a similar recipe as Llama 3.1 and produced final chat models by doing several rounds of alignment on top of the pre-trained model. Each round involved Supervised Fine-Tuning (SFT), Rejection Sampling (RS), and Direct Preference Optimization (DPO).
324
+
325
+ **Data Freshness:** The pretraining data has a cutoff of December 2023\.
326
+
327
+ ## Quantization
328
+
329
+ ### Quantization Scheme
330
+
331
+ We designed the current quantization scheme with the [PyTorch’s ExecuTorch](https://github.com/pytorch/executorch) inference framework and Arm CPU backend in mind, taking into account metrics including model quality, prefill/decoding speed, and memory footprint. Our quantization scheme involves three parts:
332
+ - All linear layers in all transformer blocks are quantized to a 4-bit groupwise scheme (with a group size of 32) for weights and 8-bit per-token dynamic quantization for activations.
333
+ - The classification layer is quantized to 8-bit per-channel for weight and 8-bit per token dynamic quantization for activation.
334
+ - Similar to classification layer, an 8-bit per channel quantization is used for embedding layer.
335
+
336
+
337
+ ### Quantization-Aware Training and LoRA
338
+
339
+ The quantization-aware training (QAT) with low-rank adaptation (LoRA) models went through only post-training stages, using the same data as the full precision models. To initialize QAT, we utilize BF16 Llama 3.2 model checkpoints obtained after supervised fine-tuning (SFT) and perform an additional full round of SFT training with QAT. We then freeze the backbone of the QAT model and perform another round of SFT with LoRA adaptors applied to all layers within the transformer block. Meanwhile, the LoRA adaptors' weights and activations are maintained in BF16. Because our approach is similar to QLoRA of Dettmers et al., (2023) (i.e., quantization followed by LoRA adapters), we refer this method as QLoRA. Finally, we fine-tune the resulting model (both backbone and LoRA adaptors) using direct preference optimization (DPO).
340
+
341
+ ### SpinQuant
342
+
343
+ [SpinQuant](https://arxiv.org/abs/2405.16406) was applied, together with generative post-training quantization (GPTQ). For the SpinQuant rotation matrix fine-tuning, we optimized for 100 iterations, using 800 samples with sequence-length 2048 from the WikiText 2 dataset. For GPTQ, we used 128 samples from the same dataset with the same sequence-length.
344
+
345
+ ## Benchmarks \- English Text
346
+
347
+ In this section, we report the results for Llama 3.2 models on standard automatic benchmarks. For all these evaluations, we used our internal evaluations library.
348
+
349
+ ### Base Pretrained Models
350
+
351
+ | Category | Benchmark | \# Shots | Metric | Llama 3.2 1B | Llama 3.2 3B | Llama 3.1 8B |
352
+ | ----- | ----- | :---: | :---: | :---: | :---: | :---: |
353
+ | General | MMLU | 5 | macro\_avg/acc\_char | 32.2 | 58 | 66.7 |
354
+ | | AGIEval English | 3-5 | average/acc\_char | 23.3 | 39.2 | 47.8 |
355
+ | | ARC-Challenge | 25 | acc\_char | 32.8 | 69.1 | 79.7 |
356
+ | Reading comprehension | SQuAD | 1 | em | 49.2 | 67.7 | 77 |
357
+ | | QuAC (F1) | 1 | f1 | 37.9 | 42.9 | 44.9 |
358
+ | | DROP (F1) | 3 | f1 | 28.0 | 45.2 | 59.5 |
359
+ | Long Context | Needle in Haystack | 0 | em | 96.8 | 1 | 1 |
360
+
361
+ ### Instruction Tuned Models
362
+
363
+ | Capability | | Benchmark | \# Shots | Metric | Llama 3.2 1B bf16 | Llama 3.2 1B Vanilla PTQ\*\* | Llama 3.2 1B Spin Quant | Llama 3.2 1B QLoRA | Llama 3.2 3B bf16 | Llama 3.2 3B Vanilla PTQ\*\* | Llama 3.2 3B Spin Quant | Llama 3.2 3B QLoRA | Llama 3.1 8B |
364
+ | :---: | ----- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
365
+ | General | | MMLU | 5 | macro\_avg/acc | 49.3 | 43.3 | 47.3 | 49.0 | 63.4 | 60.5 | 62 | 62.4 | 69.4 |
366
+ | Re-writing | | Open-rewrite eval | 0 | micro\_avg/rougeL | 41.6 | 39.2 | 40.9 | 41.2 | 40.1 | 40.3 | 40.8 | 40.7 | 40.9 |
367
+ | Summarization | | TLDR9+ (test) | 1 | rougeL | 16.8 | 14.9 | 16.7 | 16.8 | 19.0 | 19.1 | 19.2 | 19.1 | 17.2 |
368
+ | Instruction following | | IFEval | 0 | Avg(Prompt/Instruction acc Loose/Strict) | 59.5 | 51.5 | 58.4 | 55.6 | 77.4 | 73.9 | 73.5 | 75.9 | 80.4 |
369
+ | Math | | GSM8K (CoT) | 8 | em\_maj1@1 | 44.4 | 33.1 | 40.6 | 46.5 | 77.7 | 72.9 | 75.7 | 77.9 | 84.5 |
370
+ | | | MATH (CoT) | 0 | final\_em | 30.6 | 20.5 | 25.3 | 31.0 | 48.0 | 44.2 | 45.3 | 49.2 | 51.9 |
371
+ | Reasoning | | ARC-C | 0 | acc | 59.4 | 54.3 | 57 | 60.7 | 78.6 | 75.6 | 77.6 | 77.6 | 83.4 |
372
+ | | | GPQA | 0 | acc | 27.2 | 25.9 | 26.3 | 25.9 | 32.8 | 32.8 | 31.7 | 33.9 | 32.8 |
373
+ | | | Hellaswag | 0 | acc | 41.2 | 38.1 | 41.3 | 41.5 | 69.8 | 66.3 | 68 | 66.3 | 78.7 |
374
+ | Tool Use | | BFCL V2 | 0 | acc | 25.7 | 14.3 | 15.9 | 23.7 | 67.0 | 53.4 | 60.1 | 63.5 | 67.1 |
375
+ | | | Nexus | 0 | macro\_avg/acc | 13.5 | 5.2 | 9.6 | 12.5 | 34.3 | 32.4 | 31.5 | 30.1 | 38.5 |
376
+ | Long Context | | InfiniteBench/En.QA | 0 | longbook\_qa/f1 | 20.3 | N/A | N/A | N/A | 19.8 | N/A | N/A | N/A | 27.3 |
377
+ | | | InfiniteBench/En.MC | 0 | longbook\_choice/acc | 38.0 | N/A | N/A | N/A | 63.3 | N/A | N/A | N/A | 72.2 |
378
+ | | | NIH/Multi-needle | 0 | recall | 75.0 | N/A | N/A | N/A | 84.7 | N/A | N/A | N/A | 98.8 |
379
+ | Multilingual | | MGSM (CoT) | 0 | em | 24.5 | 13.7 | 18.2 | 24.4 | 58.2 | 48.9 | 54.3 | 56.8 | 68.9 |
380
+
381
+ \*\*for comparison purposes only. Model not released.
382
+
383
+ ### Multilingual Benchmarks
384
+
385
+ | Category | Benchmark | Language | Llama 3.2 1B | Llama 3.2 1B Vanilla PTQ\*\* | Llama 3.2 1B Spin Quant | Llama 3.2 1B QLoRA | Llama 3.2 3B | Llama 3.2 3B Vanilla PTQ\*\* | Llama 3.2 3B Spin Quant | Llama 3.2 3B QLoRA | Llama 3.1 8B |
386
+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
387
+ | General | MMLU (5-shot, macro_avg/acc) | Portuguese | 39.8 | 34.9 | 38.9 | 40.2 | 54.5 | 50.9 | 53.3 | 53.4 | 62.1 |
388
+ | | | Spanish | 41.5 | 36.0 | 39.8 | 41.8 | 55.1 | 51.9 | 53.6 | 53.6 | 62.5 |
389
+ | | | Italian | 39.8 | 34.9 | 38.1 | 40.6 | 53.8 | 49.9 | 52.1 | 51.7 | 61.6 |
390
+ | | | German | 39.2 | 34.9 | 37.5 | 39.6 | 53.3 | 50.0 | 52.2 | 51.3 | 60.6 |
391
+ | | | French | 40.5 | 34.8 | 39.2 | 40.8 | 54.6 | 51.2 | 53.3 | 53.3 | 62.3 |
392
+ | | | Hindi | 33.5 | 30.0 | 32.1 | 34.0 | 43.3 | 40.4 | 42.0 | 42.1 | 50.9 |
393
+ | | | Thai | 34.7 | 31.2 | 32.4 | 34.9 | 44.5 | 41.3 | 44.0 | 42.2 | 50.3 |
394
+
395
+ \*\*for comparison purposes only. Model not released.
396
+
397
+ ## Inference time
398
+
399
+ In the below table, we compare the performance metrics of different quantization methods (SpinQuant and QAT \+ LoRA) with the BF16 baseline. The evaluation was done using the [ExecuTorch](https://github.com/pytorch/executorch) framework as the inference engine, with the ARM CPU as a backend using Android OnePlus 12 device.
400
+
401
+ | Category | Decode (tokens/sec) | Time-to-first-token (sec) | Prefill (tokens/sec) | Model size (PTE file size in MB) | Memory size (RSS in MB) |
402
+ | :---- | ----- | ----- | ----- | ----- | ----- |
403
+ | 1B BF16 (baseline) | 19.2 | 1.0 | 60.3 | 2358 | 3,185 |
404
+ | 1B SpinQuant | 50.2 (2.6x) | 0.3 (-76.9%) | 260.5 (4.3x) | 1083 (-54.1%) | 1,921 (-39.7%) |
405
+ | 1B QLoRA | 45.8 (2.4x) | 0.3 (-76.0%) | 252.0 (4.2x) | 1127 (-52.2%) | 2,255 (-29.2%) |
406
+ | 3B BF16 (baseline) | 7.6 | 3.0 | 21.2 | 6129 | 7,419 |
407
+ | 3B SpinQuant | 19.7 (2.6x) | 0.7 (-76.4%) | 89.7 (4.2x) | 2435 (-60.3%) | 3,726 (-49.8%) |
408
+ | 3B QLoRA | 18.5 (2.4x) | 0.7 (-76.1%) | 88.8 (4.2x) | 2529 (-58.7%) | 4,060 (-45.3%) |
409
+
410
+ (\*) The performance measurement is done using an adb binary-based approach.
411
+ (\*\*) It is measured on an Android OnePlus 12 device.
412
+ (\*\*\*) Time-to-first-token (TTFT) is measured with prompt length=64
413
+
414
+ *Footnote:*
415
+
416
+ - *Decode (tokens/second) is for how quickly it keeps generating. Higher is better.*
417
+ - *Time-to-first-token (TTFT for shorthand) is for how fast it generates the first token for a given prompt. Lower is better.*
418
+ - *Prefill is the inverse of TTFT (aka 1/TTFT) in tokens/second. Higher is better*
419
+ - *Model size \- how big is the model, measured by, PTE file, a binary file format for ExecuTorch*
420
+ - *RSS size \- Memory usage in resident set size (RSS)*
421
+
422
+ ## Responsibility & Safety
423
+
424
+ As part of our Responsible release approach, we followed a three-pronged strategy to managing trust & safety risks:
425
+
426
+ 1. Enable developers to deploy helpful, safe and flexible experiences for their target audience and for the use cases supported by Llama
427
+ 2. Protect developers against adversarial users aiming to exploit Llama capabilities to potentially cause harm
428
+ 3. Provide protections for the community to help prevent the misuse of our models
429
+
430
+ ### Responsible Deployment
431
+
432
+ **Approach:** Llama is a foundational technology designed to be used in a variety of use cases. Examples on how Meta’s Llama models have been responsibly deployed can be found in our [Community Stories webpage](https://llama.meta.com/community-stories/). Our approach is to build the most helpful models, enabling the world to benefit from the technology power, by aligning our model safety for generic use cases and addressing a standard set of harms. Developers are then in the driver’s seat to tailor safety for their use cases, defining their own policies and deploying the models with the necessary safeguards in their Llama systems. Llama 3.2 was developed following the best practices outlined in our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide/).
433
+
434
+ #### Llama 3.2 Instruct
435
+
436
+ **Objective:** Our main objectives for conducting safety fine-tuning are to provide the research community with a valuable resource for studying the robustness of safety fine-tuning, as well as to offer developers a readily available, safe, and powerful model for various applications to reduce the developer workload to deploy safe AI systems. We implemented the same set of safety mitigations as in Llama 3, and you can learn more about these in the Llama 3 [paper](https://ai.meta.com/research/publications/the-llama-3-herd-of-models/).
437
+
438
+ **Fine-Tuning Data:** We employ a multi-faceted approach to data collection, combining human-generated data from our vendors with synthetic data to mitigate potential safety risks. We’ve developed many large language model (LLM)-based classifiers that enable us to thoughtfully select high-quality prompts and responses, enhancing data quality control.
439
+
440
+ **Refusals and Tone:** Building on the work we started with Llama 3, we put a great emphasis on model refusals to benign prompts as well as refusal tone. We included both borderline and adversarial prompts in our safety data strategy, and modified our safety data responses to follow tone guidelines.
441
+
442
+ #### Llama 3.2 Systems
443
+
444
+ **Safety as a System:** Large language models, including Llama 3.2, **are not designed to be deployed in isolation** but instead should be deployed as part of an overall AI system with additional safety guardrails as required. Developers are expected to deploy system safeguards when building agentic systems. Safeguards are key to achieve the right helpfulness-safety alignment as well as mitigating safety and security risks inherent to the system and any integration of the model or system with external tools. As part of our responsible release approach, we provide the community with [safeguards](https://llama.meta.com/trust-and-safety/) that developers should deploy with Llama models or other LLMs, including Llama Guard, Prompt Guard and Code Shield. All our [reference implementations](https://github.com/meta-llama/llama-agentic-system) demos contain these safeguards by default so developers can benefit from system-level safety out-of-the-box.
445
+
446
+ ### New Capabilities and Use Cases
447
+
448
+ **Technological Advancement:** Llama releases usually introduce new capabilities that require specific considerations in addition to the best practices that generally apply across all Generative AI use cases. For prior release capabilities also supported by Llama 3.2, see [Llama 3.1 Model Card](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/MODEL_CARD.md), as the same considerations apply here as well.
449
+
450
+ **Constrained Environments:** Llama 3.2 1B and 3B models are expected to be deployed in highly constrained environments, such as mobile devices. LLM Systems using smaller models will have a different alignment profile and safety/helpfulness tradeoff than more complex, larger systems. Developers should ensure the safety of their system meets the requirements of their use case. We recommend using lighter system safeguards for such use cases, like Llama Guard 3-1B or its mobile-optimized version.
451
+
452
+ ### Evaluations
453
+
454
+ **Scaled Evaluations:** We built dedicated, adversarial evaluation datasets and evaluated systems composed of Llama models and Purple Llama safeguards to filter input prompt and output response. It is important to evaluate applications in context, and we recommend building dedicated evaluation dataset for your use case.
455
+
456
+ **Red Teaming:** We conducted recurring red teaming exercises with the goal of discovering risks via adversarial prompting and we used the learnings to improve our benchmarks and safety tuning datasets. We partnered early with subject-matter experts in critical risk areas to understand the nature of these real-world harms and how such models may lead to unintended harm for society. Based on these conversations, we derived a set of adversarial goals for the red team to attempt to achieve, such as extracting harmful information or reprogramming the model to act in a potentially harmful capacity. The red team consisted of experts in cybersecurity, adversarial machine learning, responsible AI, and integrity in addition to multilingual content specialists with background in integrity issues in specific geographic markets.
457
+
458
+ ### Critical Risks
459
+
460
+ In addition to our safety work above, we took extra care on measuring and/or mitigating the following critical risk areas:
461
+
462
+ **1\. CBRNE (Chemical, Biological, Radiological, Nuclear, and Explosive Weapons):** Llama 3.2 1B and 3B models are smaller and less capable derivatives of Llama 3.1. For Llama 3.1 70B and 405B, to assess risks related to proliferation of chemical and biological weapons, we performed uplift testing designed to assess whether use of Llama 3.1 models could meaningfully increase the capabilities of malicious actors to plan or carry out attacks using these types of weapons and have determined that such testing also applies to the smaller 1B and 3B models.
463
+
464
+ **2\. Child Safety:** Child Safety risk assessments were conducted using a team of experts, to assess the model’s capability to produce outputs that could result in Child Safety risks and inform on any necessary and appropriate risk mitigations via fine tuning. We leveraged those expert red teaming sessions to expand the coverage of our evaluation benchmarks through Llama 3 model development. For Llama 3, we conducted new in-depth sessions using objective based methodologies to assess the model risks along multiple attack vectors including the additional languages Llama 3 is trained on. We also partnered with content specialists to perform red teaming exercises assessing potentially violating content while taking account of market specific nuances or experiences.
465
+
466
+ **3\. Cyber Attacks:** For Llama 3.1 405B, our cyber attack uplift study investigated whether LLMs can enhance human capabilities in hacking tasks, both in terms of skill level and speed.
467
+ Our attack automation study focused on evaluating the capabilities of LLMs when used as autonomous agents in cyber offensive operations, specifically in the context of ransomware attacks. This evaluation was distinct from previous studies that considered LLMs as interactive assistants. The primary objective was to assess whether these models could effectively function as independent agents in executing complex cyber-attacks without human intervention. Because Llama 3.2’s 1B and 3B models are smaller and less capable models than Llama 3.1 405B, we broadly believe that the testing conducted for the 405B model also applies to Llama 3.2 models.
468
+
469
+ ### Community
470
+
471
+ **Industry Partnerships:** Generative AI safety requires expertise and tooling, and we believe in the strength of the open community to accelerate its progress. We are active members of open consortiums, including the AI Alliance, Partnership on AI and MLCommons, actively contributing to safety standardization and transparency. We encourage the community to adopt taxonomies like the MLCommons Proof of Concept evaluation to facilitate collaboration and transparency on safety and content evaluations. Our Purple Llama tools are open sourced for the community to use and widely distributed across ecosystem partners including cloud service providers. We encourage community contributions to our [Github repository](https://github.com/meta-llama/PurpleLlama).
472
+
473
+ **Grants:** We also set up the [Llama Impact Grants](https://llama.meta.com/llama-impact-grants/) program to identify and support the most compelling applications of Meta’s Llama model for societal benefit across three categories: education, climate and open innovation. The 20 finalists from the hundreds of applications can be found [here](https://llama.meta.com/llama-impact-grants/#finalists).
474
+
475
+ **Reporting:** Finally, we put in place a set of resources including an [output reporting mechanism](https://developers.facebook.com/llama_output_feedback) and [bug bounty program](https://www.facebook.com/whitehat) to continuously improve the Llama technology with the help of the community.
476
+
477
+ ## Ethical Considerations and Limitations
478
+
479
+ **Values:** The core values of Llama 3.2 are openness, inclusivity and helpfulness. It is meant to serve everyone, and to work for a wide range of use cases. It is thus designed to be accessible to people across many different backgrounds, experiences and perspectives. Llama 3.2 addresses users and their needs as they are, without insertion unnecessary judgment or normativity, while reflecting the understanding that even content that may appear problematic in some cases can serve valuable purposes in others. It respects the dignity and autonomy of all users, especially in terms of the values of free thought and expression that power innovation and progress.
480
+
481
+ **Testing:** Llama 3.2 is a new technology, and like any new technology, there are risks associated with its use. Testing conducted to date has not covered, nor could it cover, all scenarios. For these reasons, as with all LLMs, Llama 3.2’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 3.2 models, developers should perform safety testing and tuning tailored to their specific applications of the model. Please refer to available resources including our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide), [Trust and Safety](https://llama.meta.com/trust-and-safety/) solutions, and other [resources](https://llama.meta.com/docs/get-started/) to learn more about responsible development.
models/Llama-3.2-1B-Instruct/USE_POLICY.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **Llama 3.2** **Acceptable Use Policy**
2
+
3
+ Meta is committed to promoting safe and fair use of its tools and features, including Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use Policy (“**Policy**”). The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).
4
+
5
+ **Prohibited Uses**
6
+
7
+ We want everyone to use Llama 3.2 safely and responsibly. You agree you will not use, or allow others to use, Llama 3.2 to:
8
+
9
+
10
+
11
+ 1. Violate the law or others’ rights, including to:
12
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
13
+ 1. Violence or terrorism
14
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
15
+ 3. Human trafficking, exploitation, and sexual violence
16
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
17
+ 5. Sexual solicitation
18
+ 6. Any other criminal activity
19
+ 1. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
20
+ 2. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
21
+ 3. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
22
+ 4. Collect, process, disclose, generate, or infer private or sensitive information about individuals, including information about individuals’ identity, health, or demographic information, unless you have obtained the right to do so in accordance with applicable law
23
+ 5. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials
24
+ 6. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
25
+ 7. Engage in any action, or facilitate any action, to intentionally circumvent or remove usage restrictions or other safety measures, or to enable functionality disabled by Meta 
26
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 3.2 related to the following:
27
+ 8. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State or to the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons Convention Implementation Act of 1997
28
+ 9. Guns and illegal weapons (including weapon development)
29
+ 10. Illegal drugs and regulated/controlled substances
30
+ 11. Operation of critical infrastructure, transportation technologies, or heavy machinery
31
+ 12. Self-harm or harm to others, including suicide, cutting, and eating disorders
32
+ 13. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
33
+ 3. Intentionally deceive or mislead others, including use of Llama 3.2 related to the following:
34
+ 14. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
35
+ 15. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
36
+ 16. Generating, promoting, or further distributing spam
37
+ 17. Impersonating another individual without consent, authorization, or legal right
38
+ 18. Representing that the use of Llama 3.2 or outputs are human-generated
39
+ 19. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement 
40
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
41
+ 5. Interact with third party tools, models, or software designed to generate unlawful content or engage in unlawful or harmful conduct and/or represent that the outputs of such tools, models, or software are associated with Meta or Llama 3.2
42
+
43
+ With respect to any multimodal models included in Llama 3.2, the rights granted under Section 1(a) of the Llama 3.2 Community License Agreement are not being granted to you if you are an individual domiciled in, or a company with a principal place of business in, the European Union. This restriction does not apply to end users of a product or service that incorporates any such multimodal models.
44
+
45
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
46
+
47
+
48
+
49
+ * Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues&h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)
50
+ * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
51
+ * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
52
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama 3.2: LlamaUseReport@meta.com
models/Llama-3.2-1B-Instruct/config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 128000,
8
+ "eos_token_id": [
9
+ 128001,
10
+ 128008,
11
+ 128009
12
+ ],
13
+ "head_dim": 64,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 2048,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 8192,
18
+ "max_position_embeddings": 131072,
19
+ "mlp_bias": false,
20
+ "model_type": "llama",
21
+ "num_attention_heads": 32,
22
+ "num_hidden_layers": 16,
23
+ "num_key_value_heads": 8,
24
+ "pretraining_tp": 1,
25
+ "rms_norm_eps": 1e-05,
26
+ "rope_scaling": {
27
+ "factor": 32.0,
28
+ "high_freq_factor": 4.0,
29
+ "low_freq_factor": 1.0,
30
+ "original_max_position_embeddings": 8192,
31
+ "rope_type": "llama3"
32
+ },
33
+ "rope_theta": 500000.0,
34
+ "tie_word_embeddings": true,
35
+ "torch_dtype": "bfloat16",
36
+ "transformers_version": "4.45.0.dev0",
37
+ "use_cache": true,
38
+ "vocab_size": 128256
39
+ }
models/Llama-3.2-1B-Instruct/generation_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 128000,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 128001,
6
+ 128008,
7
+ 128009
8
+ ],
9
+ "temperature": 0.6,
10
+ "top_p": 0.9,
11
+ "transformers_version": "4.45.0.dev0"
12
+ }
models/Llama-3.2-1B-Instruct/original/params.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dim": 2048,
3
+ "n_layers": 16,
4
+ "n_heads": 32,
5
+ "n_kv_heads": 8,
6
+ "vocab_size": 128256,
7
+ "ffn_dim_multiplier": 1.5,
8
+ "multiple_of": 256,
9
+ "norm_eps": 1e-05,
10
+ "rope_theta": 500000.0,
11
+ "use_scaled_rope": true
12
+ }
models/Llama-3.2-1B-Instruct/special_tokens_map.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|eot_id|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ }
16
+ }
models/Llama-3.2-1B-Instruct/tokenizer_config.json ADDED
@@ -0,0 +1,2062 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "128000": {
4
+ "content": "<|begin_of_text|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "128001": {
12
+ "content": "<|end_of_text|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "128002": {
20
+ "content": "<|reserved_special_token_0|>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "128003": {
28
+ "content": "<|reserved_special_token_1|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128004": {
36
+ "content": "<|finetune_right_pad_id|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128005": {
44
+ "content": "<|reserved_special_token_2|>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "128006": {
52
+ "content": "<|start_header_id|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "128007": {
60
+ "content": "<|end_header_id|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "128008": {
68
+ "content": "<|eom_id|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "128009": {
76
+ "content": "<|eot_id|>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "128010": {
84
+ "content": "<|python_tag|>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "128011": {
92
+ "content": "<|reserved_special_token_3|>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "128012": {
100
+ "content": "<|reserved_special_token_4|>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "128013": {
108
+ "content": "<|reserved_special_token_5|>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "128014": {
116
+ "content": "<|reserved_special_token_6|>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "128015": {
124
+ "content": "<|reserved_special_token_7|>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "128016": {
132
+ "content": "<|reserved_special_token_8|>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "128017": {
140
+ "content": "<|reserved_special_token_9|>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "128018": {
148
+ "content": "<|reserved_special_token_10|>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "128019": {
156
+ "content": "<|reserved_special_token_11|>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "128020": {
164
+ "content": "<|reserved_special_token_12|>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "128021": {
172
+ "content": "<|reserved_special_token_13|>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "128022": {
180
+ "content": "<|reserved_special_token_14|>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "128023": {
188
+ "content": "<|reserved_special_token_15|>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "128024": {
196
+ "content": "<|reserved_special_token_16|>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "128025": {
204
+ "content": "<|reserved_special_token_17|>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "128026": {
212
+ "content": "<|reserved_special_token_18|>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "128027": {
220
+ "content": "<|reserved_special_token_19|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "128028": {
228
+ "content": "<|reserved_special_token_20|>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "128029": {
236
+ "content": "<|reserved_special_token_21|>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "128030": {
244
+ "content": "<|reserved_special_token_22|>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "128031": {
252
+ "content": "<|reserved_special_token_23|>",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "128032": {
260
+ "content": "<|reserved_special_token_24|>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "128033": {
268
+ "content": "<|reserved_special_token_25|>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "128034": {
276
+ "content": "<|reserved_special_token_26|>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "128035": {
284
+ "content": "<|reserved_special_token_27|>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "128036": {
292
+ "content": "<|reserved_special_token_28|>",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "128037": {
300
+ "content": "<|reserved_special_token_29|>",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "128038": {
308
+ "content": "<|reserved_special_token_30|>",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "128039": {
316
+ "content": "<|reserved_special_token_31|>",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "128040": {
324
+ "content": "<|reserved_special_token_32|>",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "128041": {
332
+ "content": "<|reserved_special_token_33|>",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "128042": {
340
+ "content": "<|reserved_special_token_34|>",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "128043": {
348
+ "content": "<|reserved_special_token_35|>",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "128044": {
356
+ "content": "<|reserved_special_token_36|>",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "128045": {
364
+ "content": "<|reserved_special_token_37|>",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "128046": {
372
+ "content": "<|reserved_special_token_38|>",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "128047": {
380
+ "content": "<|reserved_special_token_39|>",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "128048": {
388
+ "content": "<|reserved_special_token_40|>",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "128049": {
396
+ "content": "<|reserved_special_token_41|>",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "128050": {
404
+ "content": "<|reserved_special_token_42|>",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "128051": {
412
+ "content": "<|reserved_special_token_43|>",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "128052": {
420
+ "content": "<|reserved_special_token_44|>",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "128053": {
428
+ "content": "<|reserved_special_token_45|>",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "128054": {
436
+ "content": "<|reserved_special_token_46|>",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "128055": {
444
+ "content": "<|reserved_special_token_47|>",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "128056": {
452
+ "content": "<|reserved_special_token_48|>",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "128057": {
460
+ "content": "<|reserved_special_token_49|>",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "128058": {
468
+ "content": "<|reserved_special_token_50|>",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "128059": {
476
+ "content": "<|reserved_special_token_51|>",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "128060": {
484
+ "content": "<|reserved_special_token_52|>",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "128061": {
492
+ "content": "<|reserved_special_token_53|>",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "128062": {
500
+ "content": "<|reserved_special_token_54|>",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "128063": {
508
+ "content": "<|reserved_special_token_55|>",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "128064": {
516
+ "content": "<|reserved_special_token_56|>",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "128065": {
524
+ "content": "<|reserved_special_token_57|>",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "128066": {
532
+ "content": "<|reserved_special_token_58|>",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "128067": {
540
+ "content": "<|reserved_special_token_59|>",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "128068": {
548
+ "content": "<|reserved_special_token_60|>",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "128069": {
556
+ "content": "<|reserved_special_token_61|>",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "128070": {
564
+ "content": "<|reserved_special_token_62|>",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "128071": {
572
+ "content": "<|reserved_special_token_63|>",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "128072": {
580
+ "content": "<|reserved_special_token_64|>",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "128073": {
588
+ "content": "<|reserved_special_token_65|>",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "128074": {
596
+ "content": "<|reserved_special_token_66|>",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "128075": {
604
+ "content": "<|reserved_special_token_67|>",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "128076": {
612
+ "content": "<|reserved_special_token_68|>",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "128077": {
620
+ "content": "<|reserved_special_token_69|>",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "128078": {
628
+ "content": "<|reserved_special_token_70|>",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "128079": {
636
+ "content": "<|reserved_special_token_71|>",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "128080": {
644
+ "content": "<|reserved_special_token_72|>",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "128081": {
652
+ "content": "<|reserved_special_token_73|>",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "128082": {
660
+ "content": "<|reserved_special_token_74|>",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "128083": {
668
+ "content": "<|reserved_special_token_75|>",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "128084": {
676
+ "content": "<|reserved_special_token_76|>",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "128085": {
684
+ "content": "<|reserved_special_token_77|>",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "128086": {
692
+ "content": "<|reserved_special_token_78|>",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "128087": {
700
+ "content": "<|reserved_special_token_79|>",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "128088": {
708
+ "content": "<|reserved_special_token_80|>",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "128089": {
716
+ "content": "<|reserved_special_token_81|>",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "128090": {
724
+ "content": "<|reserved_special_token_82|>",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "128091": {
732
+ "content": "<|reserved_special_token_83|>",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "128092": {
740
+ "content": "<|reserved_special_token_84|>",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "128093": {
748
+ "content": "<|reserved_special_token_85|>",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "128094": {
756
+ "content": "<|reserved_special_token_86|>",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "128095": {
764
+ "content": "<|reserved_special_token_87|>",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "128096": {
772
+ "content": "<|reserved_special_token_88|>",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "128097": {
780
+ "content": "<|reserved_special_token_89|>",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "128098": {
788
+ "content": "<|reserved_special_token_90|>",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "128099": {
796
+ "content": "<|reserved_special_token_91|>",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "128100": {
804
+ "content": "<|reserved_special_token_92|>",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "128101": {
812
+ "content": "<|reserved_special_token_93|>",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "128102": {
820
+ "content": "<|reserved_special_token_94|>",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "128103": {
828
+ "content": "<|reserved_special_token_95|>",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ },
835
+ "128104": {
836
+ "content": "<|reserved_special_token_96|>",
837
+ "lstrip": false,
838
+ "normalized": false,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": true
842
+ },
843
+ "128105": {
844
+ "content": "<|reserved_special_token_97|>",
845
+ "lstrip": false,
846
+ "normalized": false,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": true
850
+ },
851
+ "128106": {
852
+ "content": "<|reserved_special_token_98|>",
853
+ "lstrip": false,
854
+ "normalized": false,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": true
858
+ },
859
+ "128107": {
860
+ "content": "<|reserved_special_token_99|>",
861
+ "lstrip": false,
862
+ "normalized": false,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": true
866
+ },
867
+ "128108": {
868
+ "content": "<|reserved_special_token_100|>",
869
+ "lstrip": false,
870
+ "normalized": false,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": true
874
+ },
875
+ "128109": {
876
+ "content": "<|reserved_special_token_101|>",
877
+ "lstrip": false,
878
+ "normalized": false,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": true
882
+ },
883
+ "128110": {
884
+ "content": "<|reserved_special_token_102|>",
885
+ "lstrip": false,
886
+ "normalized": false,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": true
890
+ },
891
+ "128111": {
892
+ "content": "<|reserved_special_token_103|>",
893
+ "lstrip": false,
894
+ "normalized": false,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": true
898
+ },
899
+ "128112": {
900
+ "content": "<|reserved_special_token_104|>",
901
+ "lstrip": false,
902
+ "normalized": false,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": true
906
+ },
907
+ "128113": {
908
+ "content": "<|reserved_special_token_105|>",
909
+ "lstrip": false,
910
+ "normalized": false,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": true
914
+ },
915
+ "128114": {
916
+ "content": "<|reserved_special_token_106|>",
917
+ "lstrip": false,
918
+ "normalized": false,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": true
922
+ },
923
+ "128115": {
924
+ "content": "<|reserved_special_token_107|>",
925
+ "lstrip": false,
926
+ "normalized": false,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": true
930
+ },
931
+ "128116": {
932
+ "content": "<|reserved_special_token_108|>",
933
+ "lstrip": false,
934
+ "normalized": false,
935
+ "rstrip": false,
936
+ "single_word": false,
937
+ "special": true
938
+ },
939
+ "128117": {
940
+ "content": "<|reserved_special_token_109|>",
941
+ "lstrip": false,
942
+ "normalized": false,
943
+ "rstrip": false,
944
+ "single_word": false,
945
+ "special": true
946
+ },
947
+ "128118": {
948
+ "content": "<|reserved_special_token_110|>",
949
+ "lstrip": false,
950
+ "normalized": false,
951
+ "rstrip": false,
952
+ "single_word": false,
953
+ "special": true
954
+ },
955
+ "128119": {
956
+ "content": "<|reserved_special_token_111|>",
957
+ "lstrip": false,
958
+ "normalized": false,
959
+ "rstrip": false,
960
+ "single_word": false,
961
+ "special": true
962
+ },
963
+ "128120": {
964
+ "content": "<|reserved_special_token_112|>",
965
+ "lstrip": false,
966
+ "normalized": false,
967
+ "rstrip": false,
968
+ "single_word": false,
969
+ "special": true
970
+ },
971
+ "128121": {
972
+ "content": "<|reserved_special_token_113|>",
973
+ "lstrip": false,
974
+ "normalized": false,
975
+ "rstrip": false,
976
+ "single_word": false,
977
+ "special": true
978
+ },
979
+ "128122": {
980
+ "content": "<|reserved_special_token_114|>",
981
+ "lstrip": false,
982
+ "normalized": false,
983
+ "rstrip": false,
984
+ "single_word": false,
985
+ "special": true
986
+ },
987
+ "128123": {
988
+ "content": "<|reserved_special_token_115|>",
989
+ "lstrip": false,
990
+ "normalized": false,
991
+ "rstrip": false,
992
+ "single_word": false,
993
+ "special": true
994
+ },
995
+ "128124": {
996
+ "content": "<|reserved_special_token_116|>",
997
+ "lstrip": false,
998
+ "normalized": false,
999
+ "rstrip": false,
1000
+ "single_word": false,
1001
+ "special": true
1002
+ },
1003
+ "128125": {
1004
+ "content": "<|reserved_special_token_117|>",
1005
+ "lstrip": false,
1006
+ "normalized": false,
1007
+ "rstrip": false,
1008
+ "single_word": false,
1009
+ "special": true
1010
+ },
1011
+ "128126": {
1012
+ "content": "<|reserved_special_token_118|>",
1013
+ "lstrip": false,
1014
+ "normalized": false,
1015
+ "rstrip": false,
1016
+ "single_word": false,
1017
+ "special": true
1018
+ },
1019
+ "128127": {
1020
+ "content": "<|reserved_special_token_119|>",
1021
+ "lstrip": false,
1022
+ "normalized": false,
1023
+ "rstrip": false,
1024
+ "single_word": false,
1025
+ "special": true
1026
+ },
1027
+ "128128": {
1028
+ "content": "<|reserved_special_token_120|>",
1029
+ "lstrip": false,
1030
+ "normalized": false,
1031
+ "rstrip": false,
1032
+ "single_word": false,
1033
+ "special": true
1034
+ },
1035
+ "128129": {
1036
+ "content": "<|reserved_special_token_121|>",
1037
+ "lstrip": false,
1038
+ "normalized": false,
1039
+ "rstrip": false,
1040
+ "single_word": false,
1041
+ "special": true
1042
+ },
1043
+ "128130": {
1044
+ "content": "<|reserved_special_token_122|>",
1045
+ "lstrip": false,
1046
+ "normalized": false,
1047
+ "rstrip": false,
1048
+ "single_word": false,
1049
+ "special": true
1050
+ },
1051
+ "128131": {
1052
+ "content": "<|reserved_special_token_123|>",
1053
+ "lstrip": false,
1054
+ "normalized": false,
1055
+ "rstrip": false,
1056
+ "single_word": false,
1057
+ "special": true
1058
+ },
1059
+ "128132": {
1060
+ "content": "<|reserved_special_token_124|>",
1061
+ "lstrip": false,
1062
+ "normalized": false,
1063
+ "rstrip": false,
1064
+ "single_word": false,
1065
+ "special": true
1066
+ },
1067
+ "128133": {
1068
+ "content": "<|reserved_special_token_125|>",
1069
+ "lstrip": false,
1070
+ "normalized": false,
1071
+ "rstrip": false,
1072
+ "single_word": false,
1073
+ "special": true
1074
+ },
1075
+ "128134": {
1076
+ "content": "<|reserved_special_token_126|>",
1077
+ "lstrip": false,
1078
+ "normalized": false,
1079
+ "rstrip": false,
1080
+ "single_word": false,
1081
+ "special": true
1082
+ },
1083
+ "128135": {
1084
+ "content": "<|reserved_special_token_127|>",
1085
+ "lstrip": false,
1086
+ "normalized": false,
1087
+ "rstrip": false,
1088
+ "single_word": false,
1089
+ "special": true
1090
+ },
1091
+ "128136": {
1092
+ "content": "<|reserved_special_token_128|>",
1093
+ "lstrip": false,
1094
+ "normalized": false,
1095
+ "rstrip": false,
1096
+ "single_word": false,
1097
+ "special": true
1098
+ },
1099
+ "128137": {
1100
+ "content": "<|reserved_special_token_129|>",
1101
+ "lstrip": false,
1102
+ "normalized": false,
1103
+ "rstrip": false,
1104
+ "single_word": false,
1105
+ "special": true
1106
+ },
1107
+ "128138": {
1108
+ "content": "<|reserved_special_token_130|>",
1109
+ "lstrip": false,
1110
+ "normalized": false,
1111
+ "rstrip": false,
1112
+ "single_word": false,
1113
+ "special": true
1114
+ },
1115
+ "128139": {
1116
+ "content": "<|reserved_special_token_131|>",
1117
+ "lstrip": false,
1118
+ "normalized": false,
1119
+ "rstrip": false,
1120
+ "single_word": false,
1121
+ "special": true
1122
+ },
1123
+ "128140": {
1124
+ "content": "<|reserved_special_token_132|>",
1125
+ "lstrip": false,
1126
+ "normalized": false,
1127
+ "rstrip": false,
1128
+ "single_word": false,
1129
+ "special": true
1130
+ },
1131
+ "128141": {
1132
+ "content": "<|reserved_special_token_133|>",
1133
+ "lstrip": false,
1134
+ "normalized": false,
1135
+ "rstrip": false,
1136
+ "single_word": false,
1137
+ "special": true
1138
+ },
1139
+ "128142": {
1140
+ "content": "<|reserved_special_token_134|>",
1141
+ "lstrip": false,
1142
+ "normalized": false,
1143
+ "rstrip": false,
1144
+ "single_word": false,
1145
+ "special": true
1146
+ },
1147
+ "128143": {
1148
+ "content": "<|reserved_special_token_135|>",
1149
+ "lstrip": false,
1150
+ "normalized": false,
1151
+ "rstrip": false,
1152
+ "single_word": false,
1153
+ "special": true
1154
+ },
1155
+ "128144": {
1156
+ "content": "<|reserved_special_token_136|>",
1157
+ "lstrip": false,
1158
+ "normalized": false,
1159
+ "rstrip": false,
1160
+ "single_word": false,
1161
+ "special": true
1162
+ },
1163
+ "128145": {
1164
+ "content": "<|reserved_special_token_137|>",
1165
+ "lstrip": false,
1166
+ "normalized": false,
1167
+ "rstrip": false,
1168
+ "single_word": false,
1169
+ "special": true
1170
+ },
1171
+ "128146": {
1172
+ "content": "<|reserved_special_token_138|>",
1173
+ "lstrip": false,
1174
+ "normalized": false,
1175
+ "rstrip": false,
1176
+ "single_word": false,
1177
+ "special": true
1178
+ },
1179
+ "128147": {
1180
+ "content": "<|reserved_special_token_139|>",
1181
+ "lstrip": false,
1182
+ "normalized": false,
1183
+ "rstrip": false,
1184
+ "single_word": false,
1185
+ "special": true
1186
+ },
1187
+ "128148": {
1188
+ "content": "<|reserved_special_token_140|>",
1189
+ "lstrip": false,
1190
+ "normalized": false,
1191
+ "rstrip": false,
1192
+ "single_word": false,
1193
+ "special": true
1194
+ },
1195
+ "128149": {
1196
+ "content": "<|reserved_special_token_141|>",
1197
+ "lstrip": false,
1198
+ "normalized": false,
1199
+ "rstrip": false,
1200
+ "single_word": false,
1201
+ "special": true
1202
+ },
1203
+ "128150": {
1204
+ "content": "<|reserved_special_token_142|>",
1205
+ "lstrip": false,
1206
+ "normalized": false,
1207
+ "rstrip": false,
1208
+ "single_word": false,
1209
+ "special": true
1210
+ },
1211
+ "128151": {
1212
+ "content": "<|reserved_special_token_143|>",
1213
+ "lstrip": false,
1214
+ "normalized": false,
1215
+ "rstrip": false,
1216
+ "single_word": false,
1217
+ "special": true
1218
+ },
1219
+ "128152": {
1220
+ "content": "<|reserved_special_token_144|>",
1221
+ "lstrip": false,
1222
+ "normalized": false,
1223
+ "rstrip": false,
1224
+ "single_word": false,
1225
+ "special": true
1226
+ },
1227
+ "128153": {
1228
+ "content": "<|reserved_special_token_145|>",
1229
+ "lstrip": false,
1230
+ "normalized": false,
1231
+ "rstrip": false,
1232
+ "single_word": false,
1233
+ "special": true
1234
+ },
1235
+ "128154": {
1236
+ "content": "<|reserved_special_token_146|>",
1237
+ "lstrip": false,
1238
+ "normalized": false,
1239
+ "rstrip": false,
1240
+ "single_word": false,
1241
+ "special": true
1242
+ },
1243
+ "128155": {
1244
+ "content": "<|reserved_special_token_147|>",
1245
+ "lstrip": false,
1246
+ "normalized": false,
1247
+ "rstrip": false,
1248
+ "single_word": false,
1249
+ "special": true
1250
+ },
1251
+ "128156": {
1252
+ "content": "<|reserved_special_token_148|>",
1253
+ "lstrip": false,
1254
+ "normalized": false,
1255
+ "rstrip": false,
1256
+ "single_word": false,
1257
+ "special": true
1258
+ },
1259
+ "128157": {
1260
+ "content": "<|reserved_special_token_149|>",
1261
+ "lstrip": false,
1262
+ "normalized": false,
1263
+ "rstrip": false,
1264
+ "single_word": false,
1265
+ "special": true
1266
+ },
1267
+ "128158": {
1268
+ "content": "<|reserved_special_token_150|>",
1269
+ "lstrip": false,
1270
+ "normalized": false,
1271
+ "rstrip": false,
1272
+ "single_word": false,
1273
+ "special": true
1274
+ },
1275
+ "128159": {
1276
+ "content": "<|reserved_special_token_151|>",
1277
+ "lstrip": false,
1278
+ "normalized": false,
1279
+ "rstrip": false,
1280
+ "single_word": false,
1281
+ "special": true
1282
+ },
1283
+ "128160": {
1284
+ "content": "<|reserved_special_token_152|>",
1285
+ "lstrip": false,
1286
+ "normalized": false,
1287
+ "rstrip": false,
1288
+ "single_word": false,
1289
+ "special": true
1290
+ },
1291
+ "128161": {
1292
+ "content": "<|reserved_special_token_153|>",
1293
+ "lstrip": false,
1294
+ "normalized": false,
1295
+ "rstrip": false,
1296
+ "single_word": false,
1297
+ "special": true
1298
+ },
1299
+ "128162": {
1300
+ "content": "<|reserved_special_token_154|>",
1301
+ "lstrip": false,
1302
+ "normalized": false,
1303
+ "rstrip": false,
1304
+ "single_word": false,
1305
+ "special": true
1306
+ },
1307
+ "128163": {
1308
+ "content": "<|reserved_special_token_155|>",
1309
+ "lstrip": false,
1310
+ "normalized": false,
1311
+ "rstrip": false,
1312
+ "single_word": false,
1313
+ "special": true
1314
+ },
1315
+ "128164": {
1316
+ "content": "<|reserved_special_token_156|>",
1317
+ "lstrip": false,
1318
+ "normalized": false,
1319
+ "rstrip": false,
1320
+ "single_word": false,
1321
+ "special": true
1322
+ },
1323
+ "128165": {
1324
+ "content": "<|reserved_special_token_157|>",
1325
+ "lstrip": false,
1326
+ "normalized": false,
1327
+ "rstrip": false,
1328
+ "single_word": false,
1329
+ "special": true
1330
+ },
1331
+ "128166": {
1332
+ "content": "<|reserved_special_token_158|>",
1333
+ "lstrip": false,
1334
+ "normalized": false,
1335
+ "rstrip": false,
1336
+ "single_word": false,
1337
+ "special": true
1338
+ },
1339
+ "128167": {
1340
+ "content": "<|reserved_special_token_159|>",
1341
+ "lstrip": false,
1342
+ "normalized": false,
1343
+ "rstrip": false,
1344
+ "single_word": false,
1345
+ "special": true
1346
+ },
1347
+ "128168": {
1348
+ "content": "<|reserved_special_token_160|>",
1349
+ "lstrip": false,
1350
+ "normalized": false,
1351
+ "rstrip": false,
1352
+ "single_word": false,
1353
+ "special": true
1354
+ },
1355
+ "128169": {
1356
+ "content": "<|reserved_special_token_161|>",
1357
+ "lstrip": false,
1358
+ "normalized": false,
1359
+ "rstrip": false,
1360
+ "single_word": false,
1361
+ "special": true
1362
+ },
1363
+ "128170": {
1364
+ "content": "<|reserved_special_token_162|>",
1365
+ "lstrip": false,
1366
+ "normalized": false,
1367
+ "rstrip": false,
1368
+ "single_word": false,
1369
+ "special": true
1370
+ },
1371
+ "128171": {
1372
+ "content": "<|reserved_special_token_163|>",
1373
+ "lstrip": false,
1374
+ "normalized": false,
1375
+ "rstrip": false,
1376
+ "single_word": false,
1377
+ "special": true
1378
+ },
1379
+ "128172": {
1380
+ "content": "<|reserved_special_token_164|>",
1381
+ "lstrip": false,
1382
+ "normalized": false,
1383
+ "rstrip": false,
1384
+ "single_word": false,
1385
+ "special": true
1386
+ },
1387
+ "128173": {
1388
+ "content": "<|reserved_special_token_165|>",
1389
+ "lstrip": false,
1390
+ "normalized": false,
1391
+ "rstrip": false,
1392
+ "single_word": false,
1393
+ "special": true
1394
+ },
1395
+ "128174": {
1396
+ "content": "<|reserved_special_token_166|>",
1397
+ "lstrip": false,
1398
+ "normalized": false,
1399
+ "rstrip": false,
1400
+ "single_word": false,
1401
+ "special": true
1402
+ },
1403
+ "128175": {
1404
+ "content": "<|reserved_special_token_167|>",
1405
+ "lstrip": false,
1406
+ "normalized": false,
1407
+ "rstrip": false,
1408
+ "single_word": false,
1409
+ "special": true
1410
+ },
1411
+ "128176": {
1412
+ "content": "<|reserved_special_token_168|>",
1413
+ "lstrip": false,
1414
+ "normalized": false,
1415
+ "rstrip": false,
1416
+ "single_word": false,
1417
+ "special": true
1418
+ },
1419
+ "128177": {
1420
+ "content": "<|reserved_special_token_169|>",
1421
+ "lstrip": false,
1422
+ "normalized": false,
1423
+ "rstrip": false,
1424
+ "single_word": false,
1425
+ "special": true
1426
+ },
1427
+ "128178": {
1428
+ "content": "<|reserved_special_token_170|>",
1429
+ "lstrip": false,
1430
+ "normalized": false,
1431
+ "rstrip": false,
1432
+ "single_word": false,
1433
+ "special": true
1434
+ },
1435
+ "128179": {
1436
+ "content": "<|reserved_special_token_171|>",
1437
+ "lstrip": false,
1438
+ "normalized": false,
1439
+ "rstrip": false,
1440
+ "single_word": false,
1441
+ "special": true
1442
+ },
1443
+ "128180": {
1444
+ "content": "<|reserved_special_token_172|>",
1445
+ "lstrip": false,
1446
+ "normalized": false,
1447
+ "rstrip": false,
1448
+ "single_word": false,
1449
+ "special": true
1450
+ },
1451
+ "128181": {
1452
+ "content": "<|reserved_special_token_173|>",
1453
+ "lstrip": false,
1454
+ "normalized": false,
1455
+ "rstrip": false,
1456
+ "single_word": false,
1457
+ "special": true
1458
+ },
1459
+ "128182": {
1460
+ "content": "<|reserved_special_token_174|>",
1461
+ "lstrip": false,
1462
+ "normalized": false,
1463
+ "rstrip": false,
1464
+ "single_word": false,
1465
+ "special": true
1466
+ },
1467
+ "128183": {
1468
+ "content": "<|reserved_special_token_175|>",
1469
+ "lstrip": false,
1470
+ "normalized": false,
1471
+ "rstrip": false,
1472
+ "single_word": false,
1473
+ "special": true
1474
+ },
1475
+ "128184": {
1476
+ "content": "<|reserved_special_token_176|>",
1477
+ "lstrip": false,
1478
+ "normalized": false,
1479
+ "rstrip": false,
1480
+ "single_word": false,
1481
+ "special": true
1482
+ },
1483
+ "128185": {
1484
+ "content": "<|reserved_special_token_177|>",
1485
+ "lstrip": false,
1486
+ "normalized": false,
1487
+ "rstrip": false,
1488
+ "single_word": false,
1489
+ "special": true
1490
+ },
1491
+ "128186": {
1492
+ "content": "<|reserved_special_token_178|>",
1493
+ "lstrip": false,
1494
+ "normalized": false,
1495
+ "rstrip": false,
1496
+ "single_word": false,
1497
+ "special": true
1498
+ },
1499
+ "128187": {
1500
+ "content": "<|reserved_special_token_179|>",
1501
+ "lstrip": false,
1502
+ "normalized": false,
1503
+ "rstrip": false,
1504
+ "single_word": false,
1505
+ "special": true
1506
+ },
1507
+ "128188": {
1508
+ "content": "<|reserved_special_token_180|>",
1509
+ "lstrip": false,
1510
+ "normalized": false,
1511
+ "rstrip": false,
1512
+ "single_word": false,
1513
+ "special": true
1514
+ },
1515
+ "128189": {
1516
+ "content": "<|reserved_special_token_181|>",
1517
+ "lstrip": false,
1518
+ "normalized": false,
1519
+ "rstrip": false,
1520
+ "single_word": false,
1521
+ "special": true
1522
+ },
1523
+ "128190": {
1524
+ "content": "<|reserved_special_token_182|>",
1525
+ "lstrip": false,
1526
+ "normalized": false,
1527
+ "rstrip": false,
1528
+ "single_word": false,
1529
+ "special": true
1530
+ },
1531
+ "128191": {
1532
+ "content": "<|reserved_special_token_183|>",
1533
+ "lstrip": false,
1534
+ "normalized": false,
1535
+ "rstrip": false,
1536
+ "single_word": false,
1537
+ "special": true
1538
+ },
1539
+ "128192": {
1540
+ "content": "<|reserved_special_token_184|>",
1541
+ "lstrip": false,
1542
+ "normalized": false,
1543
+ "rstrip": false,
1544
+ "single_word": false,
1545
+ "special": true
1546
+ },
1547
+ "128193": {
1548
+ "content": "<|reserved_special_token_185|>",
1549
+ "lstrip": false,
1550
+ "normalized": false,
1551
+ "rstrip": false,
1552
+ "single_word": false,
1553
+ "special": true
1554
+ },
1555
+ "128194": {
1556
+ "content": "<|reserved_special_token_186|>",
1557
+ "lstrip": false,
1558
+ "normalized": false,
1559
+ "rstrip": false,
1560
+ "single_word": false,
1561
+ "special": true
1562
+ },
1563
+ "128195": {
1564
+ "content": "<|reserved_special_token_187|>",
1565
+ "lstrip": false,
1566
+ "normalized": false,
1567
+ "rstrip": false,
1568
+ "single_word": false,
1569
+ "special": true
1570
+ },
1571
+ "128196": {
1572
+ "content": "<|reserved_special_token_188|>",
1573
+ "lstrip": false,
1574
+ "normalized": false,
1575
+ "rstrip": false,
1576
+ "single_word": false,
1577
+ "special": true
1578
+ },
1579
+ "128197": {
1580
+ "content": "<|reserved_special_token_189|>",
1581
+ "lstrip": false,
1582
+ "normalized": false,
1583
+ "rstrip": false,
1584
+ "single_word": false,
1585
+ "special": true
1586
+ },
1587
+ "128198": {
1588
+ "content": "<|reserved_special_token_190|>",
1589
+ "lstrip": false,
1590
+ "normalized": false,
1591
+ "rstrip": false,
1592
+ "single_word": false,
1593
+ "special": true
1594
+ },
1595
+ "128199": {
1596
+ "content": "<|reserved_special_token_191|>",
1597
+ "lstrip": false,
1598
+ "normalized": false,
1599
+ "rstrip": false,
1600
+ "single_word": false,
1601
+ "special": true
1602
+ },
1603
+ "128200": {
1604
+ "content": "<|reserved_special_token_192|>",
1605
+ "lstrip": false,
1606
+ "normalized": false,
1607
+ "rstrip": false,
1608
+ "single_word": false,
1609
+ "special": true
1610
+ },
1611
+ "128201": {
1612
+ "content": "<|reserved_special_token_193|>",
1613
+ "lstrip": false,
1614
+ "normalized": false,
1615
+ "rstrip": false,
1616
+ "single_word": false,
1617
+ "special": true
1618
+ },
1619
+ "128202": {
1620
+ "content": "<|reserved_special_token_194|>",
1621
+ "lstrip": false,
1622
+ "normalized": false,
1623
+ "rstrip": false,
1624
+ "single_word": false,
1625
+ "special": true
1626
+ },
1627
+ "128203": {
1628
+ "content": "<|reserved_special_token_195|>",
1629
+ "lstrip": false,
1630
+ "normalized": false,
1631
+ "rstrip": false,
1632
+ "single_word": false,
1633
+ "special": true
1634
+ },
1635
+ "128204": {
1636
+ "content": "<|reserved_special_token_196|>",
1637
+ "lstrip": false,
1638
+ "normalized": false,
1639
+ "rstrip": false,
1640
+ "single_word": false,
1641
+ "special": true
1642
+ },
1643
+ "128205": {
1644
+ "content": "<|reserved_special_token_197|>",
1645
+ "lstrip": false,
1646
+ "normalized": false,
1647
+ "rstrip": false,
1648
+ "single_word": false,
1649
+ "special": true
1650
+ },
1651
+ "128206": {
1652
+ "content": "<|reserved_special_token_198|>",
1653
+ "lstrip": false,
1654
+ "normalized": false,
1655
+ "rstrip": false,
1656
+ "single_word": false,
1657
+ "special": true
1658
+ },
1659
+ "128207": {
1660
+ "content": "<|reserved_special_token_199|>",
1661
+ "lstrip": false,
1662
+ "normalized": false,
1663
+ "rstrip": false,
1664
+ "single_word": false,
1665
+ "special": true
1666
+ },
1667
+ "128208": {
1668
+ "content": "<|reserved_special_token_200|>",
1669
+ "lstrip": false,
1670
+ "normalized": false,
1671
+ "rstrip": false,
1672
+ "single_word": false,
1673
+ "special": true
1674
+ },
1675
+ "128209": {
1676
+ "content": "<|reserved_special_token_201|>",
1677
+ "lstrip": false,
1678
+ "normalized": false,
1679
+ "rstrip": false,
1680
+ "single_word": false,
1681
+ "special": true
1682
+ },
1683
+ "128210": {
1684
+ "content": "<|reserved_special_token_202|>",
1685
+ "lstrip": false,
1686
+ "normalized": false,
1687
+ "rstrip": false,
1688
+ "single_word": false,
1689
+ "special": true
1690
+ },
1691
+ "128211": {
1692
+ "content": "<|reserved_special_token_203|>",
1693
+ "lstrip": false,
1694
+ "normalized": false,
1695
+ "rstrip": false,
1696
+ "single_word": false,
1697
+ "special": true
1698
+ },
1699
+ "128212": {
1700
+ "content": "<|reserved_special_token_204|>",
1701
+ "lstrip": false,
1702
+ "normalized": false,
1703
+ "rstrip": false,
1704
+ "single_word": false,
1705
+ "special": true
1706
+ },
1707
+ "128213": {
1708
+ "content": "<|reserved_special_token_205|>",
1709
+ "lstrip": false,
1710
+ "normalized": false,
1711
+ "rstrip": false,
1712
+ "single_word": false,
1713
+ "special": true
1714
+ },
1715
+ "128214": {
1716
+ "content": "<|reserved_special_token_206|>",
1717
+ "lstrip": false,
1718
+ "normalized": false,
1719
+ "rstrip": false,
1720
+ "single_word": false,
1721
+ "special": true
1722
+ },
1723
+ "128215": {
1724
+ "content": "<|reserved_special_token_207|>",
1725
+ "lstrip": false,
1726
+ "normalized": false,
1727
+ "rstrip": false,
1728
+ "single_word": false,
1729
+ "special": true
1730
+ },
1731
+ "128216": {
1732
+ "content": "<|reserved_special_token_208|>",
1733
+ "lstrip": false,
1734
+ "normalized": false,
1735
+ "rstrip": false,
1736
+ "single_word": false,
1737
+ "special": true
1738
+ },
1739
+ "128217": {
1740
+ "content": "<|reserved_special_token_209|>",
1741
+ "lstrip": false,
1742
+ "normalized": false,
1743
+ "rstrip": false,
1744
+ "single_word": false,
1745
+ "special": true
1746
+ },
1747
+ "128218": {
1748
+ "content": "<|reserved_special_token_210|>",
1749
+ "lstrip": false,
1750
+ "normalized": false,
1751
+ "rstrip": false,
1752
+ "single_word": false,
1753
+ "special": true
1754
+ },
1755
+ "128219": {
1756
+ "content": "<|reserved_special_token_211|>",
1757
+ "lstrip": false,
1758
+ "normalized": false,
1759
+ "rstrip": false,
1760
+ "single_word": false,
1761
+ "special": true
1762
+ },
1763
+ "128220": {
1764
+ "content": "<|reserved_special_token_212|>",
1765
+ "lstrip": false,
1766
+ "normalized": false,
1767
+ "rstrip": false,
1768
+ "single_word": false,
1769
+ "special": true
1770
+ },
1771
+ "128221": {
1772
+ "content": "<|reserved_special_token_213|>",
1773
+ "lstrip": false,
1774
+ "normalized": false,
1775
+ "rstrip": false,
1776
+ "single_word": false,
1777
+ "special": true
1778
+ },
1779
+ "128222": {
1780
+ "content": "<|reserved_special_token_214|>",
1781
+ "lstrip": false,
1782
+ "normalized": false,
1783
+ "rstrip": false,
1784
+ "single_word": false,
1785
+ "special": true
1786
+ },
1787
+ "128223": {
1788
+ "content": "<|reserved_special_token_215|>",
1789
+ "lstrip": false,
1790
+ "normalized": false,
1791
+ "rstrip": false,
1792
+ "single_word": false,
1793
+ "special": true
1794
+ },
1795
+ "128224": {
1796
+ "content": "<|reserved_special_token_216|>",
1797
+ "lstrip": false,
1798
+ "normalized": false,
1799
+ "rstrip": false,
1800
+ "single_word": false,
1801
+ "special": true
1802
+ },
1803
+ "128225": {
1804
+ "content": "<|reserved_special_token_217|>",
1805
+ "lstrip": false,
1806
+ "normalized": false,
1807
+ "rstrip": false,
1808
+ "single_word": false,
1809
+ "special": true
1810
+ },
1811
+ "128226": {
1812
+ "content": "<|reserved_special_token_218|>",
1813
+ "lstrip": false,
1814
+ "normalized": false,
1815
+ "rstrip": false,
1816
+ "single_word": false,
1817
+ "special": true
1818
+ },
1819
+ "128227": {
1820
+ "content": "<|reserved_special_token_219|>",
1821
+ "lstrip": false,
1822
+ "normalized": false,
1823
+ "rstrip": false,
1824
+ "single_word": false,
1825
+ "special": true
1826
+ },
1827
+ "128228": {
1828
+ "content": "<|reserved_special_token_220|>",
1829
+ "lstrip": false,
1830
+ "normalized": false,
1831
+ "rstrip": false,
1832
+ "single_word": false,
1833
+ "special": true
1834
+ },
1835
+ "128229": {
1836
+ "content": "<|reserved_special_token_221|>",
1837
+ "lstrip": false,
1838
+ "normalized": false,
1839
+ "rstrip": false,
1840
+ "single_word": false,
1841
+ "special": true
1842
+ },
1843
+ "128230": {
1844
+ "content": "<|reserved_special_token_222|>",
1845
+ "lstrip": false,
1846
+ "normalized": false,
1847
+ "rstrip": false,
1848
+ "single_word": false,
1849
+ "special": true
1850
+ },
1851
+ "128231": {
1852
+ "content": "<|reserved_special_token_223|>",
1853
+ "lstrip": false,
1854
+ "normalized": false,
1855
+ "rstrip": false,
1856
+ "single_word": false,
1857
+ "special": true
1858
+ },
1859
+ "128232": {
1860
+ "content": "<|reserved_special_token_224|>",
1861
+ "lstrip": false,
1862
+ "normalized": false,
1863
+ "rstrip": false,
1864
+ "single_word": false,
1865
+ "special": true
1866
+ },
1867
+ "128233": {
1868
+ "content": "<|reserved_special_token_225|>",
1869
+ "lstrip": false,
1870
+ "normalized": false,
1871
+ "rstrip": false,
1872
+ "single_word": false,
1873
+ "special": true
1874
+ },
1875
+ "128234": {
1876
+ "content": "<|reserved_special_token_226|>",
1877
+ "lstrip": false,
1878
+ "normalized": false,
1879
+ "rstrip": false,
1880
+ "single_word": false,
1881
+ "special": true
1882
+ },
1883
+ "128235": {
1884
+ "content": "<|reserved_special_token_227|>",
1885
+ "lstrip": false,
1886
+ "normalized": false,
1887
+ "rstrip": false,
1888
+ "single_word": false,
1889
+ "special": true
1890
+ },
1891
+ "128236": {
1892
+ "content": "<|reserved_special_token_228|>",
1893
+ "lstrip": false,
1894
+ "normalized": false,
1895
+ "rstrip": false,
1896
+ "single_word": false,
1897
+ "special": true
1898
+ },
1899
+ "128237": {
1900
+ "content": "<|reserved_special_token_229|>",
1901
+ "lstrip": false,
1902
+ "normalized": false,
1903
+ "rstrip": false,
1904
+ "single_word": false,
1905
+ "special": true
1906
+ },
1907
+ "128238": {
1908
+ "content": "<|reserved_special_token_230|>",
1909
+ "lstrip": false,
1910
+ "normalized": false,
1911
+ "rstrip": false,
1912
+ "single_word": false,
1913
+ "special": true
1914
+ },
1915
+ "128239": {
1916
+ "content": "<|reserved_special_token_231|>",
1917
+ "lstrip": false,
1918
+ "normalized": false,
1919
+ "rstrip": false,
1920
+ "single_word": false,
1921
+ "special": true
1922
+ },
1923
+ "128240": {
1924
+ "content": "<|reserved_special_token_232|>",
1925
+ "lstrip": false,
1926
+ "normalized": false,
1927
+ "rstrip": false,
1928
+ "single_word": false,
1929
+ "special": true
1930
+ },
1931
+ "128241": {
1932
+ "content": "<|reserved_special_token_233|>",
1933
+ "lstrip": false,
1934
+ "normalized": false,
1935
+ "rstrip": false,
1936
+ "single_word": false,
1937
+ "special": true
1938
+ },
1939
+ "128242": {
1940
+ "content": "<|reserved_special_token_234|>",
1941
+ "lstrip": false,
1942
+ "normalized": false,
1943
+ "rstrip": false,
1944
+ "single_word": false,
1945
+ "special": true
1946
+ },
1947
+ "128243": {
1948
+ "content": "<|reserved_special_token_235|>",
1949
+ "lstrip": false,
1950
+ "normalized": false,
1951
+ "rstrip": false,
1952
+ "single_word": false,
1953
+ "special": true
1954
+ },
1955
+ "128244": {
1956
+ "content": "<|reserved_special_token_236|>",
1957
+ "lstrip": false,
1958
+ "normalized": false,
1959
+ "rstrip": false,
1960
+ "single_word": false,
1961
+ "special": true
1962
+ },
1963
+ "128245": {
1964
+ "content": "<|reserved_special_token_237|>",
1965
+ "lstrip": false,
1966
+ "normalized": false,
1967
+ "rstrip": false,
1968
+ "single_word": false,
1969
+ "special": true
1970
+ },
1971
+ "128246": {
1972
+ "content": "<|reserved_special_token_238|>",
1973
+ "lstrip": false,
1974
+ "normalized": false,
1975
+ "rstrip": false,
1976
+ "single_word": false,
1977
+ "special": true
1978
+ },
1979
+ "128247": {
1980
+ "content": "<|reserved_special_token_239|>",
1981
+ "lstrip": false,
1982
+ "normalized": false,
1983
+ "rstrip": false,
1984
+ "single_word": false,
1985
+ "special": true
1986
+ },
1987
+ "128248": {
1988
+ "content": "<|reserved_special_token_240|>",
1989
+ "lstrip": false,
1990
+ "normalized": false,
1991
+ "rstrip": false,
1992
+ "single_word": false,
1993
+ "special": true
1994
+ },
1995
+ "128249": {
1996
+ "content": "<|reserved_special_token_241|>",
1997
+ "lstrip": false,
1998
+ "normalized": false,
1999
+ "rstrip": false,
2000
+ "single_word": false,
2001
+ "special": true
2002
+ },
2003
+ "128250": {
2004
+ "content": "<|reserved_special_token_242|>",
2005
+ "lstrip": false,
2006
+ "normalized": false,
2007
+ "rstrip": false,
2008
+ "single_word": false,
2009
+ "special": true
2010
+ },
2011
+ "128251": {
2012
+ "content": "<|reserved_special_token_243|>",
2013
+ "lstrip": false,
2014
+ "normalized": false,
2015
+ "rstrip": false,
2016
+ "single_word": false,
2017
+ "special": true
2018
+ },
2019
+ "128252": {
2020
+ "content": "<|reserved_special_token_244|>",
2021
+ "lstrip": false,
2022
+ "normalized": false,
2023
+ "rstrip": false,
2024
+ "single_word": false,
2025
+ "special": true
2026
+ },
2027
+ "128253": {
2028
+ "content": "<|reserved_special_token_245|>",
2029
+ "lstrip": false,
2030
+ "normalized": false,
2031
+ "rstrip": false,
2032
+ "single_word": false,
2033
+ "special": true
2034
+ },
2035
+ "128254": {
2036
+ "content": "<|reserved_special_token_246|>",
2037
+ "lstrip": false,
2038
+ "normalized": false,
2039
+ "rstrip": false,
2040
+ "single_word": false,
2041
+ "special": true
2042
+ },
2043
+ "128255": {
2044
+ "content": "<|reserved_special_token_247|>",
2045
+ "lstrip": false,
2046
+ "normalized": false,
2047
+ "rstrip": false,
2048
+ "single_word": false,
2049
+ "special": true
2050
+ }
2051
+ },
2052
+ "bos_token": "<|begin_of_text|>",
2053
+ "chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n{%- endif %}\n\n{#- System message #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{{- \"Cutting Knowledge Date: December 2023\\n\" }}\n{{- \"Today Date: \" + date_string + \"\\n\\n\" }}\n{%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n{%- endif %}\n{{- system_message }}\n{{- \"<|eot_id|>\" }}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|start_header_id|>user<|end_header_id|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot_id|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}\n {%- elif 'tool_calls' in message %}\n {%- if not message.tool_calls|length == 1 %}\n {{- raise_exception(\"This model only supports single tool-calls at once!\") }}\n {%- endif %}\n {%- set tool_call = message.tool_calls[0].function %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- \"}\" }}\n {{- \"<|eot_id|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|start_header_id|>ipython<|end_header_id|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot_id|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' }}\n{%- endif %}\n",
2054
+ "clean_up_tokenization_spaces": true,
2055
+ "eos_token": "<|eot_id|>",
2056
+ "model_input_names": [
2057
+ "input_ids",
2058
+ "attention_mask"
2059
+ ],
2060
+ "model_max_length": 131072,
2061
+ "tokenizer_class": "PreTrainedTokenizerFast"
2062
+ }
models/Qwen2.5-1.5B/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
models/Qwen2.5-1.5B/README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-1.5B/blob/main/LICENSE
4
+ language:
5
+ - en
6
+ pipeline_tag: text-generation
7
+ library_name: transformers
8
+ ---
9
+
10
+ # Qwen2.5-1.5B
11
+
12
+ ## Introduction
13
+
14
+ Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
15
+
16
+ - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
17
+ - Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
18
+ - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
19
+ - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
20
+
21
+ **This repo contains the base 1.5B Qwen2.5 model**, which has the following features:
22
+ - Type: Causal Language Models
23
+ - Training Stage: Pretraining
24
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, Attention QKV bias and tied word embeddings
25
+ - Number of Parameters: 1.54B
26
+ - Number of Paramaters (Non-Embedding): 1.31B
27
+ - Number of Layers: 28
28
+ - Number of Attention Heads (GQA): 12 for Q and 2 for KV
29
+ - Context Length: Full 32,768 tokens
30
+
31
+ **We do not recommend using base language models for conversations.** Instead, you can apply post-training, e.g., SFT, RLHF, continued pretraining, etc., on this model.
32
+
33
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
34
+
35
+ ## Requirements
36
+
37
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
38
+
39
+ With `transformers<4.37.0`, you will encounter the following error:
40
+ ```
41
+ KeyError: 'qwen2'
42
+ ```
43
+
44
+ ## Evaluation & Performance
45
+
46
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
47
+
48
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
49
+
50
+ ## Citation
51
+
52
+ If you find our work helpful, feel free to give us a cite.
53
+
54
+ ```
55
+ @misc{qwen2.5,
56
+ title = {Qwen2.5: A Party of Foundation Models},
57
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
58
+ author = {Qwen Team},
59
+ month = {September},
60
+ year = {2024}
61
+ }
62
+
63
+ @article{qwen2,
64
+ title={Qwen2 Technical Report},
65
+ author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
66
+ journal={arXiv preprint arXiv:2407.10671},
67
+ year={2024}
68
+ }
69
+ ```
models/Qwen2.5-1.5B/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151643,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 131072,
13
+ "max_window_layers": 28,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_theta": 1000000.0,
20
+ "sliding_window": 131072,
21
+ "tie_word_embeddings": true,
22
+ "torch_dtype": "bfloat16",
23
+ "transformers_version": "4.40.1",
24
+ "use_cache": true,
25
+ "use_mrope": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
models/Qwen2.5-1.5B/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": 151643,
5
+ "max_new_tokens": 2048,
6
+ "transformers_version": "4.37.0"
7
+ }
models/Qwen2.5-1.5B/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
models/Qwen2.5-1.5B/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
models/Qwen2.5-1.5B/tokenizer_config.json ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|endoftext|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "split_special_tokens": false,
205
+ "tokenizer_class": "Qwen2Tokenizer",
206
+ "unk_token": null
207
+ }
models/Qwen2.5-1.5B/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
models/VibeVoice-1.5B/.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.jpg filter=lfs diff=lfs merge=lfs -text
37
+ *.png filter=lfs diff=lfs merge=lfs -text
models/VibeVoice-1.5B/README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ license: mit
6
+ pipeline_tag: text-to-speech
7
+ tags:
8
+ - Podcast
9
+ library_name: transformers
10
+ ---
11
+
12
+ https://github.com/vibevoice-community/VibeVoice
13
+
14
+ ## VibeVoice: A Frontier Open-Source Text-to-Speech Model
15
+
16
+ VibeVoice is a novel framework designed for generating expressive, long-form, multi-speaker conversational audio, such as podcasts, from text. It addresses significant challenges in traditional Text-to-Speech (TTS) systems, particularly in scalability, speaker consistency, and natural turn-taking.
17
+
18
+ A core innovation of VibeVoice is its use of continuous speech tokenizers (Acoustic and Semantic) operating at an ultra-low frame rate of 7.5 Hz. These tokenizers efficiently preserve audio fidelity while significantly boosting computational efficiency for processing long sequences. VibeVoice employs a next-token diffusion framework, leveraging a Large Language Model (LLM) to understand textual context and dialogue flow, and a diffusion head to generate high-fidelity acoustic details.
19
+
20
+ The model can synthesize speech up to **90 minutes** long with up to **4 distinct speakers**, surpassing the typical 1-2 speaker limits of many prior models.
21
+
22
+ ➡️ **Technical Report:** [VibeVoice Technical Report](https://arxiv.org/abs/2508.19205)
23
+
24
+ ➡️ **Project Page:** [microsoft/VibeVoice](https://microsoft.github.io/VibeVoice)
25
+
26
+ ➡️ **Code:** [microsoft/VibeVoice-Code](https://github.com/microsoft/VibeVoice)
27
+
28
+ <p align="left">
29
+ <img src="figures/Fig1.png" alt="VibeVoice Overview" height="250px">
30
+ </p>
31
+
32
+ ## Training Details
33
+ Transformer-based Large Language Model (LLM) integrated with specialized acoustic and semantic tokenizers and a diffusion-based decoding head.
34
+ - LLM: [Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B) for this release.
35
+ - Tokenizers:
36
+ - Acoustic Tokenizer: Based on a σ-VAE variant (proposed in [LatentLM](https://arxiv.org/pdf/2412.08635)), with a mirror-symmetric encoder-decoder structure featuring 7 stages of modified Transformer blocks. Achieves 3200x downsampling from 24kHz input. Encoder/decoder components are ~340M parameters each.
37
+ - Semantic Tokenizer: Encoder mirrors the Acoustic Tokenizer's architecture (without VAE components). Trained with an ASR proxy task.
38
+ - Diffusion Head: Lightweight module (4 layers, ~123M parameters) conditioned on LLM hidden states. Predicts acoustic VAE features using a Denoising Diffusion Probabilistic Models (DDPM) process. Uses Classifier-Free Guidance (CFG) and DPM-Solver (and variants) during inference.
39
+ - Context Length: Trained with a curriculum increasing up to 65,536 tokens.
40
+ - Training Stages:
41
+ - Tokenizer Pre-training: Acoustic and Semantic tokenizers are pre-trained separately.
42
+ - VibeVoice Training: Pre-trained tokenizers are frozen; only the LLM and diffusion head parameters are trained. A curriculum learning strategy is used for input sequence length (4k -> 16K -> 32K -> 64K). Text tokenizer not explicitly specified, but the LLM (Qwen2.5) typically uses its own. Audio is "tokenized" via the acoustic and semantic tokenizers.
43
+
44
+
45
+ ## Models
46
+ | Model | Context Length | Generation Length | Weight |
47
+ |-------|----------------|----------|----------|
48
+ | VibeVoice-0.5B-Streaming | - | - | On the way |
49
+ | VibeVoice-1.5B | 64K | ~90 min | You are here. |
50
+ | VibeVoice-Large| 32K | ~45 min | [HF link](https://huggingface.co/microsoft/VibeVoice-Large) |
51
+
52
+ ## Installation and Usage
53
+
54
+ Please refer to [GitHub README](https://github.com/microsoft/VibeVoice?tab=readme-ov-file#installation)
55
+
56
+ ## Responsible Usage
57
+ ### Direct intended uses
58
+ The VibeVoice model is limited to research purpose use exploring highly realistic audio dialogue generation detailed in the [tech report](https://arxiv.org/pdf/2508.19205).
59
+
60
+ ### Out-of-scope uses
61
+ Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by MIT License. Use to generate any text transcript. Furthermore, this release is not intended or licensed for any of the following scenarios:
62
+
63
+ - Voice impersonation without explicit, recorded consent – cloning a real individual’s voice for satire, advertising, ransom, social‑engineering, or authentication bypass.
64
+ - Disinformation or impersonation – creating audio presented as genuine recordings of real people or events.
65
+ - Real‑time or low‑latency voice conversion – telephone or video‑conference “live deep‑fake” applications.
66
+ - Unsupported language – the model is trained only on English and Chinese data; outputs in other languages are unsupported and may be unintelligible or offensive.
67
+ - Generation of background ambience, Foley, or music – VibeVoice is speech‑only and will not produce coherent non‑speech audio.
68
+
69
+
70
+ ## Risks and limitations
71
+ While efforts have been made to optimize it through various techniques, it may still produce outputs that are unexpected, biased, or inaccurate. VibeVoice inherits any biases, errors, or omissions produced by its base model (specifically, Qwen2.5 1.5b in this release).
72
+ Potential for Deepfakes and Disinformation: High-quality synthetic speech can be misused to create convincing fake audio content for impersonation, fraud, or spreading disinformation. Users must ensure transcripts are reliable, check content accuracy, and avoid using generated content in misleading ways. Users are expected to use the generated content and to deploy the models in a lawful manner, in full compliance with all applicable laws and regulations in the relevant jurisdictions. It is best practice to disclose the use of AI when sharing AI-generated content.
73
+ English and Chinese only: Transcripts in language other than English or Chinese may result in unexpected audio outputs.
74
+ Non-Speech Audio: The model focuses solely on speech synthesis and does not handle background noise, music, or other sound effects.
75
+ Overlapping Speech: The current model does not explicitly model or generate overlapping speech segments in conversations.
76
+
77
+
78
+ ## Recommendations
79
+ We do not recommend using VibeVoice in commercial or real-world applications without further testing and development. This model is intended for research and development purposes only. Please use responsibly.
80
+
81
+ To mitigate the risks of misuse, we have:
82
+ Embedded an audible disclaimer (e.g. “This segment was generated by AI”) automatically into every synthesized audio file.
83
+ Added an imperceptible watermark to generated audio so third parties can verify VibeVoice provenance. Please see contact information at the end of this model card.
84
+ Logged inference requests (hashed) for abuse pattern detection and publishing aggregated statistics quarterly.
85
+ Users are responsible for sourcing their datasets legally and ethically. This may include securing appropriate rights and/or anonymizing data prior to use with VibeVoice. Users are reminded to be mindful of data privacy concerns.
86
+
87
+
88
+ ## Contact
89
+ This project was conducted by members of Microsoft Research. We welcome feedback and collaboration from our audience. If you have suggestions, questions, or observe unexpected/offensive behavior in our technology, please contact us at VibeVoice@microsoft.com.
90
+ If the team receives reports of undesired behavior or identifies issues independently, we will update this repository with appropriate mitigations.
models/VibeVoice-1.5B/config.json ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "acoustic_vae_dim": 64,
3
+ "acoustic_tokenizer_config": {
4
+ "causal": true,
5
+ "channels": 1,
6
+ "conv_bias": true,
7
+ "conv_norm": "none",
8
+ "corpus_normalize": 0.0,
9
+ "decoder_depths": null,
10
+ "decoder_n_filters": 32,
11
+ "decoder_ratios": [
12
+ 8,
13
+ 5,
14
+ 5,
15
+ 4,
16
+ 2,
17
+ 2
18
+ ],
19
+ "disable_last_norm": true,
20
+ "encoder_depths": "3-3-3-3-3-3-8",
21
+ "encoder_n_filters": 32,
22
+ "encoder_ratios": [
23
+ 8,
24
+ 5,
25
+ 5,
26
+ 4,
27
+ 2,
28
+ 2
29
+ ],
30
+ "fix_std": 0.5,
31
+ "layer_scale_init_value": 1e-06,
32
+ "layernorm": "RMSNorm",
33
+ "layernorm_elementwise_affine": true,
34
+ "layernorm_eps": 1e-05,
35
+ "mixer_layer": "depthwise_conv",
36
+ "model_type": "vibevoice_acoustic_tokenizer",
37
+ "pad_mode": "constant",
38
+ "std_dist_type": "gaussian",
39
+ "vae_dim": 64,
40
+ "weight_init_value": 0.01
41
+ },
42
+ "architectures": [
43
+ "VibeVoiceForConditionalGeneration"
44
+ ],
45
+ "decoder_config": {
46
+ "attention_dropout": 0.0,
47
+ "hidden_act": "silu",
48
+ "hidden_size": 1536,
49
+ "initializer_range": 0.02,
50
+ "intermediate_size": 8960,
51
+ "max_position_embeddings": 65536,
52
+ "max_window_layers": 28,
53
+ "model_type": "qwen2",
54
+ "num_attention_heads": 12,
55
+ "num_hidden_layers": 28,
56
+ "num_key_value_heads": 2,
57
+ "rms_norm_eps": 1e-06,
58
+ "rope_scaling": null,
59
+ "rope_theta": 1000000.0,
60
+ "sliding_window": null,
61
+ "tie_word_embeddings": true,
62
+ "torch_dtype": "bfloat16",
63
+ "use_cache": true,
64
+ "use_sliding_window": false,
65
+ "vocab_size": 151936
66
+ },
67
+ "diffusion_head_config": {
68
+ "ddpm_batch_mul": 4,
69
+ "ddpm_beta_schedule": "cosine",
70
+ "ddpm_num_inference_steps": 20,
71
+ "ddpm_num_steps": 1000,
72
+ "diffusion_type": "ddpm",
73
+ "head_ffn_ratio": 3.0,
74
+ "head_layers": 4,
75
+ "hidden_size": 1536,
76
+ "latent_size": 64,
77
+ "model_type": "vibevoice_diffusion_head",
78
+ "prediction_type": "v_prediction",
79
+ "rms_norm_eps": 1e-05,
80
+ "speech_vae_dim": 64
81
+ },
82
+ "model_type": "vibevoice",
83
+ "semantic_tokenizer_config": {
84
+ "causal": true,
85
+ "channels": 1,
86
+ "conv_bias": true,
87
+ "conv_norm": "none",
88
+ "corpus_normalize": 0.0,
89
+ "disable_last_norm": true,
90
+ "encoder_depths": "3-3-3-3-3-3-8",
91
+ "encoder_n_filters": 32,
92
+ "encoder_ratios": [
93
+ 8,
94
+ 5,
95
+ 5,
96
+ 4,
97
+ 2,
98
+ 2
99
+ ],
100
+ "fix_std": 0,
101
+ "layer_scale_init_value": 1e-06,
102
+ "layernorm": "RMSNorm",
103
+ "layernorm_elementwise_affine": true,
104
+ "layernorm_eps": 1e-05,
105
+ "mixer_layer": "depthwise_conv",
106
+ "model_type": "vibevoice_semantic_tokenizer",
107
+ "pad_mode": "constant",
108
+ "std_dist_type": "none",
109
+ "vae_dim": 128,
110
+ "weight_init_value": 0.01
111
+ },
112
+ "semantic_vae_dim": 128,
113
+ "torch_dtype": "bfloat16",
114
+ "transformers_version": "4.51.3"
115
+ }
models/VibeVoice-1.5B/preprocessor_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "VibeVoiceProcessor",
3
+ "speech_tok_compress_ratio": 3200,
4
+ "db_normalize": true,
5
+ "audio_processor": {
6
+ "feature_extractor_type": "VibeVoiceTokenizerProcessor",
7
+ "sampling_rate": 24000,
8
+ "normalize_audio": true,
9
+ "target_dB_FS": -25,
10
+ "eps": 1e-06
11
+ },
12
+ "language_model_pretrained_name": "Qwen/Qwen2.5-1.5B"
13
+ }
models/VoxCPM-0.5B/.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ assets/voxcpm_model.png filter=lfs diff=lfs merge=lfs -text
models/VoxCPM-0.5B/README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ base_model:
7
+ - openbmb/MiniCPM4-0.5B
8
+ pipeline_tag: text-to-speech
9
+ library_name: voxcpm
10
+ tags:
11
+ - text-to-speech
12
+ - speech
13
+ - speech generation
14
+ - voice cloning
15
+ ---
16
+
17
+ ## 🎙️ VoxCPM: Tokenizer-Free TTS for Context-Aware Speech Generation and True-to-Life Voice Cloning
18
+
19
+
20
+ [![Project Page](https://img.shields.io/badge/Project%20Page-GitHub-blue)](https://github.com/OpenBMB/VoxCPM/) [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-OpenBMB-yellow)](https://huggingface.co/openbmb/VoxCPM-0.5B) [![Live Playground](https://img.shields.io/badge/Live%20PlayGround-Demo-orange)](https://huggingface.co/spaces/OpenBMB/VoxCPM-Demo) [![Samples](https://img.shields.io/badge/Page-Samples-red)](https://openbmb.github.io/VoxCPM-demopage/)
21
+
22
+
23
+ <div align="center">
24
+ <img src="assets/voxcpm_logo.png" alt="VoxCPM Logo" width="40%">
25
+ </div>
26
+
27
+ ## Overview
28
+
29
+ VoxCPM is a novel tokenizer-free Text-to-Speech (TTS) system that redefines realism in speech synthesis. By modeling speech in a continuous space, it overcomes the limitations of discrete tokenization and enables two flagship capabilities: context-aware speech generation and true-to-life zero-shot voice cloning.
30
+
31
+ Unlike mainstream approaches that convert speech to discrete tokens, VoxCPM uses an end-to-end diffusion autoregressive architecture that directly generates continuous speech representations from text. Built on [MiniCPM-4](https://huggingface.co/openbmb/MiniCPM4-0.5B) backbone, it achieves implicit semantic-acoustic decoupling through hierachical language modeling and FSQ constraints, greatly enhancing both expressiveness and generation stability.
32
+
33
+ <div align="center">
34
+ <img src="assets/voxcpm_model.png" alt="VoxCPM Model Architecture" width="90%">
35
+ </div>
36
+
37
+
38
+ ### 🚀 Key Features
39
+ - **Context-Aware, Expressive Speech Generation** - VoxCPM comprehends text to infer and generate appropriate prosody, delivering speech with remarkable expressiveness and natural flow. It spontaneously adapts speaking style based on content, producing highly fitting vocal expression trained on a massive 1.8 million-hour bilingual corpus.
40
+ - **True-to-Life Voice Cloning** - With only a short reference audio clip, VoxCPM performs accurate zero-shot voice cloning, capturing not only the speaker’s timbre but also fine-grained characteristics such as accent, emotional tone, rhythm, and pacing to create a faithful and natural replica.
41
+ - **High-Efficiency Synthesis** - VoxCPM supports streaming synthesis with a Real-Time Factor (RTF) as low as 0.17 on a consumer-grade NVIDIA RTX 4090 GPU, making it possible for real-time applications.
42
+
43
+
44
+ ## Quick Start
45
+
46
+ ### 🔧 Install from PyPI
47
+ ``` sh
48
+ pip install voxcpm
49
+ ```
50
+ ### 1. Model Download (Optional)
51
+ By default, when you first run the script, the model will be downloaded automatically, but you can also download the model in advance.
52
+ - Download VoxCPM-0.5B
53
+ ```
54
+ from huggingface_hub import snapshot_download
55
+ snapshot_download("openbmb/VoxCPM-0.5B",local_files_only=local_files_only)
56
+ ```
57
+ - Download ZipEnhancer and SenseVoice-Small. We use ZipEnhancer to enhance speech prompts and SenseVoice-Small for speech prompt ASR in the web demo.
58
+ ```
59
+ from modelscope import snapshot_download
60
+ snapshot_download('iic/speech_zipenhancer_ans_multiloss_16k_base')
61
+ snapshot_download('iic/SenseVoiceSmall')
62
+ ```
63
+
64
+ ### 2. Basic Usage
65
+ ```python
66
+ import soundfile as sf
67
+ from voxcpm import VoxCPM
68
+
69
+ model = VoxCPM.from_pretrained("openbmb/VoxCPM-0.5B")
70
+
71
+ wav = model.generate(
72
+ text="VoxCPM is an innovative end-to-end TTS model from ModelBest, designed to generate highly expressive speech.",
73
+ prompt_wav_path=None, # optional: path to a prompt speech for voice cloning
74
+ prompt_text=None, # optional: reference text
75
+ cfg_value=2.0, # LM guidance on LocDiT, higher for better adherence to the prompt, but maybe worse
76
+ inference_timesteps=10, # LocDiT inference timesteps, higher for better result, lower for fast speed
77
+ normalize=True, # enable external TN tool
78
+ denoise=True, # enable external Denoise tool
79
+ retry_badcase=True, # enable retrying mode for some bad cases (unstoppable)
80
+ retry_badcase_max_times=3, # maximum retrying times
81
+ retry_badcase_ratio_threshold=6.0, # maximum length restriction for bad case detection (simple but effective), it could be adjusted for slow pace speech
82
+ )
83
+
84
+ sf.write("output.wav", wav, 16000)
85
+ print("saved: output.wav")
86
+ ```
87
+
88
+ ### 3. CLI Usage
89
+
90
+ After installation, the entry point is `voxcpm` (or use `python -m voxcpm.cli`).
91
+
92
+ ```bash
93
+ # 1) Direct synthesis (single text)
94
+ voxcpm --text "Hello VoxCPM" --output out.wav
95
+
96
+ # 2) Voice cloning (reference audio + transcript)
97
+ voxcpm --text "Hello" \
98
+ --prompt-audio path/to/voice.wav \
99
+ --prompt-text "reference transcript" \
100
+ --output out.wav \
101
+ --denoise
102
+
103
+ # 3) Batch processing (one text per line)
104
+ voxcpm --input examples/input.txt --output-dir outs
105
+ # (optional) Batch + cloning
106
+ voxcpm --input examples/input.txt --output-dir outs \
107
+ --prompt-audio path/to/voice.wav \
108
+ --prompt-text "reference transcript" \
109
+ --denoise
110
+
111
+ # 4) Inference parameters (quality/speed)
112
+ voxcpm --text "..." --output out.wav \
113
+ --cfg-value 2.0 --inference-timesteps 10 --normalize
114
+
115
+ # 5) Model loading
116
+ # Prefer local path
117
+ voxcpm --text "..." --output out.wav --model-path /path/to/VoxCPM_model_dir
118
+ # Or from Hugging Face (auto download/cache)
119
+ voxcpm --text "..." --output out.wav \
120
+ --hf-model-id openbmb/VoxCPM-0.5B --cache-dir ~/.cache/huggingface --local-files-only
121
+
122
+ # 6) Denoiser control
123
+ voxcpm --text "..." --output out.wav \
124
+ --no-denoiser --zipenhancer-path iic/speech_zipenhancer_ans_multiloss_16k_base
125
+
126
+ # 7) Help
127
+ voxcpm --help
128
+ python -m voxcpm.cli --help
129
+ ```
130
+
131
+ ### 4. Start web demo
132
+
133
+ You can start the UI interface by running `python app.py`, which allows you to perform Voice Cloning and Voice Creation.
134
+
135
+
136
+
137
+ ## 👩‍🍳 A Voice Chef's Guide
138
+ Welcome to the VoxCPM kitchen! Follow this recipe to cook up perfect generated speech. Let’s begin.
139
+
140
+ ---
141
+ ### 🥚 Step 1: Prepare Your Base Ingredients (Content)
142
+
143
+ First, choose how you’d like to input your text:.
144
+ 1. Regular Text (Classic Mode)
145
+ - ✅ Keep "Text Normalization" ON. Type naturally (e.g., "Hello, world! 123"). The system will automatically process numbers, abbreviations, and punctuation using WeTextProcessing library.
146
+ 2. Phoneme Input (Native Mode)
147
+ - ❌ Turn "Text Normalization" OFF. Enter phoneme text like {HH AH0 L OW1} (EN) or {ni3}{hao3} (ZH) for precise pronunciation control. In this mode, VoxCPM also supports native understanding of other complex non-normalized text—try it out!
148
+
149
+ ---
150
+ ### 🍳 Step 2: Choose Your Flavor Profile (Voice Style)
151
+
152
+ This is the secret sauce that gives your audio its unique sound.
153
+ 1. Cooking with a Prompt Speech (Following a Famous Recipe)
154
+ - A prompt speech provides the desired acoustic characteristics for VoxCPM. The speaker's timbre, speaking style, and even the background sounds and ambiance will be replicated.
155
+ - For a Clean, Studio-Quality Voice:
156
+ - ✅ Enable "Prompt Speech Enhancement". This acts like a noise filter, removing background hiss and rumble to give you a pure, clean voice clone.
157
+ 2. Cooking au Naturel (Letting the Model Improvise)
158
+ - If no reference is provided, VoxCPM becomes a creative chef! It will infer a fitting speaking style based on the text itself, thanks to the text-smartness of its foundation model, MiniCPM-4.
159
+ - Pro Tip: Challenge VoxCPM with any text—poetry, song lyrics, dramatic monologues—it may deliver some interesting results!
160
+
161
+ ---
162
+ ### 🧂 Step 3: The Final Seasoning (Fine-Tuning Your Results)
163
+ You're ready to serve! But for master chefs who want to tweak the flavor, here are two key spices.
164
+ - CFG Value (How Closely to Follow the Recipe)
165
+ - Default: A great starting point.
166
+ - Voice sounds strained or weird? Lower this value. It tells the model to be more relaxed and improvisational, great for expressive prompts.
167
+ - Need maximum clarity and adherence to the text? Raise it slightly to keep the model on a tighter leash.
168
+ - Inference Timesteps (Simmering Time: Quality vs. Speed)
169
+ - Need a quick snack? Use a lower number. Perfect for fast drafts and experiments.
170
+ - Cooking a gourmet meal? Use a higher number. This lets the model "simmer" longer, refining the audio for superior detail and naturalness.
171
+
172
+ ---
173
+ Happy creating! 🎉 Start with the default settings and tweak from there to suit your project. The kitchen is yours!
174
+
175
+
176
+ ---
177
+
178
+
179
+
180
+ ## 📊 Performance Highlights
181
+
182
+ VoxCPM achieves competitive results on public zero-shot TTS benchmarks:
183
+
184
+ ### Seed-TTS-eval Benchmark
185
+
186
+ | Model | Parameters | Open-Source | test-EN | | test-ZH | | test-Hard | |
187
+ |------|------|------|:------------:|:--:|:------------:|:--:|:-------------:|:--:|
188
+ | | | | WER/%⬇ | SIM/%⬆| CER/%⬇| SIM/%⬆ | CER/%⬇ | SIM/%⬆ |
189
+ | MegaTTS3 | 0.5B | ❌ | 2.79 | 77.1 | 1.52 | 79.0 | - | - |
190
+ | DiTAR | 0.6B | ❌ | 1.69 | 73.5 | 1.02 | 75.3 | - | - |
191
+ | CosyVoice3 | 0.5B | ❌ | 2.02 | 71.8 | 1.16 | 78.0 | 6.08 | 75.8 |
192
+ | CosyVoice3 | 1.5B | ❌ | 2.22 | 72.0 | 1.12 | 78.1 | 5.83 | 75.8 |
193
+ | Seed-TTS | - | ❌ | 2.25 | 76.2 | 1.12 | 79.6 | 7.59 | 77.6 |
194
+ | MiniMax-Speech | - | ❌ | 1.65 | 69.2 | 0.83 | 78.3 | - | - |
195
+ | CosyVoice | 0.3B | ✅ | 4.29 | 60.9 | 3.63 | 72.3 | 11.75 | 70.9 |
196
+ | CosyVoice2 | 0.5B | ✅ | 3.09 | 65.9 | 1.38 | 75.7 | **6.83** | 72.4 |
197
+ | F5-TTS | 0.3B | ✅ | 2.00 | 67.0 | 1.53 | 76.0 | 8.67 | 71.3 |
198
+ | SparkTTS | 0.5B | ✅ | 3.14 | 57.3 | 1.54 | 66.0 | - | - |
199
+ | FireRedTTS | 0.5B | ✅ | 3.82 | 46.0 | 1.51 | 63.5 | 17.45 | 62.1 |
200
+ | FireRedTTS-2 | 1.5B | ✅ | 1.95 | 66.5 | 1.14 | 73.6 | - | - |
201
+ | Qwen2.5-Omni | 7B | ✅ | 2.72 | 63.2 | 1.70 | 75.2 | 7.97 | **74.7** |
202
+ | OpenAudio-s1-mini | 0.5B | ✅ | 1.94 | 55.0 | 1.18 | 68.5 | - | - |
203
+ | IndexTTS2 | 1.5B | ✅ | 2.23 | 70.6 | 1.03 | 76.5 | - | - |
204
+ | VibeVoice | 1.5B | ✅ | 3.04 | 68.9 | 1.16 | 74.4 | - | - |
205
+ | HiggsAudio-v2 | 3B | ✅ | 2.44 | 67.7 | 1.50 | 74.0 | - | - |
206
+ | **VoxCPM** | 0.5B | ✅ | **1.85** | **72.9** | **0.93** | **77.2** | 8.87 | 73.0 |
207
+
208
+
209
+ ### CV3-eval Benchmark
210
+
211
+ | Model | zh | en | hard-zh | | | hard-en | | |
212
+ |-------|:--:|:--:|:-------:|:--:|:--:|:-------:|:--:|:--:|
213
+ | | CER/%⬇ | WER/%⬇ | CER/%⬇ | SIM/%⬆ | DNSMOS⬆ | WER/%⬇ | SIM/%⬆ | DNSMOS⬆ |
214
+ | F5-TTS | 5.47 | 8.90 | - | - | - | - | - | - |
215
+ | SparkTTS | 5.15 | 11.0 | - | - | - | - | - | - |
216
+ | GPT-SoVits | 7.34 | 12.5 | - | - | - | - | - | - |
217
+ | CosyVoice2 | 4.08 | 6.32 | 12.58 | 72.6 | 3.81 | 11.96 | 66.7 | 3.95 |
218
+ | OpenAudio-s1-mini | 4.00 | 5.54 | 18.1 | 58.2 | 3.77 | 12.4 | 55.7 | 3.89 |
219
+ | IndexTTS2 | 3.58 | 4.45 | 12.8 | 74.6 | 3.65 | - | - | - |
220
+ | HiggsAudio-v2 | 9.54 | 7.89 | 41.0 | 60.2 | 3.39 | 10.3 | 61.8 | 3.68 |
221
+ | CosyVoice3-0.5B | 3.89 | 5.24 | 14.15 | 78.6 | 3.75 | 9.04 | 75.9 | 3.92 |
222
+ | CosyVoice3-1.5B | 3.91 | 4.99 | 9.77 | 78.5 | 3.79 | 10.55 | 76.1 | 3.95 |
223
+ | **VoxCPM** | **3.40** | **4.04** | 12.9 | 66.1 | 3.59 | **7.89** | 64.3 | 3.74 |
224
+
225
+
226
+ ## ⚠️ Risks and limitations
227
+ - General Model Behavior: While VoxCPM has been trained on a large-scale dataset, it may still produce outputs that are unexpected, biased, or contain artifacts.
228
+ - Potential for Misuse of Voice Cloning: VoxCPM's powerful zero-shot voice cloning capability can generate highly realistic synthetic speech. This technology could be misused for creating convincing deepfakes for purposes of impersonation, fraud, or spreading disinformation. Users of this model must not use it to create content that infringes upon the rights of individuals. It is strictly forbidden to use VoxCPM for any illegal or unethical purposes. We strongly recommend that any publicly shared content generated with this model be clearly marked as AI-generated.
229
+ - Current Technical Limitations: Although generally stable, the model may occasionally exhibit instability, especially with very long or expressive inputs. Furthermore, the current version offers limited direct control over specific speech attributes like emotion or speaking style.
230
+ - Bilingual Model: VoxCPM is trained primarily on Chinese and English data. Performance on other languages is not guaranteed and may result in unpredictable or low-quality audio.
231
+ - This model is released for research and development purposes only. We do not recommend its use in production or commercial applications without rigorous testing and safety evaluations. Please use VoxCPM responsibly.
232
+
233
+
234
+
235
+ ## 📄 License
236
+ The VoxCPM model weights and code are open-sourced under the Apache-2.0 license.
237
+
238
+
models/VoxCPM-0.5B/assets/modelbest_logo.png ADDED
models/VoxCPM-0.5B/assets/thuhcsi_logo.png ADDED
models/VoxCPM-0.5B/assets/voxcpm_logo.png ADDED
models/VoxCPM-0.5B/config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "voxcpm",
3
+ "lm_config": {
4
+ "bos_token_id": 1,
5
+ "eos_token_id": 2,
6
+ "hidden_size": 1024,
7
+ "intermediate_size": 4096,
8
+ "max_position_embeddings": 32768,
9
+ "num_attention_heads": 16,
10
+ "num_hidden_layers": 24,
11
+ "num_key_value_heads": 2,
12
+ "rms_norm_eps": 1e-05,
13
+ "rope_theta": 10000,
14
+ "rope_scaling": {
15
+ "type": "longrope",
16
+ "long_factor": [1.0004360675811768, 1.0668443441390991, 1.1631425619125366, 1.3025742769241333, 1.5040205717086792, 1.7941505908966064, 2.2101221084594727, 2.802666664123535, 3.6389970779418945, 4.804192543029785, 6.39855432510376, 8.527148246765137, 11.277542114257812, 14.684998512268066, 18.69317054748535, 23.13019371032715, 27.72362518310547, 32.1606559753418, 36.168827056884766, 39.57627868652344, 42.32667541503906, 44.45526885986328, 46.04962921142578, 47.21482849121094, 48.05115509033203, 48.64370346069336, 49.05967712402344, 49.34980392456055, 49.551246643066406, 49.69068145751953, 49.78697967529297, 49.85338592529297],
17
+ "short_factor": [1.0004360675811768, 1.0668443441390991, 1.1631425619125366, 1.3025742769241333, 1.5040205717086792, 1.7941505908966064, 2.2101221084594727, 2.802666664123535, 3.6389970779418945, 4.804192543029785, 6.39855432510376, 8.527148246765137, 11.277542114257812, 14.684998512268066, 18.69317054748535, 23.13019371032715, 27.72362518310547, 32.1606559753418, 36.168827056884766, 39.57627868652344, 42.32667541503906, 44.45526885986328, 46.04962921142578, 47.21482849121094, 48.05115509033203, 48.64370346069336, 49.05967712402344, 49.34980392456055, 49.551246643066406, 49.69068145751953, 49.78697967529297, 49.85338592529297],
18
+ "original_max_position_embeddings": 32768
19
+ },
20
+ "vocab_size": 73448,
21
+ "scale_emb": 12,
22
+ "dim_model_base": 256,
23
+ "scale_depth": 1.4,
24
+ "use_mup": false
25
+ },
26
+ "patch_size": 2,
27
+ "feat_dim": 64,
28
+ "scalar_quantization_latent_dim": 256,
29
+ "scalar_quantization_scale": 9,
30
+ "residual_lm_num_layers": 6,
31
+ "encoder_config": {
32
+ "hidden_dim": 1024,
33
+ "ffn_dim": 4096,
34
+ "num_heads": 16,
35
+ "num_layers": 4
36
+ },
37
+ "dit_config": {
38
+ "hidden_dim": 1024,
39
+ "ffn_dim": 4096,
40
+ "num_heads": 16,
41
+ "num_layers": 4,
42
+ "cfm_config": {
43
+ "sigma_min": 1e-06,
44
+ "solver": "euler",
45
+ "t_scheduler": "log-norm",
46
+ "inference_cfg_rate": 2.0
47
+ }
48
+ },
49
+ "max_length": 4096,
50
+ "device": "cuda",
51
+ "dtype": "bfloat16"
52
+ }
models/VoxCPM-0.5B/special_tokens_map.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<|im_end|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<|im_start|>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ {
18
+ "content": "<|tool_call|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ {
25
+ "content": "<|execute_start|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ {
32
+ "content": "<|execute_end|>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ },
38
+ {
39
+ "content": "<|fim_prefix|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false
44
+ },
45
+ {
46
+ "content": "<|fim_middle|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false
51
+ },
52
+ {
53
+ "content": "<|fim_suffix|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false
58
+ }
59
+ ],
60
+ "bos_token": {
61
+ "content": "<s>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false
66
+ },
67
+ "eos_token": {
68
+ "content": "</s>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false
73
+ },
74
+ "unk_token": {
75
+ "content": "<unk>",
76
+ "lstrip": false,
77
+ "normalized": false,
78
+ "rstrip": false,
79
+ "single_word": false
80
+ }
81
+ }
models/VoxCPM-0.5B/tokenizer_config.json ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "101": {
30
+ "content": "<|audio_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "102": {
38
+ "content": "<|audio_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "103": {
46
+ "content": "<|audio_prompt_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "104": {
54
+ "content": "<|audio_prompt_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "105": {
62
+ "content": "<|background|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "106": {
70
+ "content": "<|/background|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "107": {
78
+ "content": "<|characters|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "108": {
86
+ "content": "<|/characters|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "109": {
94
+ "content": "<|speaker_id|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "110": {
102
+ "content": "<|/speaker_id|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "111": {
110
+ "content": "<|span|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "112": {
118
+ "content": "<|/span|>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": true
124
+ },
125
+ "73440": {
126
+ "content": "<|im_end|>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": true
132
+ },
133
+ "73441": {
134
+ "content": "<|im_start|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": true
140
+ },
141
+ "73442": {
142
+ "content": "<|tool_call|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": true
148
+ },
149
+ "73443": {
150
+ "content": "<|execute_start|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": true
156
+ },
157
+ "73444": {
158
+ "content": "<|execute_end|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": true
164
+ },
165
+ "73445": {
166
+ "content": "<|fim_prefix|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": true
172
+ },
173
+ "73446": {
174
+ "content": "<|fim_middle|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": true
180
+ },
181
+ "73447": {
182
+ "content": "<|fim_suffix|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ }
189
+ },
190
+ "additional_special_tokens": [
191
+ "<|im_end|>",
192
+ "<|im_start|>",
193
+ "<|tool_call|>",
194
+ "<|execute_start|>",
195
+ "<|execute_end|>",
196
+ "<|fim_prefix|>",
197
+ "<|fim_middle|>",
198
+ "<|fim_suffix|>"
199
+ ],
200
+ "bos_token": "<s>",
201
+ "clean_up_tokenization_spaces": false,
202
+ "eos_token": "<|im_end|>",
203
+ "legacy": true,
204
+ "model_max_length": 1000000000000000019884624838656,
205
+ "pad_token": null,
206
+ "sp_model_kwargs": {},
207
+ "spaces_between_special_tokens": false,
208
+ "tokenizer_class": "LlamaTokenizer",
209
+ "unk_token": "<unk>",
210
+ "use_default_system_prompt": false,
211
+ "chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
212
+ }
models/dsp/config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DacModel"
4
+ ],
5
+ "codebook_dim": 8,
6
+ "codebook_loss_weight": 1.0,
7
+ "codebook_size": 1024,
8
+ "commitment_loss_weight": 0.25,
9
+ "decoder_hidden_size": 1536,
10
+ "downsampling_ratios": [
11
+ 2,
12
+ 4,
13
+ 5,
14
+ 8
15
+ ],
16
+ "encoder_hidden_size": 64,
17
+ "hidden_size": 1024,
18
+ "hop_length": 512,
19
+ "model_type": "dac",
20
+ "n_codebooks": 4,
21
+ "quantizer_dropout": 0.0,
22
+ "sampling_rate": 24000,
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.42.0.dev0",
25
+ "upsampling_ratios": [
26
+ 8,
27
+ 5,
28
+ 4,
29
+ 2
30
+ ]
31
+ }
models/iic/SenseVoiceSmall/.msc ADDED
Binary file (1.35 kB). View file
 
models/iic/SenseVoiceSmall/.mv ADDED
@@ -0,0 +1 @@
 
 
1
+ Revision:master,CreatedAt:1727321787
models/iic/SenseVoiceSmall/README.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ frameworks:
3
+ - Pytorch
4
+ license: Apache License 2.0
5
+ tasks:
6
+ - auto-speech-recognition
7
+
8
+ #model-type:
9
+ ##如 gpt、phi、llama、chatglm、baichuan 等
10
+ #- gpt
11
+
12
+ #domain:
13
+ ##如 nlp、cv、audio、multi-modal
14
+ #- nlp
15
+
16
+ #language:
17
+ ##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
18
+ #- cn
19
+
20
+ #metrics:
21
+ ##如 CIDEr、Blue、ROUGE 等
22
+ #- CIDEr
23
+
24
+ #tags:
25
+ ##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
26
+ #- pretrained
27
+
28
+ #tools:
29
+ ##如 vllm、fastchat、llamacpp、AdaSeq 等
30
+ #- vllm
31
+ ---
32
+
33
+ # Highlights
34
+ **SenseVoice**专注于高精度多语言语音识别、情感辨识和音频事件检测
35
+ - **多语言识别:** 采用超过40万小时数据训练,支持超过50种语言,识别效果上优于Whisper模型。
36
+ - **富文本识别:**
37
+ - 具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。
38
+ - 支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。
39
+ - **高效推理:** SenseVoice-Small模型采用非自回归端到端框架,推理延迟极低,10s音频推理仅耗时70ms,15倍优于Whisper-Large。
40
+ - **微调定制:** 具备便捷的微调脚本与策略,方便用户根据业务场景修复长尾样本问题。
41
+ - **服务部署:** 具有完整的服务部署链路,支持多并发请求,支持客户端语言有,python、c++、html、java与c#等。
42
+
43
+
44
+ ## <strong>[SenseVoice开源项目介绍](https://github.com/FunAudioLLM/SenseVoice)</strong>
45
+ <strong>[SenseVoice](https://github.com/FunAudioLLM/SenseVoice)</strong>开源模型是多语言音频理解模型,具有包括语音识别、语种识别、语音情感识别,声学事件检测能力。
46
+
47
+ [**github仓库**](https://github.com/FunAudioLLM/SenseVoice)
48
+ | [**最新动态**](https://github.com/FunAudioLLM/SenseVoice/blob/main/README_zh.md#%E6%9C%80%E6%96%B0%E5%8A%A8%E6%80%81)
49
+ | [**环境安装**](https://github.com/FunAudioLLM/SenseVoice/blob/main/README_zh.md#%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85)
50
+
51
+ # 模型结构图
52
+ SenseVoice多语言音频理解模型,支持语音识别、语种识别、语音情感识别、声学事件检测、逆文本正则化等能力,采用工业级数十万小时的标注音频进行模型训练,保证了模型的通用识别效果。模型可以被应用于中文、粤语、英语、日语、韩语音频识别,并输出带有情感和事件的富文本转写结果。
53
+
54
+ <p align="center">
55
+ <img src="fig/sensevoice.png" alt="SenseVoice模型结构" width="1500" />
56
+ </p>
57
+
58
+ SenseVoice-Small是基于非自回归端到端框架模型,为了指定任务,我们在语音特征前添加四个嵌入作为输入传递给编码器:
59
+ - LID:用于预测音频语种标签。
60
+ - SER:用于预测音频情感标签。
61
+ - AED:用于预测音频包含的事件标签。
62
+ - ITN:用于指定识别输出文本是否进行逆文本正则化。
63
+
64
+
65
+ # 依赖环境
66
+
67
+ 推理之前,请务必更新funasr与modelscope版本
68
+
69
+ ```shell
70
+ pip install -U funasr modelscope
71
+ ```
72
+
73
+ # 用法
74
+
75
+
76
+ ## 推理
77
+
78
+ ### modelscope pipeline推理
79
+ ```python
80
+ from modelscope.pipelines import pipeline
81
+ from modelscope.utils.constant import Tasks
82
+
83
+ inference_pipeline = pipeline(
84
+ task=Tasks.auto_speech_recognition,
85
+ model='iic/SenseVoiceSmall',
86
+ model_revision="master",
87
+ device="cuda:0",)
88
+
89
+ rec_result = inference_pipeline('https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav')
90
+ print(rec_result)
91
+ ```
92
+
93
+ ### 使用funasr推理
94
+
95
+ 支持任意格式音频输入,支持任意时长输入
96
+
97
+ ```python
98
+ from funasr import AutoModel
99
+ from funasr.utils.postprocess_utils import rich_transcription_postprocess
100
+
101
+ model_dir = "iic/SenseVoiceSmall"
102
+
103
+
104
+ model = AutoModel(
105
+ model=model_dir,
106
+ trust_remote_code=True,
107
+ remote_code="./model.py",
108
+ vad_model="fsmn-vad",
109
+ vad_kwargs={"max_single_segment_time": 30000},
110
+ device="cuda:0",
111
+ )
112
+
113
+ # en
114
+ res = model.generate(
115
+ input=f"{model.model_path}/example/en.mp3",
116
+ cache={},
117
+ language="auto", # "zn", "en", "yue", "ja", "ko", "nospeech"
118
+ use_itn=True,
119
+ batch_size_s=60,
120
+ merge_vad=True, #
121
+ merge_length_s=15,
122
+ )
123
+ text = rich_transcription_postprocess(res[0]["text"])
124
+ print(text)
125
+ ```
126
+ 参数说明:
127
+ - `model_dir`:模型名称,或本地磁盘中的模型路径。
128
+ - `trust_remote_code`:
129
+ - `True`表示model代码实现从`remote_code`处加载,`remote_code`指定`model`具体代码的位置(例如,当前目录下的`model.py`),支持绝对路径与相对路径,以及网络url。
130
+ - `False`表示,model代码实现为 [FunASR](https://github.com/modelscope/FunASR) 内部集成版本,此时修改当前目录下的`model.py`不会生效,因为加载的是funasr内部版本,模型代码[点击查看](https://github.com/modelscope/FunASR/tree/main/funasr/models/sense_voice)。
131
+ - `vad_model`:表示开启VAD,VAD的作用是将长音频切割成短音频,此时推理耗时包括了VAD与SenseVoice总耗时,为链路耗时,如果需要单独测试SenseVoice模型耗时,可以关闭VAD模型。
132
+ - `vad_kwargs`:表示VAD模型配置,`max_single_segment_time`: 表示`vad_model`最大切割音频时长, 单位是毫秒ms。
133
+ - `use_itn`:输出结果中是否包含标点与逆文本正则化。
134
+ - `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。
135
+ - `merge_vad`:是否将 vad 模型切割的短音频碎片合成,合并后长度为`merge_length_s`,单位为秒s。
136
+ - `ban_emo_unk`:禁用emo_unk标签,禁用后所有的句子都会被赋与情感标签。默认`False`
137
+
138
+ ```python
139
+ model = AutoModel(model=model_dir, trust_remote_code=True, device="cuda:0")
140
+
141
+ res = model.generate(
142
+ input=f"{model.model_path}/example/en.mp3",
143
+ cache={},
144
+ language="auto", # "zn", "en", "yue", "ja", "ko", "nospeech"
145
+ use_itn=True,
146
+ batch_size=64,
147
+ )
148
+ ```
149
+
150
+ 更多详细用法,请参考 [文档](https://github.com/modelscope/FunASR/blob/main/docs/tutorial/README.md)
151
+
152
+
153
+
154
+ ## 模型下载
155
+ 上面代码会自动下载模型,如果您需要离线下载好模型,可以通过下面代码,手动下载,之后指定模型本地路径即可。
156
+
157
+ SDK下载
158
+ ```bash
159
+ #安装ModelScope
160
+ pip install modelscope
161
+ ```
162
+ ```python
163
+ #SDK模型下载
164
+ from modelscope import snapshot_download
165
+ model_dir = snapshot_download('iic/SenseVoiceSmall')
166
+ ```
167
+ Git下载
168
+ ```
169
+ #Git模型下载
170
+ git clone https://www.modelscope.cn/iic/SenseVoiceSmall.git
171
+ ```
172
+
173
+ ## 服务部署
174
+
175
+ Undo
176
+
177
+ # Performance
178
+
179
+ ## 语音识别效果
180
+ 我们在开源基准数据集(包括 AISHELL-1、AISHELL-2、Wenetspeech、Librispeech和Common Voice)上比较了SenseVoice与Whisper的多语言语音识别性能和推理效率。在中文和粤语识别效果上,SenseVoice-Small模型具有明显的效果优势。
181
+
182
+ <p align="center">
183
+ <img src="fig/asr_results.png" alt="SenseVoice模型在开源测试集上的表现" width="2500" />
184
+ </p>
185
+
186
+
187
+
188
+ ## 情感识别效果
189
+ 由于目前缺乏被广泛使用的情感识别测试指标和方法,我们在多个测试集的多种指标进行测试,并与近年来Benchmark上的多个结果进行了全面的对比。所选取的测试集同时包含中文/英文两种语言以及表演、影视剧、自然对话等多种风格的数据,在不进行目标数据微调的前提下,SenseVoice能够在测试数据上达到和超过目前最佳情感识别模型的效果。
190
+
191
+ <p align="center">
192
+ <img src="fig/ser_table.png" alt="SenseVoice模型SER效果1" width="1500" />
193
+ </p>
194
+
195
+ 同时,我们还在测试集上对多个开源情感识别模型进行对比,结果表明,SenseVoice-Large模型可以在几乎所有数据上都达到了最佳效果,而SenseVoice-Small模型同样可以在多数数据集上取得超越其他开源模型的效果。
196
+
197
+ <p align="center">
198
+ <img src="fig/ser_figure.png" alt="SenseVoice模型SER效果2" width="500" />
199
+ </p>
200
+
201
+ ## 事件检测效果
202
+
203
+ 尽管SenseVoice只在语音数据上进行训练,它仍然可以作为事件检测模型进行单独使用。我们在环境音分类ESC-50数据集上与目前业内广泛使用的BEATS与PANN模型的效果进行了对比。SenseVoice模型能够在这些任务上取得较好的效果,但受限于训练数据与训练方式,其事件分类效果专业的事件检测模型相比仍然有一定的差距。
204
+
205
+ <p align="center">
206
+ <img src="fig/aed_figure.png" alt="SenseVoice模型AED效果" width="500" />
207
+ </p>
208
+
209
+
210
+
211
+ ## 推理效率
212
+ SenseVoice-Small模型采用非自回归端到端架构,推理延迟极低。在参数量与Whisper-Small模型相当的情况下,比Whisper-Small模型推理速度快7倍,比Whisper-Large模型快17倍。同时SenseVoice-small模型在音频时长增加的情况下,推理耗时也无明显增加。
213
+
214
+
215
+ <p align="center">
216
+ <img src="fig/inference.png" alt="SenseVoice模型的推理效率" width="1500" />
217
+ </p>
218
+
219
+ <p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>
models/iic/SenseVoiceSmall/am.mvn ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <Nnet>
2
+ <Splice> 560 560
3
+ [ 0 ]
4
+ <AddShift> 560 560
5
+ <LearnRateCoef> 0 [ -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 -8.311879 -8.600912 -9.615928 -10.43595 -11.21292 -11.88333 -12.36243 -12.63706 -12.8818 -12.83066 -12.89103 -12.95666 -13.19763 -13.40598 -13.49113 -13.5546 -13.55639 -13.51915 -13.68284 -13.53289 -13.42107 -13.65519 -13.50713 -13.75251 -13.76715 -13.87408 -13.73109 -13.70412 -13.56073 -13.53488 -13.54895 -13.56228 -13.59408 -13.62047 -13.64198 -13.66109 -13.62669 -13.58297 -13.57387 -13.4739 -13.53063 -13.48348 -13.61047 -13.64716 -13.71546 -13.79184 -13.90614 -14.03098 -14.18205 -14.35881 -14.48419 -14.60172 -14.70591 -14.83362 -14.92122 -15.00622 -15.05122 -15.03119 -14.99028 -14.92302 -14.86927 -14.82691 -14.7972 -14.76909 -14.71356 -14.61277 -14.51696 -14.42252 -14.36405 -14.30451 -14.23161 -14.19851 -14.16633 -14.15649 -14.10504 -13.99518 -13.79562 -13.3996 -12.7767 -11.71208 ]
6
+ <Rescale> 560 560
7
+ <LearnRateCoef> 0 [ 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 0.155775 0.154484 0.1527379 0.1518718 0.1506028 0.1489256 0.147067 0.1447061 0.1436307 0.1443568 0.1451849 0.1455157 0.1452821 0.1445717 0.1439195 0.1435867 0.1436018 0.1438781 0.1442086 0.1448844 0.1454756 0.145663 0.146268 0.1467386 0.1472724 0.147664 0.1480913 0.1483739 0.1488841 0.1493636 0.1497088 0.1500379 0.1502916 0.1505389 0.1506787 0.1507102 0.1505992 0.1505445 0.1505938 0.1508133 0.1509569 0.1512396 0.1514625 0.1516195 0.1516156 0.1515561 0.1514966 0.1513976 0.1512612 0.151076 0.1510596 0.1510431 0.151077 0.1511168 0.1511917 0.151023 0.1508045 0.1505885 0.1503493 0.1502373 0.1501726 0.1500762 0.1500065 0.1499782 0.150057 0.1502658 0.150469 0.1505335 0.1505505 0.1505328 0.1504275 0.1502438 0.1499674 0.1497118 0.1494661 0.1493102 0.1493681 0.1495501 0.1499738 0.1509654 ]
8
+ </Nnet>
models/iic/SenseVoiceSmall/config.yaml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ encoder: SenseVoiceEncoderSmall
2
+ encoder_conf:
3
+ output_size: 512
4
+ attention_heads: 4
5
+ linear_units: 2048
6
+ num_blocks: 50
7
+ tp_blocks: 20
8
+ dropout_rate: 0.1
9
+ positional_dropout_rate: 0.1
10
+ attention_dropout_rate: 0.1
11
+ input_layer: pe
12
+ pos_enc_class: SinusoidalPositionEncoder
13
+ normalize_before: true
14
+ kernel_size: 11
15
+ sanm_shfit: 0
16
+ selfattention_layer_type: sanm
17
+
18
+
19
+ model: SenseVoiceSmall
20
+ model_conf:
21
+ length_normalized_loss: true
22
+ sos: 1
23
+ eos: 2
24
+ ignore_id: -1
25
+
26
+ tokenizer: SentencepiecesTokenizer
27
+ tokenizer_conf:
28
+ bpemodel: null
29
+ unk_symbol: <unk>
30
+ split_with_space: true
31
+
32
+ frontend: WavFrontend
33
+ frontend_conf:
34
+ fs: 16000
35
+ window: hamming
36
+ n_mels: 80
37
+ frame_length: 25
38
+ frame_shift: 10
39
+ lfr_m: 7
40
+ lfr_n: 6
41
+ cmvn_file: null
42
+
43
+
44
+ dataset: SenseVoiceCTCDataset
45
+ dataset_conf:
46
+ index_ds: IndexDSJsonl
47
+ batch_sampler: EspnetStyleBatchSampler
48
+ data_split_num: 32
49
+ batch_type: token
50
+ batch_size: 14000
51
+ max_token_length: 2000
52
+ min_token_length: 60
53
+ max_source_length: 2000
54
+ min_source_length: 60
55
+ max_target_length: 200
56
+ min_target_length: 0
57
+ shuffle: true
58
+ num_workers: 4
59
+ sos: ${model_conf.sos}
60
+ eos: ${model_conf.eos}
61
+ IndexDSJsonl: IndexDSJsonl
62
+ retry: 20
63
+
64
+ train_conf:
65
+ accum_grad: 1
66
+ grad_clip: 5
67
+ max_epoch: 20
68
+ keep_nbest_models: 10
69
+ avg_nbest_model: 10
70
+ log_interval: 100
71
+ resume: true
72
+ validate_interval: 10000
73
+ save_checkpoint_interval: 10000
74
+
75
+ optim: adamw
76
+ optim_conf:
77
+ lr: 0.00002
78
+ scheduler: warmuplr
79
+ scheduler_conf:
80
+ warmup_steps: 25000
81
+
82
+ specaug: SpecAugLFR
83
+ specaug_conf:
84
+ apply_time_warp: false
85
+ time_warp_window: 5
86
+ time_warp_mode: bicubic
87
+ apply_freq_mask: true
88
+ freq_mask_width_range:
89
+ - 0
90
+ - 30
91
+ lfr_rate: 6
92
+ num_freq_mask: 1
93
+ apply_time_mask: true
94
+ time_mask_width_range:
95
+ - 0
96
+ - 12
97
+ num_time_mask: 1
models/iic/SenseVoiceSmall/configuration.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task" : "auto-speech-recognition",
4
+ "model": {"type" : "funasr"},
5
+ "pipeline": {"type":"funasr-pipeline"},
6
+ "model_name_in_hub": {
7
+ "ms":"",
8
+ "hf":""},
9
+ "file_path_metas": {
10
+ "init_param":"model.pt",
11
+ "config":"config.yaml",
12
+ "tokenizer_conf": {"bpemodel": "chn_jpn_yue_eng_ko_spectok.bpe.model"},
13
+ "frontend_conf":{"cmvn_file": "am.mvn"}}
14
+ }
models/iic/SenseVoiceSmall/tokens.json ADDED
The diff for this file is too large to render. See raw diff
 
models/iic/speech_zipenhancer_ans_multiloss_16k_base/description/model.jpg ADDED
models/v10/config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "models/v10",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 133309,
9
+ "eos_token_id": 133310,
10
+ "head_dim": 64,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2048,
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": 32,
19
+ "num_hidden_layers": 16,
20
+ "num_key_value_heads": 8,
21
+ "pretraining_tp": 1,
22
+ "rms_norm_eps": 1e-05,
23
+ "rope_scaling": {
24
+ "factor": 32.0,
25
+ "high_freq_factor": 4.0,
26
+ "low_freq_factor": 1.0,
27
+ "original_max_position_embeddings": 8192,
28
+ "rope_type": "llama3"
29
+ },
30
+ "rope_theta": 500000.0,
31
+ "tie_word_embeddings": true,
32
+ "torch_dtype": "bfloat16",
33
+ "transformers_version": "4.48.0",
34
+ "use_cache": true,
35
+ "vocab_size": 134400
36
+ }
models/v10/special_tokens_map.json ADDED
The diff for this file is too large to render. See raw diff
 
models/v10/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ transformers==4.48.3
2
+ pydantic==2.11.4
3
+ numpy==2.2.5
4
+ torch==2.6.0
5
+ torchaudio==2.6.0
6
+ torchvision==0.21.0
7
+ fastapi==0.115.12
8
+ uvicorn==0.34.2
9
+ librosa==0.11.0
10
+ openai-whisper==20240930
11
+ soundfile==0.13.1
12
+ accelerate==0.26.0
13
+ git+https://github.com/vibevoice-community/VibeVoice.git
server.py ADDED
@@ -0,0 +1,854 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, HTTPException
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+ from pydantic import BaseModel, Field
4
+ from transformers import AutoModelForCausalLM, AutoTokenizer
5
+ import traceback
6
+ import whisper
7
+ import librosa
8
+ import numpy as np
9
+ import torch
10
+ import uvicorn
11
+ import base64
12
+ import io
13
+ import re
14
+ import json
15
+ import asyncio
16
+ import tempfile
17
+ import os
18
+ try:
19
+ import edge_tts
20
+ TTS_AVAILABLE = True
21
+ except ImportError:
22
+ TTS_AVAILABLE = False
23
+
24
+ try:
25
+ from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
26
+ from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor
27
+ import soundfile as sf
28
+ VIBEVOICE_AVAILABLE = True
29
+ except ImportError:
30
+ VIBEVOICE_AVAILABLE = False
31
+
32
+ asr_model = whisper.load_model("models/wpt/wpt.pt")
33
+ model_name = "models/Llama-3.2-1B-Instruct"
34
+ tok = AutoTokenizer.from_pretrained(model_name)
35
+ lm = AutoModelForCausalLM.from_pretrained(
36
+ model_name,
37
+ torch_dtype=torch.bfloat16,
38
+ device_map="cuda",
39
+ ).eval()
40
+
41
+ # Initialize VibeVoice model and processor
42
+ vibevoice_model = None
43
+ vibevoice_processor = None
44
+ vibevoice_voice_sample = None
45
+ if VIBEVOICE_AVAILABLE:
46
+ try:
47
+ vibevoice_model_path = os.getenv("VIBEVOICE_MODEL_PATH", "models/VibeVoice-1.5B")
48
+ vibevoice_voice_path = os.getenv("VIBEVOICE_VOICE_PATH", None) # Should be a .wav file, not a directory
49
+ vibevoice_tokenizer_path = os.getenv("VIBEVOICE_TOKENIZER_PATH", "models/Qwen2.5-1.5B")
50
+
51
+ # Convert to absolute paths if they're relative
52
+ if vibevoice_model_path and not os.path.isabs(vibevoice_model_path):
53
+ vibevoice_model_path = os.path.abspath(vibevoice_model_path)
54
+ if vibevoice_tokenizer_path and not os.path.isabs(vibevoice_tokenizer_path):
55
+ vibevoice_tokenizer_path = os.path.abspath(vibevoice_tokenizer_path)
56
+ if vibevoice_voice_path and not os.path.isabs(vibevoice_voice_path):
57
+ vibevoice_voice_path = os.path.abspath(vibevoice_voice_path)
58
+
59
+ # Try to find local Qwen tokenizer if not specified
60
+ if not vibevoice_tokenizer_path:
61
+ # Check common local paths for Qwen models
62
+ local_qwen_paths = [
63
+ "models/Qwen2.5-1.5B",
64
+ "models/Qwen/Qwen2.5-1.5B",
65
+ os.path.join(vibevoice_model_path, "tokenizer"),
66
+ ]
67
+ for qwen_path in local_qwen_paths:
68
+ if os.path.exists(qwen_path) and os.path.isdir(qwen_path):
69
+ # Check if it has tokenizer files
70
+ tokenizer_files = ["tokenizer_config.json", "vocab.json", "merges.txt"]
71
+ if any(os.path.exists(os.path.join(qwen_path, f)) for f in tokenizer_files):
72
+ vibevoice_tokenizer_path = qwen_path
73
+ print(f"Found local Qwen tokenizer at {qwen_path}")
74
+ break
75
+
76
+ print(f"Loading VibeVoice processor from {vibevoice_model_path}")
77
+
78
+ # Modify preprocessor_config.json to use local tokenizer path if specified
79
+ preprocessor_config_path = os.path.join(vibevoice_model_path, "preprocessor_config.json")
80
+ config_modified = False
81
+ original_config = None
82
+ original_tokenizer_path = None
83
+
84
+ if vibevoice_tokenizer_path and os.path.exists(preprocessor_config_path):
85
+ try:
86
+ import json
87
+ # Read the config
88
+ with open(preprocessor_config_path, 'r') as f:
89
+ original_config = json.load(f)
90
+
91
+ # Check if tokenizer path needs to be updated
92
+ original_tokenizer_path = original_config.get("language_model_pretrained_name", "")
93
+ if original_tokenizer_path != vibevoice_tokenizer_path:
94
+ # Update the config to use local path
95
+ original_config["language_model_pretrained_name"] = vibevoice_tokenizer_path
96
+ with open(preprocessor_config_path, 'w') as f:
97
+ json.dump(original_config, f, indent=2)
98
+ config_modified = True
99
+ print(f"Updated preprocessor_config.json to use local tokenizer: {vibevoice_tokenizer_path}")
100
+ except Exception as config_error:
101
+ print(f"Warning: Could not modify preprocessor_config.json: {config_error}")
102
+
103
+ # Pass tokenizer path if specified, otherwise let processor try to load from config
104
+ processor_kwargs = {}
105
+ if vibevoice_tokenizer_path:
106
+ processor_kwargs["language_model_pretrained_name"] = vibevoice_tokenizer_path
107
+ print(f"Using tokenizer from: {vibevoice_tokenizer_path}")
108
+
109
+ try:
110
+ vibevoice_processor = VibeVoiceProcessor.from_pretrained(vibevoice_model_path, **processor_kwargs)
111
+ finally:
112
+ # Restore original config if we modified it
113
+ if config_modified and original_config is not None and original_tokenizer_path is not None:
114
+ try:
115
+ # Restore the original tokenizer path
116
+ original_config["language_model_pretrained_name"] = original_tokenizer_path
117
+ with open(preprocessor_config_path, 'w') as f:
118
+ json.dump(original_config, f, indent=2)
119
+ except Exception:
120
+ pass # Ignore errors when restoring
121
+ # except Exception as tokenizer_error:
122
+ # if "Qwen" in str(tokenizer_error) or "tokenizer" in str(tokenizer_error).lower():
123
+ # print(f"\n⚠️ Tokenizer loading error: {tokenizer_error}")
124
+ # raise
125
+
126
+ print(f"Loading VibeVoice model from {vibevoice_model_path}")
127
+ device = "cuda" if torch.cuda.is_available() else "cpu"
128
+ load_dtype = torch.bfloat16 if device == "cuda" else torch.float32
129
+ attn_impl = "flash_attention_2" if device == "cuda" else "sdpa"
130
+
131
+ try:
132
+ vibevoice_model = VibeVoiceForConditionalGenerationInference.from_pretrained(
133
+ vibevoice_model_path,
134
+ torch_dtype=load_dtype,
135
+ device_map=device if device == "cuda" else None,
136
+ attn_implementation=attn_impl,
137
+ )
138
+ if device != "cuda":
139
+ vibevoice_model.to(device)
140
+ except Exception as e:
141
+ if attn_impl == "flash_attention_2":
142
+ print(f"Failed to load with flash_attention_2, falling back to sdpa: {e}")
143
+ vibevoice_model = VibeVoiceForConditionalGenerationInference.from_pretrained(
144
+ vibevoice_model_path,
145
+ torch_dtype=load_dtype,
146
+ device_map=device if device in ("cuda", "cpu") else None,
147
+ attn_implementation="sdpa",
148
+ )
149
+ if device not in ("cuda", "cpu"):
150
+ vibevoice_model.to(device)
151
+ else:
152
+ raise
153
+
154
+ vibevoice_model.eval()
155
+ vibevoice_model.set_ddpm_inference_steps(num_steps=10)
156
+
157
+ # Load default voice sample if path provided (must be a file, not a directory)
158
+ if vibevoice_voice_path and os.path.exists(vibevoice_voice_path) and os.path.isfile(vibevoice_voice_path):
159
+ print(f"Loading voice sample from {vibevoice_voice_path}")
160
+ try:
161
+ wav, sr = sf.read(vibevoice_voice_path)
162
+ if len(wav.shape) > 1:
163
+ wav = np.mean(wav, axis=1)
164
+ if sr != 24000:
165
+ wav = librosa.resample(wav, orig_sr=sr, target_sr=24000)
166
+ vibevoice_voice_sample = wav.astype(np.float32)
167
+ except Exception as voice_error:
168
+ print(f"Warning: Could not load voice sample from {vibevoice_voice_path}: {voice_error}")
169
+ vibevoice_voice_sample = None
170
+ else:
171
+ # Try to find a default voice in common locations
172
+ default_voice_paths = [
173
+ "/app/spk_001.wav", # Check in /app directory first
174
+ "spk_001.wav", # Relative path
175
+ "/home/user/VibeVoice/demo/voices/en-Alice_woman.wav",
176
+ "demo/voices/en-Alice_woman.wav",
177
+ "VibeVoice/demo/voices/en-Alice_woman.wav",
178
+ ]
179
+ for voice_path in default_voice_paths:
180
+ if os.path.exists(voice_path):
181
+ print(f"Loading default voice sample from {voice_path}")
182
+ wav, sr = sf.read(voice_path)
183
+ if len(wav.shape) > 1:
184
+ wav = np.mean(wav, axis=1)
185
+ if sr != 24000:
186
+ wav = librosa.resample(wav, orig_sr=sr, target_sr=24000)
187
+ vibevoice_voice_sample = wav.astype(np.float32)
188
+ break
189
+
190
+ if vibevoice_voice_sample is None:
191
+ print("Warning: No voice sample found. VibeVoice will work without voice cloning.")
192
+
193
+ print("VibeVoice initialized successfully")
194
+ except Exception as e:
195
+ print(f"Failed to initialize VibeVoice: {e}")
196
+ traceback.print_exc()
197
+ VIBEVOICE_AVAILABLE = False
198
+ vibevoice_model = None
199
+ vibevoice_processor = None
200
+ class EvalHandler:
201
+ def __init__(self):
202
+ self.rule_patterns = {
203
+ 'comma_restriction': re.compile(r'no.*comma|without.*comma', re.IGNORECASE),
204
+ 'placeholder_requirement': re.compile(r'placeholder.*\[.*\]|square.*bracket', re.IGNORECASE),
205
+ 'lowercase_requirement': re.compile(r'lowercase|no.*capital|all.*lowercase', re.IGNORECASE),
206
+ 'capital_frequency': re.compile(r'capital.*letter.*less.*than|capital.*word.*frequency', re.IGNORECASE),
207
+ 'quotation_requirement': re.compile(r'wrap.*quotation|double.*quote', re.IGNORECASE),
208
+ 'json_format': re.compile(r'json.*format|JSON.*output|format.*json', re.IGNORECASE),
209
+ 'word_count': re.compile(r'less.*than.*word|word.*limit|maximum.*word', re.IGNORECASE),
210
+ 'section_requirement': re.compile(r'section.*start|SECTION.*X', re.IGNORECASE),
211
+ 'ending_requirement': re.compile(r'finish.*exact.*phrase|end.*phrase', re.IGNORECASE),
212
+ 'forbidden_words': re.compile(r'not.*allowed|forbidden.*word|without.*word', re.IGNORECASE),
213
+ 'capital_letters_only': re.compile(r'all.*capital|CAPITAL.*letter', re.IGNORECASE)
214
+ }
215
+
216
+ def detect_rules(self, instruction):
217
+ applicable_rules = []
218
+ if self.rule_patterns['comma_restriction'].search(instruction):
219
+ applicable_rules.append('CommaChecker')
220
+ if self.rule_patterns['placeholder_requirement'].search(instruction):
221
+ applicable_rules.append('PlaceholderChecker')
222
+ if self.rule_patterns['lowercase_requirement'].search(instruction):
223
+ applicable_rules.append('LowercaseLettersEnglishChecker')
224
+ if self.rule_patterns['capital_frequency'].search(instruction):
225
+ applicable_rules.append('CapitalWordFrequencyChecker')
226
+ if self.rule_patterns['quotation_requirement'].search(instruction):
227
+ applicable_rules.append('QuotationChecker')
228
+ if self.rule_patterns['json_format'].search(instruction):
229
+ applicable_rules.append('JsonFormat')
230
+ if self.rule_patterns['word_count'].search(instruction):
231
+ applicable_rules.append('NumberOfWords')
232
+ if self.rule_patterns['section_requirement'].search(instruction):
233
+ applicable_rules.append('SectionChecker')
234
+ if self.rule_patterns['ending_requirement'].search(instruction):
235
+ applicable_rules.append('EndChecker')
236
+ if self.rule_patterns['forbidden_words'].search(instruction):
237
+ applicable_rules.append('ForbiddenWords')
238
+ if self.rule_patterns['capital_letters_only'].search(instruction):
239
+ applicable_rules.append('CapitalLettersEnglishChecker')
240
+ return applicable_rules
241
+
242
+ def apply_rule_fix(self, response, rules, instruction= ""):
243
+ for rule in rules:
244
+ if rule == 'CommaChecker':
245
+ response = self._fix_commas(response, instruction)
246
+ elif rule == 'PlaceholderChecker':
247
+ response = self._fix_placeholders(response, instruction)
248
+ elif rule == 'LowercaseLettersEnglishChecker':
249
+ response = self._fix_lowercase(response)
250
+ elif rule == 'CapitalWordFrequencyChecker':
251
+ response = self._fix_capital_frequency(response, instruction)
252
+ elif rule == 'QuotationChecker':
253
+ response = self._fix_quotations(response)
254
+ elif rule == 'JsonFormat':
255
+ response = self._fix_json_format(response, instruction)
256
+ elif rule == 'NumberOfWords':
257
+ response = self._fix_word_count(response, instruction)
258
+ elif rule == 'SectionChecker':
259
+ response = self._fix_sections(response, instruction)
260
+ elif rule == 'EndChecker':
261
+ response = self._fix_ending(response, instruction)
262
+ elif rule == 'ForbiddenWords':
263
+ response = self._fix_forbidden_words(response, instruction)
264
+ elif rule == 'CapitalLettersEnglishChecker':
265
+ response = self._fix_all_capitals(response, instruction)
266
+ return response
267
+
268
+ def _fix_commas(self, response, instruction):
269
+ return response.replace(',', '')
270
+
271
+ def _fix_placeholders(self, response, instruction):
272
+ num_match = re.search(r'at least (\d+)', instruction, re.IGNORECASE)
273
+ if num_match:
274
+ target_count = int(num_match.group(1))
275
+ current_count = len(re.findall(r'\[.*?\]', response))
276
+ words = response.split()
277
+ for i in range(target_count - current_count):
278
+ if i < len(words):
279
+ words[i] = f'[{words[i]}]'
280
+ return ' '.join(words)
281
+ return response
282
+
283
+ def _fix_lowercase(self, response):
284
+ return response.lower()
285
+
286
+ def _fix_capital_frequency(self, response, instruction):
287
+ max_match = re.search(r'less than (\d+)', instruction, re.IGNORECASE)
288
+ if max_match:
289
+ max_capitals = int(max_match.group(1))
290
+ words = response.split()
291
+ capital_count = sum(1 for word in words if word.isupper())
292
+ if capital_count > max_capitals:
293
+ for i, word in enumerate(words):
294
+ if word.isupper() and capital_count > max_capitals:
295
+ words[i] = word.lower()
296
+ capital_count -= 1
297
+ return ' '.join(words)
298
+ return response
299
+
300
+ def _fix_quotations(self, response):
301
+ return f'"{response}"'
302
+
303
+ def _fix_json_format(self, response, instruction):
304
+ return json.dumps({"response": response}, indent=2)
305
+
306
+ def _fix_word_count(self, response, instruction):
307
+ limit_match = re.search(r'less than (\d+)', instruction, re.IGNORECASE)
308
+ if limit_match:
309
+ word_limit = int(limit_match.group(1))
310
+ words = response.split()
311
+
312
+ if len(words) > word_limit:
313
+ return ' '.join(words[:word_limit])
314
+ return response
315
+
316
+ def _fix_sections(self, response, instruction):
317
+ section_match = re.search(r'(\d+) section', instruction, re.IGNORECASE)
318
+ if section_match:
319
+ num_sections = int(section_match.group(1))
320
+ sections = []
321
+
322
+ for i in range(num_sections):
323
+ sections.append(f"SECTION {i+1}:")
324
+ sections.append("This section provides content here.")
325
+
326
+ return '\n\n'.join(sections)
327
+ return response
328
+
329
+ def _fix_ending(self, response, instruction):
330
+ end_match = re.search(r'finish.*with.*phrase[:\s]*([^.!?]*)', instruction, re.IGNORECASE)
331
+ if end_match:
332
+ required_ending = end_match.group(1).strip()
333
+ if not response.endswith(required_ending):
334
+ return response + " " + required_ending
335
+ return response
336
+
337
+ def _fix_forbidden_words(self, response, instruction):
338
+ forbidden_match = re.search(r'without.*word[:\s]*([^.!?]*)', instruction, re.IGNORECASE)
339
+ if forbidden_match:
340
+ forbidden_word = forbidden_match.group(1).strip().lower()
341
+ response = re.sub(re.escape(forbidden_word), '', response, flags=re.IGNORECASE)
342
+ return response.strip()
343
+
344
+ def _fix_all_capitals(self, response, instruction):
345
+ return response.upper()
346
+
347
+ EVAL_HANDLER = EvalHandler()
348
+
349
+ def chat(system_prompt: str, user_prompt: str) -> str:
350
+ """
351
+ Run one turn of chat with a system + user message.
352
+ Extra **gen_kwargs are forwarded to `generate()`.
353
+ """
354
+ try:
355
+ global EVAL_HANDLER
356
+ if EVAL_HANDLER is None:
357
+ EVAL_HANDLER = EvalHandler()
358
+ applicable_rules = EVAL_HANDLER.detect_rules(user_prompt)
359
+ system_prompt_parts = []
360
+ if applicable_rules:
361
+ if 'CommaChecker' in applicable_rules:
362
+ system_prompt_parts.append("Do not use any commas in your response.")
363
+ if 'LowercaseLettersEnglishChecker' in applicable_rules:
364
+ system_prompt_parts.append("Respond in all lowercase letters only.")
365
+ if 'CapitalLettersEnglishChecker' in applicable_rules:
366
+ system_prompt_parts.append("Respond in ALL CAPITAL LETTERS.")
367
+ if 'QuotationChecker' in applicable_rules:
368
+ system_prompt_parts.append("Wrap your entire response in double quotation marks.")
369
+ if 'JsonFormat' in applicable_rules:
370
+ system_prompt_parts.append("Format your response as valid JSON.")
371
+ if 'SectionChecker' in applicable_rules:
372
+ system_prompt_parts.append("Organize your response into clearly marked sections.")
373
+ if system_prompt_parts:
374
+ system_prompt = system_prompt + "\n Follow the instructions given CLOSELY: " + " ".join(system_prompt_parts)
375
+ except Exception as e:
376
+ system_prompt = system_prompt
377
+ messages = [
378
+ {"role": "system", "content": system_prompt},
379
+ {"role": "user", "content": user_prompt},
380
+ ]
381
+ inputs = tok.apply_chat_template(
382
+ messages,
383
+ add_generation_prompt=True,
384
+ return_tensors="pt",
385
+ return_dict=True
386
+ )
387
+ input_ids = inputs["input_ids"].to(lm.device)
388
+ attention_mask = inputs["attention_mask"].to(lm.device)
389
+ with torch.inference_mode():
390
+ output_ids = lm.generate(
391
+ input_ids=input_ids,
392
+ attention_mask=attention_mask,
393
+ pad_token_id=tok.eos_token_id,
394
+ max_new_tokens=2048,
395
+ do_sample=True,
396
+ temperature=0.2,
397
+ repetition_penalty=1.1,
398
+ top_k=100,
399
+ top_p=0.9,
400
+ )
401
+ answer = tok.decode(
402
+ output_ids[0][input_ids.shape[-1]:],
403
+ skip_special_tokens=True,
404
+ clean_up_tokenization_spaces=True,
405
+ )
406
+ return answer.strip()
407
+
408
+ def gt(audio: np.ndarray, sr: int):
409
+ ss = audio.squeeze().astype(np.float32)
410
+ if sr != 16_000:
411
+ ss = librosa.resample(audio, orig_sr=sr, target_sr=16_000)
412
+ result = asr_model.transcribe(ss, fp16=False, language=None)
413
+ transcribed_text = result["text"].strip()
414
+ return transcribed_text
415
+
416
+ def sample(rr: str) -> str:
417
+ if rr.strip() == "": rr = "Hello "
418
+ inputs = tok(rr, return_tensors="pt").to(lm.device)
419
+ with torch.inference_mode():
420
+ out_ids = lm.generate(
421
+ **inputs,
422
+ max_new_tokens=2048,
423
+ do_sample=True,
424
+ temperature=0.2,
425
+ repetition_penalty=1.1,
426
+ top_k=100,
427
+ top_p=0.95,
428
+ )
429
+ return tok.decode(
430
+ out_ids[0][inputs.input_ids.shape[-1] :], skip_special_tokens=True
431
+ )
432
+
433
+ def text_to_speech_vibevoice(text: str) -> np.ndarray:
434
+ """
435
+ Convert text to speech using VibeVoice (synchronous).
436
+
437
+ Args:
438
+ text: Text to convert to speech
439
+
440
+ Returns:
441
+ Audio array as numpy array (mono, 16kHz) or None if failed
442
+ """
443
+ global vibevoice_model, vibevoice_processor, vibevoice_voice_sample
444
+
445
+ if not VIBEVOICE_AVAILABLE or vibevoice_model is None or vibevoice_processor is None:
446
+ return None
447
+
448
+ try:
449
+ if not text or not text.strip():
450
+ return np.zeros(16000, dtype=np.float32)
451
+
452
+ # Format text for VibeVoice (single speaker format)
453
+ # VibeVoice expects each line to have "Speaker X:" prefix
454
+ # Split text into lines and format each line
455
+ lines = text.strip().split('\n')
456
+ formatted_lines = []
457
+ for line in lines:
458
+ line = line.strip()
459
+ if line: # Skip empty lines
460
+ # Add "Speaker 1:" prefix to each non-empty line
461
+ formatted_lines.append(f"Speaker 1: {line}")
462
+ formatted_text = '\n'.join(formatted_lines)
463
+
464
+ # Prepare inputs
465
+ processor_kwargs = {
466
+ "text": [formatted_text],
467
+ "padding": True,
468
+ "return_tensors": "pt",
469
+ "return_attention_mask": True,
470
+ }
471
+
472
+ # Add voice sample if available
473
+ if vibevoice_voice_sample is not None:
474
+ processor_kwargs["voice_samples"] = [[vibevoice_voice_sample]]
475
+
476
+ inputs = vibevoice_processor(**processor_kwargs)
477
+
478
+ # Move tensors to device
479
+ device = next(vibevoice_model.parameters()).device
480
+ for k, v in inputs.items():
481
+ if torch.is_tensor(v):
482
+ inputs[k] = v.to(device)
483
+
484
+ # Generate audio
485
+ with torch.inference_mode():
486
+ outputs = vibevoice_model.generate(
487
+ **inputs,
488
+ max_new_tokens=None,
489
+ cfg_scale=1.3,
490
+ tokenizer=vibevoice_processor.tokenizer,
491
+ generation_config={'do_sample': False},
492
+ verbose=False,
493
+ is_prefill=(vibevoice_voice_sample is not None),
494
+ )
495
+
496
+ # Extract audio from outputs
497
+ if outputs.speech_outputs and outputs.speech_outputs[0] is not None:
498
+ audio_tensor = outputs.speech_outputs[0]
499
+
500
+ # Convert tensor to numpy
501
+ if torch.is_tensor(audio_tensor):
502
+ if audio_tensor.dtype == torch.bfloat16:
503
+ audio_tensor = audio_tensor.float()
504
+ audio_array = audio_tensor.cpu().numpy().astype(np.float32)
505
+ else:
506
+ audio_array = np.array(audio_tensor, dtype=np.float32)
507
+
508
+ # Ensure 1D array
509
+ if len(audio_array.shape) > 1:
510
+ audio_array = audio_array.squeeze()
511
+
512
+ # VibeVoice outputs at 24kHz, resample to 16kHz
513
+ if len(audio_array) > 0:
514
+ audio_array = librosa.resample(audio_array, orig_sr=24000, target_sr=16000)
515
+ return audio_array.astype(np.float32)
516
+ else:
517
+ return np.zeros(16000, dtype=np.float32)
518
+ else:
519
+ return np.zeros(16000, dtype=np.float32)
520
+
521
+ except Exception as e:
522
+ print(f"VibeVoice generation failed: {e}")
523
+ traceback.print_exc()
524
+ return None
525
+
526
+ async def text_to_speech_edge_tts(text: str, voice: str = "en-US-AriaNeural") -> np.ndarray:
527
+ """
528
+ Convert text to speech using edge-tts (async).
529
+
530
+ Args:
531
+ text: Text to convert to speech
532
+ voice: Voice to use (default: en-US-AriaNeural)
533
+
534
+ Returns:
535
+ Audio array as numpy array (mono, 16kHz)
536
+ """
537
+ if not TTS_AVAILABLE:
538
+ raise RuntimeError("edge-tts not available")
539
+
540
+ try:
541
+ # Use the same approach as edge-tts CLI: collect raw MP3 bytes
542
+ communicate = edge_tts.Communicate(text, voice)
543
+ audio_data = b""
544
+ async for chunk in communicate.stream():
545
+ if chunk["type"] == "audio":
546
+ audio_data += chunk["data"]
547
+
548
+ if not audio_data:
549
+ return np.zeros(16000, dtype=np.float32) # 1 second of silence
550
+
551
+ # edge-tts returns MP3-encoded audio bytes (audio/mpeg)
552
+ # We need to decode MP3 to get raw PCM audio
553
+ # Save to temp file (same format as CLI writes), then decode with librosa
554
+ tmp_file_path = None
555
+ try:
556
+ # Create temp file and write MP3 data (same as CLI does)
557
+ with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as tmp_file:
558
+ tmp_file.write(audio_data)
559
+ tmp_file.flush() # Ensure data is written
560
+ tmp_file_path = tmp_file.name
561
+
562
+ # Now load the MP3 file with librosa (librosa can decode MP3 via ffmpeg)
563
+ # sr=None means keep original sample rate, mono=True converts to mono
564
+ audio_array, sample_rate = librosa.load(tmp_file_path, sr=None, mono=True)
565
+
566
+ # edge-tts outputs 24kHz by default, resample to 16kHz
567
+ if sample_rate != 16000:
568
+ audio_array = librosa.resample(audio_array, orig_sr=sample_rate, target_sr=16000)
569
+ sample_rate = 16000
570
+
571
+ return audio_array.astype(np.float32)
572
+ finally:
573
+ # Clean up temp file
574
+ if tmp_file_path and os.path.exists(tmp_file_path):
575
+ try:
576
+ os.unlink(tmp_file_path)
577
+ except Exception:
578
+ pass
579
+
580
+ except Exception as e:
581
+ raise
582
+
583
+ def clean_v2t_response_for_v2v(response_text: str) -> str:
584
+ """
585
+ Post-process v2t response to remove the first two lines before using for t2v.
586
+
587
+ The v2t response typically contains:
588
+ - Line 1: The actual response text (often the input prompt repeated)
589
+ - Line 2: Injected scoring line (e.g., "As an answer 5 points with scale from 5 to 10...")
590
+ - Line 3+: The actual useful response content
591
+
592
+ This function removes the first two lines to get the clean response for TTS.
593
+
594
+ Args:
595
+ response_text: Full response text from v2t endpoint
596
+
597
+ Returns:
598
+ Cleaned text with first two lines removed
599
+ """
600
+ if not response_text:
601
+ return ""
602
+
603
+ lines = response_text.split("\n")
604
+
605
+ # Remove first two lines if there are at least 3 lines
606
+ if len(lines) >= 3:
607
+ # Skip first two lines, keep the rest
608
+ cleaned_lines = lines[2:]
609
+ cleaned_text = "\n".join(cleaned_lines).strip()
610
+
611
+ # If cleaned text is empty, fallback to original (minus first line)
612
+ if not cleaned_text and len(lines) >= 2:
613
+ cleaned_text = "\n".join(lines[1:]).strip()
614
+
615
+ # If still empty, use original
616
+ if not cleaned_text:
617
+ cleaned_text = response_text.strip()
618
+
619
+ return cleaned_text
620
+ elif len(lines) == 2:
621
+ # Only two lines, remove first one
622
+ cleaned_text = lines[1].strip()
623
+ return cleaned_text
624
+ else:
625
+ # Single line or empty, return as is
626
+ return response_text.strip()
627
+
628
+
629
+ def clean_text_for_tts_with_llm(text: str) -> str:
630
+ """
631
+ Use LLM to intelligently clean text for text-to-speech while preserving important content.
632
+
633
+ This function sends the text to the LLM with instructions to:
634
+ - Remove unicode characters, symbols, and formatting that don't contribute to speech
635
+ - Preserve important content like math equations (convert to spoken form)
636
+ - Keep all meaningful words, numbers, and essential punctuation
637
+ - Make the text natural and clear for TTS
638
+
639
+ Args:
640
+ text: Text to clean for TTS
641
+
642
+ Returns:
643
+ Cleaned text optimized for text-to-speech
644
+ """
645
+ if not text or not text.strip():
646
+ return ""
647
+
648
+ global tok, lm
649
+ if tok is None or lm is None:
650
+ return text
651
+
652
+ try:
653
+ # System prompt for cleaning text for TTS
654
+ system_prompt = """You are a text cleaning assistant. Your task is to clean text for text-to-speech (TTS) conversion.
655
+
656
+ IMPORTANT RULES:
657
+ 1. Remove all unicode characters, special symbols, and formatting that don't contribute to speech
658
+ 2. PRESERVE important content:
659
+ - Math equations: Convert them to spoken form (e.g., "x squared plus y equals 5" instead of "x² + y = 5")
660
+ - Numbers: Keep all numbers and convert them to natural speech format
661
+ - Important punctuation: Keep periods, commas, question marks, exclamation marks for natural speech flow
662
+ 3. Remove markdown formatting, asterisks, underscores, brackets, etc. that are not needed for speech
663
+ 4. Keep all meaningful words, letters, and essential content
664
+ 5. Make the text natural, clear, and easy to read aloud
665
+ 6. Do NOT remove any actual content or meaning from the text
666
+ 7. Convert any special formatting to natural spoken language
667
+
668
+ Return ONLY the cleaned text, nothing else."""
669
+
670
+ user_prompt = f"Clean this text for text-to-speech:\n\n{text}"
671
+
672
+ # Use the chat function to get cleaned text
673
+ cleaned_text = chat(system_prompt, user_prompt)
674
+
675
+ # Remove any potential wrapper text the LLM might add
676
+ cleaned_text = cleaned_text.strip()
677
+
678
+ # If the cleaned text seems to have added explanation, try to extract just the cleaned text
679
+ # Look for common patterns like "Here's the cleaned text:" or similar
680
+ if "cleaned text" in cleaned_text.lower() or "here's" in cleaned_text.lower():
681
+ # Try to find the actual cleaned text after markers
682
+ lines = cleaned_text.split("\n")
683
+ # Skip lines that are clearly explanations
684
+ cleaned_lines = []
685
+ skip_next = False
686
+ for line in lines:
687
+ line_lower = line.lower().strip()
688
+ if any(marker in line_lower for marker in ["cleaned text", "here's", "here is", "result:", "output:"]):
689
+ skip_next = True
690
+ continue
691
+ if skip_next and not line.strip():
692
+ continue
693
+ skip_next = False
694
+ cleaned_lines.append(line)
695
+ if cleaned_lines:
696
+ cleaned_text = "\n".join(cleaned_lines).strip()
697
+
698
+ return cleaned_text
699
+
700
+ except Exception as e:
701
+ # Fallback to original text if LLM cleaning fails
702
+ return text
703
+
704
+
705
+ def text_to_speech(text: str, voice: str = "en-US-AriaNeural") -> np.ndarray:
706
+ """
707
+ Convert text to speech using VibeVoice (preferred) or edge-tts (fallback).
708
+
709
+ Args:
710
+ text: Text to convert to speech
711
+ voice: Voice to use (for edge-tts fallback, default: en-US-AriaNeural)
712
+
713
+ Returns:
714
+ Audio array as numpy array (mono, 16kHz)
715
+ """
716
+ # Try VibeVoice first (synchronous)
717
+ audio = text_to_speech_vibevoice(text)
718
+ if audio is not None:
719
+ return audio
720
+
721
+ # Fallback to edge-tts if VibeVoice is not available or failed
722
+ if not TTS_AVAILABLE:
723
+ return np.zeros(16000, dtype=np.float32) # 1 second of silence at 16kHz
724
+
725
+ try:
726
+ # Since this is called from a synchronous FastAPI endpoint,
727
+ # we can safely use asyncio.run() to create a new event loop
728
+ return asyncio.run(text_to_speech_edge_tts(text, voice))
729
+ except Exception:
730
+ # Return silence on error
731
+ return np.zeros(16000, dtype=np.float32)
732
+
733
+ INITIALIZATION_STATUS = {"model_loaded": True, "error": None}
734
+ class GenerateRequest(BaseModel):
735
+ audio_data: str = Field(
736
+ ...,
737
+ description="",
738
+ )
739
+ sample_rate: int = Field(..., description="")
740
+
741
+ class GenerateResponse(BaseModel):
742
+ audio_data: str = Field(..., description="")
743
+
744
+ app = FastAPI(title="V1", version="0.1")
745
+ app.add_middleware(
746
+ CORSMiddleware,
747
+ allow_origins=["*"],
748
+ allow_credentials=True,
749
+ allow_methods=["*"],
750
+ allow_headers=["*"],
751
+ )
752
+ def b64(b64: str) -> np.ndarray:
753
+ raw = base64.b64decode(b64)
754
+ return np.load(io.BytesIO(raw), allow_pickle=False)
755
+ def ab64(arr: np.ndarray, sr: int) -> str:
756
+ buf = io.BytesIO()
757
+ resampled = librosa.resample(arr, orig_sr=16000, target_sr=sr)
758
+ np.save(buf, resampled.astype(np.float32))
759
+ return base64.b64encode(buf.getvalue()).decode()
760
+ @app.get("/api/v1/health")
761
+ def health_check():
762
+ status = {
763
+ "status": "healthy",
764
+ "model_loaded": INITIALIZATION_STATUS["model_loaded"],
765
+ "error": INITIALIZATION_STATUS["error"],
766
+ }
767
+ return status
768
+ @app.post("/api/v1/v2v", response_model=GenerateResponse)
769
+ def generate_audio(req: GenerateRequest):
770
+ """Voice-to-voice endpoint - returns audio response.
771
+
772
+ Process:
773
+ 1. Convert input audio to text (v2t)
774
+ 2. Generate text response (LLM)
775
+ 3. Clean response text for TTS
776
+ 4. Convert cleaned text to speech (t2v) using VibeVoice or edge-tts
777
+ 5. Return generated audio
778
+ """
779
+ if not VIBEVOICE_AVAILABLE and not TTS_AVAILABLE:
780
+ raise HTTPException(
781
+ status_code=500,
782
+ detail="TTS functionality not available. Please install VibeVoice or edge-tts"
783
+ )
784
+
785
+ try:
786
+ # Decode base64 audio data
787
+ audio_np = b64(req.audio_data)
788
+
789
+ # Ensure proper shape for processing
790
+ if audio_np.ndim == 1:
791
+ audio_np = audio_np.reshape(1, -1)
792
+ elif audio_np.ndim == 2 and audio_np.shape[0] > 1:
793
+ # If multi-channel, convert to mono
794
+ audio_np = audio_np.mean(axis=0, keepdims=True)
795
+
796
+ # Step 1: Convert audio to text (v2t)
797
+ user_message = gt(audio_np, req.sample_rate)
798
+
799
+ if not user_message:
800
+ # Return silence with error
801
+ silence = np.zeros(16000, dtype=np.float32)
802
+ return GenerateResponse(audio_data=ab64(silence, req.sample_rate))
803
+
804
+ # Step 2: Generate text response using LLM
805
+ system_prompt = "You are a helpful assistant who tries to help answer the user's question."
806
+ system_prompt += "\n\n" + """Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
807
+ If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."""
808
+
809
+ response_text = chat(system_prompt, user_message)
810
+
811
+ # Step 3: Post-process: Remove first two lines (input prompt and injected line) before TTS
812
+ cleaned_response_text = clean_v2t_response_for_v2v(response_text)
813
+
814
+ # Step 4: Use LLM to intelligently clean the text for TTS while preserving important content
815
+ cleaned_response_text = clean_text_for_tts_with_llm(cleaned_response_text)
816
+
817
+ # Step 5: Convert cleaned text to speech (t2v)
818
+ try:
819
+ audio_output = text_to_speech(cleaned_response_text)
820
+ encoded_audio = ab64(audio_output, req.sample_rate)
821
+ except Exception as tts_error:
822
+ # Fallback to silence on TTS error
823
+ silence = np.zeros(16000, dtype=np.float32)
824
+ encoded_audio = ab64(silence, req.sample_rate)
825
+
826
+ return GenerateResponse(audio_data=encoded_audio)
827
+
828
+ except Exception as e:
829
+ traceback.print_exc()
830
+ # Return silence on error
831
+ try:
832
+ silence = np.zeros(16000, dtype=np.float32)
833
+ encoded_audio = ab64(silence, req.sample_rate)
834
+ return GenerateResponse(audio_data=encoded_audio)
835
+ except:
836
+ # If encoding fails, raise HTTPException
837
+ raise HTTPException(status_code=500, detail=f"{e}")
838
+
839
+ @app.post("/api/v1/v2t")
840
+ def generate_text(req: GenerateRequest):
841
+ audio_np = b64(req.audio_data)
842
+ if audio_np.ndim == 1:
843
+ audio_np = audio_np.reshape(1, -1)
844
+ try:
845
+ text = gt(audio_np, req.sample_rate)
846
+ system_prompt = "You are a helpful assistant who tries to help answer the user's question."
847
+ response_text = chat(system_prompt, user_prompt=text)
848
+ except Exception as e:
849
+ traceback.print_exc()
850
+ raise HTTPException(status_code=500, detail=f"{e}")
851
+ return {"text": response_text}
852
+
853
+ if __name__ == "__main__":
854
+ uvicorn.run("server:app", host="0.0.0.0", port=8000, reload=False)
test_local.py ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Local testing script for omega_model server.
4
+ Tests the Docker container health and API endpoints.
5
+ """
6
+ import requests
7
+ import time
8
+ import numpy as np
9
+ import base64
10
+ import io
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ # Configuration
15
+ SERVER_URL = "http://localhost:8000"
16
+ HEALTH_ENDPOINT = f"{SERVER_URL}/api/v1/health"
17
+ V2V_ENDPOINT = f"{SERVER_URL}/api/v1/v2v"
18
+ V2T_ENDPOINT = f"{SERVER_URL}/api/v1/v2t"
19
+
20
+ # Wait times
21
+ MAX_WAIT_TIME = 300 # 5 minutes for model loading
22
+ HEALTH_CHECK_INTERVAL = 5 # Check every 5 seconds
23
+
24
+
25
+ def create_test_audio(duration_seconds=2, sample_rate=16000):
26
+ """Create a simple test audio signal (sine wave)."""
27
+ t = np.linspace(0, duration_seconds, int(sample_rate * duration_seconds))
28
+ # Generate a 440 Hz sine wave (A note)
29
+ audio = np.sin(2 * np.pi * 440 * t).astype(np.float32)
30
+ # Reshape to (1, samples) format
31
+ audio = audio.reshape(1, -1)
32
+ return audio, sample_rate
33
+
34
+
35
+ def audio_to_base64(audio, sample_rate):
36
+ """Convert numpy audio array to base64 string."""
37
+ buf = io.BytesIO()
38
+ np.save(buf, audio.astype(np.float32))
39
+ return base64.b64encode(buf.getvalue()).decode()
40
+
41
+
42
+ def wait_for_server(max_wait=MAX_WAIT_TIME):
43
+ """Wait for the server to be ready."""
44
+ print(f"Waiting for server to be ready (max {max_wait}s)...")
45
+ start_time = time.time()
46
+
47
+ while time.time() - start_time < max_wait:
48
+ try:
49
+ response = requests.get(HEALTH_ENDPOINT, timeout=5)
50
+ if response.status_code == 200:
51
+ data = response.json()
52
+ if data.get("status") == "healthy" and data.get("model_loaded"):
53
+ print("✅ Server is ready!")
54
+ return True
55
+ else:
56
+ print(f"⏳ Server starting... (status: {data.get('status')}, model_loaded: {data.get('model_loaded')})")
57
+ else:
58
+ print(f"⏳ Server responding but not ready (status code: {response.status_code})")
59
+ except requests.exceptions.ConnectionError:
60
+ print("⏳ Server not responding yet...")
61
+ except Exception as e:
62
+ print(f"⏳ Error checking server: {e}")
63
+
64
+ time.sleep(HEALTH_CHECK_INTERVAL)
65
+
66
+ print("❌ Server did not become ready in time!")
67
+ return False
68
+
69
+
70
+ def test_health():
71
+ """Test the health endpoint."""
72
+ print("\n" + "="*60)
73
+ print("TEST 1: Health Check")
74
+ print("="*60)
75
+
76
+ try:
77
+ response = requests.get(HEALTH_ENDPOINT, timeout=10)
78
+ response.raise_for_status()
79
+ data = response.json()
80
+
81
+ print(f"Status Code: {response.status_code}")
82
+ print(f"Response: {data}")
83
+
84
+ if data.get("status") == "healthy" and data.get("model_loaded"):
85
+ print("✅ Health check PASSED")
86
+ return True
87
+ else:
88
+ print("❌ Health check FAILED")
89
+ if data.get("error"):
90
+ print(f"Error: {data.get('error')}")
91
+ return False
92
+
93
+ except Exception as e:
94
+ print(f"❌ Health check FAILED: {e}")
95
+ return False
96
+
97
+
98
+ def test_v2t():
99
+ """Test the voice-to-text endpoint."""
100
+ print("\n" + "="*60)
101
+ print("TEST 2: Voice-to-Text (v2t)")
102
+ print("="*60)
103
+
104
+ try:
105
+ # Create test audio
106
+ audio, sample_rate = create_test_audio(duration_seconds=2)
107
+ audio_b64 = audio_to_base64(audio, sample_rate)
108
+
109
+ payload = {
110
+ "audio_data": audio_b64,
111
+ "sample_rate": sample_rate
112
+ }
113
+
114
+ print(f"Sending request with audio shape: {audio.shape}, sample_rate: {sample_rate}")
115
+ print("Waiting for response (this may take 30-60 seconds)...")
116
+
117
+ response = requests.post(V2T_ENDPOINT, json=payload, timeout=120)
118
+ response.raise_for_status()
119
+ data = response.json()
120
+
121
+ print(f"Status Code: {response.status_code}")
122
+ print(f"Transcribed Text: {data.get('text', 'N/A')}")
123
+
124
+ if "text" in data:
125
+ print("✅ Voice-to-Text test PASSED")
126
+ return True
127
+ else:
128
+ print("❌ Voice-to-Text test FAILED - no text in response")
129
+ return False
130
+
131
+ except requests.exceptions.Timeout:
132
+ print("❌ Voice-to-Text test FAILED - Request timed out")
133
+ return False
134
+ except Exception as e:
135
+ print(f"❌ Voice-to-Text test FAILED: {e}")
136
+ import traceback
137
+ traceback.print_exc()
138
+ return False
139
+
140
+
141
+ def test_v2v():
142
+ """Test the voice-to-voice endpoint."""
143
+ print("\n" + "="*60)
144
+ print("TEST 3: Voice-to-Voice (v2v)")
145
+ print("="*60)
146
+
147
+ try:
148
+ # Create test audio
149
+ audio, sample_rate = create_test_audio(duration_seconds=2)
150
+ audio_b64 = audio_to_base64(audio, sample_rate)
151
+
152
+ payload = {
153
+ "audio_data": audio_b64,
154
+ "sample_rate": sample_rate
155
+ }
156
+
157
+ print(f"Sending request with audio shape: {audio.shape}, sample_rate: {sample_rate}")
158
+ print("Waiting for response (this may take 60-120 seconds)...")
159
+
160
+ response = requests.post(V2V_ENDPOINT, json=payload, timeout=200)
161
+ response.raise_for_status()
162
+ data = response.json()
163
+
164
+ print(f"Status Code: {response.status_code}")
165
+
166
+ if "audio_data" in data:
167
+ # Decode the response audio
168
+ audio_response_b64 = data["audio_data"]
169
+ audio_response_bytes = base64.b64decode(audio_response_b64)
170
+ audio_response = np.load(io.BytesIO(audio_response_bytes), allow_pickle=False)
171
+ print(f"Response audio shape: {audio_response.shape}")
172
+ print(f"Response audio dtype: {audio_response.dtype}")
173
+ print("✅ Voice-to-Voice test PASSED")
174
+ return True
175
+ else:
176
+ print("❌ Voice-to-Voice test FAILED - no audio_data in response")
177
+ return False
178
+
179
+ except requests.exceptions.Timeout:
180
+ print("❌ Voice-to-Voice test FAILED - Request timed out")
181
+ return False
182
+ except Exception as e:
183
+ print(f"❌ Voice-to-Voice test FAILED: {e}")
184
+ import traceback
185
+ traceback.print_exc()
186
+ return False
187
+
188
+
189
+ def main():
190
+ """Run all tests."""
191
+ print("="*60)
192
+ print("OMEGA MODEL LOCAL TESTING")
193
+ print("="*60)
194
+ print(f"Server URL: {SERVER_URL}")
195
+ print(f"Make sure the Docker container is running on port 8010")
196
+ print()
197
+
198
+ # Wait for server to be ready
199
+ if not wait_for_server():
200
+ print("\n❌ Server is not ready. Please check Docker container logs.")
201
+ sys.exit(1)
202
+
203
+ # Run tests
204
+ results = []
205
+
206
+ results.append(("Health Check", test_health()))
207
+ results.append(("Voice-to-Text", test_v2t()))
208
+ results.append(("Voice-to-Voice", test_v2v()))
209
+
210
+ # Summary
211
+ print("\n" + "="*60)
212
+ print("TEST SUMMARY")
213
+ print("="*60)
214
+
215
+ passed = sum(1 for _, result in results if result)
216
+ total = len(results)
217
+
218
+ for test_name, result in results:
219
+ status = "✅ PASSED" if result else "❌ FAILED"
220
+ print(f"{test_name}: {status}")
221
+
222
+ print(f"\nTotal: {passed}/{total} tests passed")
223
+
224
+ if passed == total:
225
+ print("\n🎉 All tests passed! Your model is ready to upload.")
226
+ sys.exit(0)
227
+ else:
228
+ print("\n⚠️ Some tests failed. Please check the errors above.")
229
+ sys.exit(1)
230
+
231
+
232
+ if __name__ == "__main__":
233
+ main()
234
+