Instructions to use niobures/Spark-TTS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use niobures/Spark-TTS with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="niobures/Spark-TTS", filename="ar/spark-tts-arabic-GGUF/spark-tts-arabic.IQ4_XS.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use niobures/Spark-TTS with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf niobures/Spark-TTS:Q4_K_M # Run inference directly in the terminal: llama cli -hf niobures/Spark-TTS:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf niobures/Spark-TTS:Q4_K_M # Run inference directly in the terminal: llama cli -hf niobures/Spark-TTS:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf niobures/Spark-TTS:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf niobures/Spark-TTS:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf niobures/Spark-TTS:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf niobures/Spark-TTS:Q4_K_M
Use Docker
docker model run hf.co/niobures/Spark-TTS:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use niobures/Spark-TTS with Ollama:
ollama run hf.co/niobures/Spark-TTS:Q4_K_M
- Unsloth Studio
How to use niobures/Spark-TTS with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for niobures/Spark-TTS to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for niobures/Spark-TTS to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for niobures/Spark-TTS to start chatting
- Pi
How to use niobures/Spark-TTS with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf niobures/Spark-TTS:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "niobures/Spark-TTS:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use niobures/Spark-TTS with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf niobures/Spark-TTS:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default niobures/Spark-TTS:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use niobures/Spark-TTS with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf niobures/Spark-TTS:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "niobures/Spark-TTS:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use niobures/Spark-TTS with Docker Model Runner:
docker model run hf.co/niobures/Spark-TTS:Q4_K_M
- Lemonade
How to use niobures/Spark-TTS with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull niobures/Spark-TTS:Q4_K_M
Run and chat with the model
lemonade run user.Spark-TTS-Q4_K_M
List all available models
lemonade list
Spark-TTS (ar, en, indic, kk, ugandan, zh)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +71 -0
- ar,en,zh/Spark_TTS_Arabic/.gitattributes +44 -0
- ar,en,zh/Spark_TTS_Arabic/BiCodec/config.yaml +60 -0
- ar,en,zh/Spark_TTS_Arabic/BiCodec/model.safetensors +3 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/added_tokens.json +0 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/config.json +27 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/merges.txt +0 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/model.safetensors +3 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/special_tokens_map.json +31 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/tokenizer.json +3 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/tokenizer_config.json +0 -0
- ar,en,zh/Spark_TTS_Arabic/LLM/vocab.json +0 -0
- ar,en,zh/Spark_TTS_Arabic/README.md +121 -0
- ar,en,zh/Spark_TTS_Arabic/config.yaml +7 -0
- ar,en,zh/Spark_TTS_Arabic/source.txt +1 -0
- ar,en,zh/Spark_TTS_Arabic/src/figures/gradio_TTS.png +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/figures/gradio_control.png +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/figures/infer_control.png +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/figures/infer_voice_cloning.png +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/HKUST.jpg +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/NPU.jpg +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/NTU.jpg +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/SJU.jpg +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/SparkAudio.jpg +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/SparkAudio2.jpg +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/SparkTTS.jpg +0 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/SparkTTS.png +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.jpg +3 -0
- ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.png +3 -0
- ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/README.md +29 -0
- ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/config.json +83 -0
- ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/preprocessor_config.json +9 -0
- ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/pytorch_model.bin +3 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/.gitattributes +46 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/BiCodec/config.yaml +60 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/BiCodec/model.safetensors +3 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/added_tokens.json +0 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/config.json +27 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/generation_config.json +8 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/model.safetensors +3 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/special_tokens_map.json +31 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/tokenizer.json +3 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/tokenizer_config.json +0 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/trainer_state.json +0 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/vocab.json +0 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/README.md +138 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/config.json +83 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/config.yaml +7 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/configuration_spark_tts.py +233 -0
- ar/Arabic-TTS-Spark (IbrahimSalah)/modeling_spark_tts.py +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,74 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
ar,en,zh/Spark_TTS_Arabic/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
ar,en,zh/Spark_TTS_Arabic/src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
ar,en,zh/Spark_TTS_Arabic/src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
ar,en,zh/Spark_TTS_Arabic/src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/reference.wav filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
ar/Arabic-TTS-Spark[[:space:]](IbrahimSalah)/src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
ar/Arabic-TTS-Spark/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
ar/Arabic-TTS-Spark/reference.wav filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
ar/Arabic-TTS-Spark/src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
ar/Arabic-TTS-Spark/src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
ar/Arabic-TTS-Spark/src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
ar/Arabic-TTS-Spark/src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
ar/Arabic-TTS-Spark/src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
ar/Arabic-TTS-Spark/src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
ar/Arabic-TTS-Spark/src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
ar/Arabic-TTS-Spark/src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
ar/spark-tts-arabic[[:space:]](AhmedNabil1)/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
ar/Spark-TTS-Arabic-Complete/LLM/checkpoint-1000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
ar/Spark-TTS-Arabic-Complete/LLM/checkpoint-1016/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
ar/Spark-TTS-Arabic-Complete/LLM/checkpoint-600/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
ar/Spark-TTS-Arabic-Complete/LLM/checkpoint-800/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
ar/Spark-TTS-Arabic-Complete/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
ar/Spark-TTS-Arabic-Complete/src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
ar/Spark-TTS-Arabic-Complete/src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
ar/Spark-TTS-Arabic-Complete/src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
ar/spark-tts-arabic-GGUF/spark-tts-arabic.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
ar/Spark-TTS-Arabic/checkpoint-1000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
ar/Spark-TTS-Arabic/checkpoint-1016/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
ar/Spark-TTS-Arabic/checkpoint-600/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
ar/Spark-TTS-Arabic/checkpoint-800/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
ar/Spark-TTS-Arabic/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
indic/Spark_somya_TTS/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
kk/Spark-TTS-Kazakh/src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
kk/Spark-TTS-Kazakh/src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
kk/Spark-TTS-Kazakh/src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
kk/Spark-TTS-Kazakh/src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
kk/Spark-TTS-Kazakh/src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
kk/Spark-TTS-Kazakh/src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
kk/Spark-TTS-Kazakh/src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
kk/Spark-TTS-Kazakh/src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
ugandan/spark-tts-salt/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
zh,en/Spark-TTS-0.5B-ONNX/LLM/onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
zh,en/Spark-TTS-0.5B-ONNX/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
ar,en,zh/Spark_TTS_Arabic/.gitattributes
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
ar,en,zh/Spark_TTS_Arabic/BiCodec/config.yaml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
audio_tokenizer:
|
| 2 |
+
mel_params:
|
| 3 |
+
sample_rate: 16000
|
| 4 |
+
n_fft: 1024
|
| 5 |
+
win_length: 640
|
| 6 |
+
hop_length: 320
|
| 7 |
+
mel_fmin: 10
|
| 8 |
+
mel_fmax: null
|
| 9 |
+
num_mels: 128
|
| 10 |
+
|
| 11 |
+
encoder:
|
| 12 |
+
input_channels: 1024
|
| 13 |
+
vocos_dim: 384
|
| 14 |
+
vocos_intermediate_dim: 2048
|
| 15 |
+
vocos_num_layers: 12
|
| 16 |
+
out_channels: 1024
|
| 17 |
+
sample_ratios: [1,1]
|
| 18 |
+
|
| 19 |
+
decoder:
|
| 20 |
+
input_channel: 1024
|
| 21 |
+
channels: 1536
|
| 22 |
+
rates: [8, 5, 4, 2]
|
| 23 |
+
kernel_sizes: [16,11,8,4]
|
| 24 |
+
|
| 25 |
+
quantizer:
|
| 26 |
+
input_dim: 1024
|
| 27 |
+
codebook_size: 8192
|
| 28 |
+
codebook_dim: 8
|
| 29 |
+
commitment: 0.25
|
| 30 |
+
codebook_loss_weight: 2.0
|
| 31 |
+
use_l2_normlize: True
|
| 32 |
+
threshold_ema_dead_code: 0.2
|
| 33 |
+
|
| 34 |
+
speaker_encoder:
|
| 35 |
+
input_dim: 128
|
| 36 |
+
out_dim: 1024
|
| 37 |
+
latent_dim: 128
|
| 38 |
+
token_num: 32
|
| 39 |
+
fsq_levels: [4, 4, 4, 4, 4, 4]
|
| 40 |
+
fsq_num_quantizers: 1
|
| 41 |
+
|
| 42 |
+
prenet:
|
| 43 |
+
input_channels: 1024
|
| 44 |
+
vocos_dim: 384
|
| 45 |
+
vocos_intermediate_dim: 2048
|
| 46 |
+
vocos_num_layers: 12
|
| 47 |
+
out_channels: 1024
|
| 48 |
+
condition_dim: 1024
|
| 49 |
+
sample_ratios: [1,1]
|
| 50 |
+
use_tanh_at_final: False
|
| 51 |
+
|
| 52 |
+
postnet:
|
| 53 |
+
input_channels: 1024
|
| 54 |
+
vocos_dim: 384
|
| 55 |
+
vocos_intermediate_dim: 2048
|
| 56 |
+
vocos_num_layers: 6
|
| 57 |
+
out_channels: 1024
|
| 58 |
+
use_tanh_at_final: False
|
| 59 |
+
|
| 60 |
+
|
ar,en,zh/Spark_TTS_Arabic/BiCodec/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9940cd48d4446e4340ced82d234bf5618350dd9f5db900ebe47a4fdb03867ec
|
| 3 |
+
size 625518756
|
ar,en,zh/Spark_TTS_Arabic/LLM/added_tokens.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar,en,zh/Spark_TTS_Arabic/LLM/config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"eos_token_id": 151645,
|
| 7 |
+
"hidden_act": "silu",
|
| 8 |
+
"hidden_size": 896,
|
| 9 |
+
"initializer_range": 0.02,
|
| 10 |
+
"intermediate_size": 4864,
|
| 11 |
+
"max_position_embeddings": 32768,
|
| 12 |
+
"max_window_layers": 21,
|
| 13 |
+
"model_type": "qwen2",
|
| 14 |
+
"num_attention_heads": 14,
|
| 15 |
+
"num_hidden_layers": 24,
|
| 16 |
+
"num_key_value_heads": 2,
|
| 17 |
+
"rms_norm_eps": 1e-06,
|
| 18 |
+
"rope_scaling": null,
|
| 19 |
+
"rope_theta": 1000000.0,
|
| 20 |
+
"sliding_window": 32768,
|
| 21 |
+
"tie_word_embeddings": true,
|
| 22 |
+
"torch_dtype": "bfloat16",
|
| 23 |
+
"transformers_version": "4.52.3",
|
| 24 |
+
"use_cache": false,
|
| 25 |
+
"use_sliding_window": false,
|
| 26 |
+
"vocab_size": 166000
|
| 27 |
+
}
|
ar,en,zh/Spark_TTS_Arabic/LLM/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar,en,zh/Spark_TTS_Arabic/LLM/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0d84e04304ff4a77c168a4f89ba97d654c0d9d1ac0c9361ddeda1cfbcc54db3f
|
| 3 |
+
size 1013300536
|
ar,en,zh/Spark_TTS_Arabic/LLM/special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
ar,en,zh/Spark_TTS_Arabic/LLM/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c8b057d6ca205a429cc3428b9fc815f0d6ee1d53106dd5e5b129ef9db2ff057
|
| 3 |
+
size 14129172
|
ar,en,zh/Spark_TTS_Arabic/LLM/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar,en,zh/Spark_TTS_Arabic/LLM/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar,en,zh/Spark_TTS_Arabic/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-sa-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- zh
|
| 6 |
+
- ar
|
| 7 |
+
tags:
|
| 8 |
+
- text-to-speech
|
| 9 |
+
library_tag: spark-tts
|
| 10 |
+
base_model:
|
| 11 |
+
- SparkAudio/Spark-TTS-0.5B
|
| 12 |
+
pipeline_tag: text-to-speech
|
| 13 |
+
datasets:
|
| 14 |
+
- MBZUAI/ArVoice
|
| 15 |
+
- mozilla-foundation/common_voice_17_0
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
## Spark-TTS 🔥
|
| 20 |
+
|
| 21 |
+
### 👉🏻 [Spark-TTS Demos](https://sparkaudio.github.io/spark-tts/) 👈🏻
|
| 22 |
+
|
| 23 |
+
### 👉🏻 [Github Repo](https://github.com/SparkAudio/Spark-TTS) 👈🏻
|
| 24 |
+
|
| 25 |
+
### 👉🏻 [Paper](https://arxiv.org/pdf/2503.01710) 👈🏻
|
| 26 |
+
|
| 27 |
+
### Overview
|
| 28 |
+
|
| 29 |
+
Spark-TTS is an advanced text-to-speech system that uses the power of large language models (LLM) for highly accurate and natural-sounding voice synthesis. It is designed to be efficient, flexible, and powerful for both research and production use.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
<table align="center">
|
| 34 |
+
<tr>
|
| 35 |
+
<td align="center"><b>Inference Overview of Voice Cloning</b><br><img src="src/figures/infer_voice_cloning.png" width="80%" /></td>
|
| 36 |
+
</tr>
|
| 37 |
+
<tr>
|
| 38 |
+
<td align="center"><b>Inference Overview of Controlled Generation</b><br><img src="src/figures/infer_control.png" width="80%" /></td>
|
| 39 |
+
</tr>
|
| 40 |
+
</table>
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## Install
|
| 44 |
+
**Clone and Install**
|
| 45 |
+
|
| 46 |
+
- Clone the repo
|
| 47 |
+
``` sh
|
| 48 |
+
git clone https://github.com/SparkAudio/Spark-TTS.git
|
| 49 |
+
cd Spark-TTS
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
- Install Conda: please see https://docs.conda.io/en/latest/miniconda.html
|
| 53 |
+
- Create Conda env:
|
| 54 |
+
|
| 55 |
+
``` sh
|
| 56 |
+
conda create -n sparktts -y python=3.12
|
| 57 |
+
conda activate sparktts
|
| 58 |
+
pip install -r requirements.txt
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
**Model Download**
|
| 62 |
+
|
| 63 |
+
Download via python:
|
| 64 |
+
```python
|
| 65 |
+
from huggingface_hub import snapshot_download
|
| 66 |
+
|
| 67 |
+
snapshot_download("MrEzzat/Spark_TTS_Arabic", local_dir="pretrained_models/Spark-TTS-0.5B")
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Download via git clone:
|
| 71 |
+
```sh
|
| 72 |
+
mkdir -p pretrained_models
|
| 73 |
+
|
| 74 |
+
# Make sure you have git-lfs installed (https://git-lfs.com)
|
| 75 |
+
git lfs install
|
| 76 |
+
|
| 77 |
+
git clone https://huggingface.co/MrEzzat/Spark_TTS_Arabic
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
**Basic Usage**
|
| 81 |
+
|
| 82 |
+
You can simply run the demo with the following commands:
|
| 83 |
+
``` sh
|
| 84 |
+
cd example
|
| 85 |
+
bash infer.sh
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Alternatively, you can directly execute the following command in the command line to perform inference:
|
| 89 |
+
|
| 90 |
+
``` sh
|
| 91 |
+
python -m cli.inference \
|
| 92 |
+
--text "text to synthesis." \
|
| 93 |
+
--device 0 \
|
| 94 |
+
--save_dir "path/to/save/audio" \
|
| 95 |
+
--model_dir pretrained_models/Spark-TTS-0.5B \
|
| 96 |
+
--prompt_text "transcript of the prompt audio" \
|
| 97 |
+
--prompt_speech_path "path/to/prompt_audio"
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
**UI Usage**
|
| 101 |
+
|
| 102 |
+
You can start the UI interface by running `python webui.py`, which allows you to perform Voice Cloning and Voice Creation. Voice Cloning supports uploading reference audio or directly recording the audio.
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
| **Voice Cloning** | **Voice Creation** |
|
| 106 |
+
|:-------------------:|:-------------------:|
|
| 107 |
+
|  |  |
|
| 108 |
+
|
| 109 |
+
## Citation
|
| 110 |
+
|
| 111 |
+
```
|
| 112 |
+
@misc{wang2025sparktts,
|
| 113 |
+
title={Spark-TTS: An Efficient LLM-Based Text-to-Speech Model with Single-Stream Decoupled Speech Tokens},
|
| 114 |
+
author={Xinsheng Wang and Mingqi Jiang and Ziyang Ma and Ziyu Zhang and Songxiang Liu and Linqin Li and Zheng Liang and Qixi Zheng and Rui Wang and Xiaoqin Feng and Weizhen Bian and Zhen Ye and Sitong Cheng and Ruibin Yuan and Zhixian Zhao and Xinfa Zhu and Jiahao Pan and Liumeng Xue and Pengcheng Zhu and Yunlin Chen and Zhifei Li and Xie Chen and Lei Xie and Yike Guo and Wei Xue},
|
| 115 |
+
year={2025},
|
| 116 |
+
eprint={2503.01710},
|
| 117 |
+
archivePrefix={arXiv},
|
| 118 |
+
primaryClass={cs.SD},
|
| 119 |
+
url={https://arxiv.org/abs/2503.01710},
|
| 120 |
+
}
|
| 121 |
+
```
|
ar,en,zh/Spark_TTS_Arabic/config.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
highpass_cutoff_freq: 40
|
| 2 |
+
sample_rate: 16000
|
| 3 |
+
segment_duration: 2.4 # (s)
|
| 4 |
+
max_val_duration: 12 # (s)
|
| 5 |
+
latent_hop_length: 320
|
| 6 |
+
ref_segment_duration: 6
|
| 7 |
+
volume_normalize: true
|
ar,en,zh/Spark_TTS_Arabic/source.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
https://huggingface.co/MrEzzat/Spark_TTS_Arabic
|
ar,en,zh/Spark_TTS_Arabic/src/figures/gradio_TTS.png
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/figures/gradio_control.png
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/figures/infer_control.png
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/figures/infer_voice_cloning.png
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/HKUST.jpg
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/NPU.jpg
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/NTU.jpg
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/logo/SJU.jpg
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/SparkAudio.jpg
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/logo/SparkAudio2.jpg
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/logo/SparkTTS.jpg
ADDED
|
ar,en,zh/Spark_TTS_Arabic/src/logo/SparkTTS.png
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.jpg
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/src/logo/mobvoi.png
ADDED
|
Git LFS Details
|
ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: multilingual
|
| 3 |
+
datasets:
|
| 4 |
+
- common_voice
|
| 5 |
+
tags:
|
| 6 |
+
- speech
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Wav2Vec2-XLSR-53
|
| 11 |
+
|
| 12 |
+
[Facebook's XLSR-Wav2Vec2](https://ai.facebook.com/blog/wav2vec-20-learning-the-structure-of-speech-from-raw-audio/)
|
| 13 |
+
|
| 14 |
+
The base model pretrained on 16kHz sampled speech audio. When using the model make sure that your speech input is also sampled at 16Khz. Note that this model should be fine-tuned on a downstream task, like Automatic Speech Recognition. Check out [this blog](https://huggingface.co/blog/fine-tune-wav2vec2-english) for more information.
|
| 15 |
+
|
| 16 |
+
[Paper](https://arxiv.org/abs/2006.13979)
|
| 17 |
+
|
| 18 |
+
Authors: Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli
|
| 19 |
+
|
| 20 |
+
**Abstract**
|
| 21 |
+
This paper presents XLSR which learns cross-lingual speech representations by pretraining a single model from the raw waveform of speech in multiple languages. We build on wav2vec 2.0 which is trained by solving a contrastive task over masked latent speech representations and jointly learns a quantization of the latents shared across languages. The resulting model is fine-tuned on labeled data and experiments show that cross-lingual pretraining significantly outperforms monolingual pretraining. On the CommonVoice benchmark, XLSR shows a relative phoneme error rate reduction of 72% compared to the best known results. On BABEL, our approach improves word error rate by 16% relative compared to a comparable system. Our approach enables a single multilingual speech recognition model which is competitive to strong individual models. Analysis shows that the latent discrete speech representations are shared across languages with increased sharing for related languages. We hope to catalyze research in low-resource speech understanding by releasing XLSR-53, a large model pretrained in 53 languages.
|
| 22 |
+
|
| 23 |
+
The original model can be found under https://github.com/pytorch/fairseq/tree/master/examples/wav2vec#wav2vec-20.
|
| 24 |
+
|
| 25 |
+
# Usage
|
| 26 |
+
|
| 27 |
+
See [this notebook](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_Tune_XLSR_Wav2Vec2_on_Turkish_ASR_with_%F0%9F%A4%97_Transformers.ipynb) for more information on how to fine-tune the model.
|
| 28 |
+
|
| 29 |
+

|
ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/config.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_dropout": 0.0,
|
| 3 |
+
"apply_spec_augment": true,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"Wav2Vec2ForPreTraining"
|
| 6 |
+
],
|
| 7 |
+
"attention_dropout": 0.1,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"codevector_dim": 768,
|
| 10 |
+
"contrastive_logits_temperature": 0.1,
|
| 11 |
+
"conv_bias": true,
|
| 12 |
+
"conv_dim": [
|
| 13 |
+
512,
|
| 14 |
+
512,
|
| 15 |
+
512,
|
| 16 |
+
512,
|
| 17 |
+
512,
|
| 18 |
+
512,
|
| 19 |
+
512
|
| 20 |
+
],
|
| 21 |
+
"conv_kernel": [
|
| 22 |
+
10,
|
| 23 |
+
3,
|
| 24 |
+
3,
|
| 25 |
+
3,
|
| 26 |
+
3,
|
| 27 |
+
2,
|
| 28 |
+
2
|
| 29 |
+
],
|
| 30 |
+
"conv_stride": [
|
| 31 |
+
5,
|
| 32 |
+
2,
|
| 33 |
+
2,
|
| 34 |
+
2,
|
| 35 |
+
2,
|
| 36 |
+
2,
|
| 37 |
+
2
|
| 38 |
+
],
|
| 39 |
+
"ctc_loss_reduction": "sum",
|
| 40 |
+
"ctc_zero_infinity": false,
|
| 41 |
+
"diversity_loss_weight": 0.1,
|
| 42 |
+
"do_stable_layer_norm": true,
|
| 43 |
+
"eos_token_id": 2,
|
| 44 |
+
"feat_extract_activation": "gelu",
|
| 45 |
+
"feat_extract_dropout": 0.0,
|
| 46 |
+
"feat_extract_norm": "layer",
|
| 47 |
+
"feat_proj_dropout": 0.1,
|
| 48 |
+
"feat_quantizer_dropout": 0.0,
|
| 49 |
+
"final_dropout": 0.0,
|
| 50 |
+
"gradient_checkpointing": false,
|
| 51 |
+
"hidden_act": "gelu",
|
| 52 |
+
"hidden_dropout": 0.1,
|
| 53 |
+
"hidden_size": 1024,
|
| 54 |
+
"initializer_range": 0.02,
|
| 55 |
+
"intermediate_size": 4096,
|
| 56 |
+
"layer_norm_eps": 1e-05,
|
| 57 |
+
"layerdrop": 0.1,
|
| 58 |
+
"mask_channel_length": 10,
|
| 59 |
+
"mask_channel_min_space": 1,
|
| 60 |
+
"mask_channel_other": 0.0,
|
| 61 |
+
"mask_channel_prob": 0.0,
|
| 62 |
+
"mask_channel_selection": "static",
|
| 63 |
+
"mask_feature_length": 10,
|
| 64 |
+
"mask_feature_prob": 0.0,
|
| 65 |
+
"mask_time_length": 10,
|
| 66 |
+
"mask_time_min_space": 1,
|
| 67 |
+
"mask_time_other": 0.0,
|
| 68 |
+
"mask_time_prob": 0.075,
|
| 69 |
+
"mask_time_selection": "static",
|
| 70 |
+
"model_type": "wav2vec2",
|
| 71 |
+
"num_attention_heads": 16,
|
| 72 |
+
"num_codevector_groups": 2,
|
| 73 |
+
"num_codevectors_per_group": 320,
|
| 74 |
+
"num_conv_pos_embedding_groups": 16,
|
| 75 |
+
"num_conv_pos_embeddings": 128,
|
| 76 |
+
"num_feat_extract_layers": 7,
|
| 77 |
+
"num_hidden_layers": 24,
|
| 78 |
+
"num_negatives": 100,
|
| 79 |
+
"pad_token_id": 0,
|
| 80 |
+
"proj_codevector_dim": 768,
|
| 81 |
+
"transformers_version": "4.7.0.dev0",
|
| 82 |
+
"vocab_size": 32
|
| 83 |
+
}
|
ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/preprocessor_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_normalize": true,
|
| 3 |
+
"feature_extractor_type": "Wav2Vec2FeatureExtractor",
|
| 4 |
+
"feature_size": 1,
|
| 5 |
+
"padding_side": "right",
|
| 6 |
+
"padding_value": 0,
|
| 7 |
+
"return_attention_mask": true,
|
| 8 |
+
"sampling_rate": 16000
|
| 9 |
+
}
|
ar,en,zh/Spark_TTS_Arabic/wav2vec2-large-xlsr-53/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:314340227371a608f71adcd5f0de5933824fe77e55822aa4b24dba9c1c364dcb
|
| 3 |
+
size 1269737156
|
ar/Arabic-TTS-Spark (IbrahimSalah)/.gitattributes
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
pretrained_models/Spark-TTS-0.5B/LLM/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
src/figures/infer_control.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
src/figures/infer_voice_cloning.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
src/logo/HKUST.jpg filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
src/logo/NPU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
src/logo/SJU.jpg filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
src/logo/SparkTTS.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
src/logo/mobvoi.jpg filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
src/logo/mobvoi.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
reference.wav filter=lfs diff=lfs merge=lfs -text
|
ar/Arabic-TTS-Spark (IbrahimSalah)/BiCodec/config.yaml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
audio_tokenizer:
|
| 2 |
+
mel_params:
|
| 3 |
+
sample_rate: 16000
|
| 4 |
+
n_fft: 1024
|
| 5 |
+
win_length: 640
|
| 6 |
+
hop_length: 320
|
| 7 |
+
mel_fmin: 10
|
| 8 |
+
mel_fmax: null
|
| 9 |
+
num_mels: 128
|
| 10 |
+
|
| 11 |
+
encoder:
|
| 12 |
+
input_channels: 1024
|
| 13 |
+
vocos_dim: 384
|
| 14 |
+
vocos_intermediate_dim: 2048
|
| 15 |
+
vocos_num_layers: 12
|
| 16 |
+
out_channels: 1024
|
| 17 |
+
sample_ratios: [1,1]
|
| 18 |
+
|
| 19 |
+
decoder:
|
| 20 |
+
input_channel: 1024
|
| 21 |
+
channels: 1536
|
| 22 |
+
rates: [8, 5, 4, 2]
|
| 23 |
+
kernel_sizes: [16,11,8,4]
|
| 24 |
+
|
| 25 |
+
quantizer:
|
| 26 |
+
input_dim: 1024
|
| 27 |
+
codebook_size: 8192
|
| 28 |
+
codebook_dim: 8
|
| 29 |
+
commitment: 0.25
|
| 30 |
+
codebook_loss_weight: 2.0
|
| 31 |
+
use_l2_normlize: True
|
| 32 |
+
threshold_ema_dead_code: 0.2
|
| 33 |
+
|
| 34 |
+
speaker_encoder:
|
| 35 |
+
input_dim: 128
|
| 36 |
+
out_dim: 1024
|
| 37 |
+
latent_dim: 128
|
| 38 |
+
token_num: 32
|
| 39 |
+
fsq_levels: [4, 4, 4, 4, 4, 4]
|
| 40 |
+
fsq_num_quantizers: 1
|
| 41 |
+
|
| 42 |
+
prenet:
|
| 43 |
+
input_channels: 1024
|
| 44 |
+
vocos_dim: 384
|
| 45 |
+
vocos_intermediate_dim: 2048
|
| 46 |
+
vocos_num_layers: 12
|
| 47 |
+
out_channels: 1024
|
| 48 |
+
condition_dim: 1024
|
| 49 |
+
sample_ratios: [1,1]
|
| 50 |
+
use_tanh_at_final: False
|
| 51 |
+
|
| 52 |
+
postnet:
|
| 53 |
+
input_channels: 1024
|
| 54 |
+
vocos_dim: 384
|
| 55 |
+
vocos_intermediate_dim: 2048
|
| 56 |
+
vocos_num_layers: 6
|
| 57 |
+
out_channels: 1024
|
| 58 |
+
use_tanh_at_final: False
|
| 59 |
+
|
| 60 |
+
|
ar/Arabic-TTS-Spark (IbrahimSalah)/BiCodec/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9940cd48d4446e4340ced82d234bf5618350dd9f5db900ebe47a4fdb03867ec
|
| 3 |
+
size 625518756
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/added_tokens.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"eos_token_id": 151645,
|
| 7 |
+
"hidden_act": "silu",
|
| 8 |
+
"hidden_size": 896,
|
| 9 |
+
"initializer_range": 0.02,
|
| 10 |
+
"intermediate_size": 4864,
|
| 11 |
+
"max_position_embeddings": 32768,
|
| 12 |
+
"max_window_layers": 21,
|
| 13 |
+
"model_type": "qwen2",
|
| 14 |
+
"num_attention_heads": 14,
|
| 15 |
+
"num_hidden_layers": 24,
|
| 16 |
+
"num_key_value_heads": 2,
|
| 17 |
+
"rms_norm_eps": 1e-06,
|
| 18 |
+
"rope_scaling": null,
|
| 19 |
+
"rope_theta": 1000000.0,
|
| 20 |
+
"sliding_window": 32768,
|
| 21 |
+
"tie_word_embeddings": true,
|
| 22 |
+
"torch_dtype": "bfloat16",
|
| 23 |
+
"transformers_version": "4.51.3",
|
| 24 |
+
"use_cache": false,
|
| 25 |
+
"use_sliding_window": false,
|
| 26 |
+
"vocab_size": 166000
|
| 27 |
+
}
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 151643,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 151645,
|
| 6 |
+
"transformers_version": "4.51.3",
|
| 7 |
+
"use_cache": false
|
| 8 |
+
}
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d7e61a5ed6a6dbfc8cd485c7b8536142670547da447c48fe6e28210b8fd3715
|
| 3 |
+
size 1013300536
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c8b057d6ca205a429cc3428b9fc815f0d6ee1d53106dd5e5b129ef9db2ff057
|
| 3 |
+
size 14129172
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar/Arabic-TTS-Spark (IbrahimSalah)/LLM/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ar/Arabic-TTS-Spark (IbrahimSalah)/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
base_model:
|
| 5 |
+
- SparkAudio/Spark-TTS-0.5B
|
| 6 |
+
tags:
|
| 7 |
+
- speech
|
| 8 |
+
- arabic
|
| 9 |
+
- spark
|
| 10 |
+
- tts
|
| 11 |
+
- text-to-speech
|
| 12 |
+
license: fair-noncommercial-research-license
|
| 13 |
+
---
|
| 14 |
+
# Spark-TTS Arabic
|
| 15 |
+
## نموذج تحويل النص إلى كلام باللغة العربية
|
| 16 |
+
|
| 17 |
+
Arabic text-to-speech model fine-tuned on 300 hours of clean Arabic audio data. Delivers consistent, high-quality speech synthesis for Modern Standard Arabic with full diacritization.
|
| 18 |
+
|
| 19 |
+
## Model Details
|
| 20 |
+
|
| 21 |
+
**Training Data:** ~300 hours of clean Arabic audio
|
| 22 |
+
**Language:** Modern Standard Arabic (MSA)
|
| 23 |
+
**Sample Rate:** 24kHz
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
### Quick Start
|
| 28 |
+
|
| 29 |
+
see the [Colab notebook](https://colab.research.google.com/drive/1-Jxgy8BjvyWHKppdBPtz4s35Er3qDv-K?usp=sharing).
|
| 30 |
+
HF space : [Arabic Spark TTS Space](https://huggingface.co/spaces/IbrahimSalah/Arabic-TTS-Spark).
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
from transformers import AutoProcessor, AutoModel
|
| 36 |
+
import soundfile as sf
|
| 37 |
+
import torch
|
| 38 |
+
|
| 39 |
+
# Load model
|
| 40 |
+
model_id = "IbrahimSalah/Arabic-TTS-Spark"
|
| 41 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 42 |
+
|
| 43 |
+
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 44 |
+
model = AutoModel.from_pretrained(model_id, trust_remote_code=True).eval().to(device)
|
| 45 |
+
|
| 46 |
+
# Prepare inputs
|
| 47 |
+
inputs = processor(
|
| 48 |
+
text="YOUR_TEXT_WITH_TASHKEEL",
|
| 49 |
+
prompt_speech_path="path/to/reference.wav",
|
| 50 |
+
prompt_text="REFERENCE_TEXT_WITH_TASHKEEL",
|
| 51 |
+
return_tensors="pt"
|
| 52 |
+
).to(device)
|
| 53 |
+
|
| 54 |
+
# Generate
|
| 55 |
+
with torch.no_grad():
|
| 56 |
+
output_ids = model.generate(**inputs, max_new_tokens=8000, temperature=0.8)
|
| 57 |
+
|
| 58 |
+
# Decode
|
| 59 |
+
output = processor.decode(generated_ids=output_ids)
|
| 60 |
+
sf.write("output.wav", output["audio"], output["sampling_rate"])
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Key Features
|
| 64 |
+
|
| 65 |
+
- High-quality Arabic speech synthesis with natural prosody
|
| 66 |
+
- Efficient voice cloning from reference audio
|
| 67 |
+
- Advanced text chunking for long-form content
|
| 68 |
+
- Built-in audio post-processing (normalization, silence removal, crossfading)
|
| 69 |
+
- Works best with moderate text lengths
|
| 70 |
+
- Adjustable generation parameters (temperature, top_k, top_p)
|
| 71 |
+
|
| 72 |
+
## Input Requirements
|
| 73 |
+
|
| 74 |
+
**Critical:** Text must include full Arabic diacritization (tashkeel). The model is trained exclusively on fully diacritized text and will not perform well on non-diacritized input.
|
| 75 |
+
|
| 76 |
+
Example of correct input:
|
| 77 |
+
```
|
| 78 |
+
إِنَّ الْعِلْمَ نُورٌ يُقْذَفُ فِي الْقَلْبِ
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### Generation Parameters
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
tts.generate_long_text(
|
| 85 |
+
text=your_text,
|
| 86 |
+
prompt_audio_path="reference.wav",
|
| 87 |
+
prompt_transcript="reference_text",
|
| 88 |
+
output_path="output.wav",
|
| 89 |
+
max_chunk_length=300, # Characters per chunk
|
| 90 |
+
crossfade_duration=0.08, # Crossfade duration in seconds
|
| 91 |
+
normalize_audio_flag=True,
|
| 92 |
+
remove_silence_flag=True,
|
| 93 |
+
temperature=0.8, # Generation randomness
|
| 94 |
+
top_p=0.95, # Nucleus sampling
|
| 95 |
+
top_k=50 # Top-k sampling
|
| 96 |
+
)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Sample Output
|
| 100 |
+
|
| 101 |
+
**Text:** "إِنَّ الدَّوْلَةَ لَهَا أَعْمَارٌ طَبِيعِيَّةٌ كَمَا لِلْأَشْخَاصِ. وَأَنَّهَا تَنْتَقِلُ فِي أَطْوَارٍ مُخْتَلِفَةٍ، فَيَكُونُ الْجِيلُ الْأَوَّلُ مِنْ أَهْلِ الدَّوْلَةِ، قَدْ حَافَظُوا عَلَى الْخُشُونَةِ الْبَدَوِيَّةِ، وَالتَّوَحُّشِ، وَالشَّظَفِ، وَالْبَأْسِ، وَالِاشْتِرَاكِ فِي الْمَجْدِ. فَتَكُونُ حُدُودُهُمْ مَرْهُوبَةً، وَجَوَانِبُهُمْ مُعَزَّزَةً. ثُمَّ يَأْتِي الْجِيلُ الثَّانِي، فَيَتَحَوَّلُ حَالُهُمْ بِالْمُلْكِ وَالتَّرَفِ مِنَ الْبَدَاوَةِ إِلَى الْحَضَارَةِ، وَمِنَ الْخُشُونَةِ إِلَى التَّرَفِ. فَيَنْكَسِرُ سَوْرَةُ الْعَصَبِيَّةِ قَلِيلًا. ثُمَّ يَأْتِي الْجِيلُ الثَّالِثُ، فَيَكُونُونَ قَدْ نَسُوا عَهْدَ الْبَدَاوَةِ وَالْخُشُونَةِ، وَيَنْغَمِسُونَ فِي النَّعِيمِ وَالتَّرَفِ، وَيَصِيرُونَ عِيَالًا عَلَى الدَّوْلَةِ. فَيَسْقُطُونَ فِي الْهَرَمِ وَالزَّوَالِ، وَيَحْتَاجُونَ إِلَى مَنْ يُدَافِعُ عَنْهُمْ، فَتَبْدَأُ الدَّوْلَةُ فِي الِانْقِرَاضِ."
|
| 102 |
+
|
| 103 |
+
<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/645098004f731658826cfe57/FCGgeIu1F89rvNI55aVIx.wav"></audio>
|
| 104 |
+
## refrence audio
|
| 105 |
+
|
| 106 |
+
<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/645098004f731658826cfe57/cA9Z77_P0Rm2-hu1eosOC.wav"></audio>
|
| 107 |
+
|
| 108 |
+
## Further Fine-tuning
|
| 109 |
+
|
| 110 |
+
The model can be further fine-tuned for:
|
| 111 |
+
- Non-diacritized text (requires additional training)
|
| 112 |
+
- Specific voice characteristics
|
| 113 |
+
- Domain-specific vocabulary
|
| 114 |
+
- Dialectal variations
|
| 115 |
+
|
| 116 |
+
Fine-tuning infrastructure: [Spark-TTS Fine-tune](https://github.com/tuan12378/Spark-TTS-finetune)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
## License
|
| 120 |
+
|
| 121 |
+
This model is released under a **Non-Commercial License**.
|
| 122 |
+
|
| 123 |
+
- You may use this model for research, educational, and personal non-commercial purposes.
|
| 124 |
+
- Commercial use is strictly prohibited without explicit permission.
|
| 125 |
+
- If you wish to use this model for commercial purposes, please contact the model author.
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
## Acknowledgments
|
| 129 |
+
|
| 130 |
+
- Base model: [Spark-TTS](https://github.com/tuan12378/Spark-TTS-finetune) by tuan12378
|
| 131 |
+
|
| 132 |
+
## Limitations
|
| 133 |
+
|
| 134 |
+
- Requires fully diacritized Arabic text as input
|
| 135 |
+
- Optimized for Modern Standard Arabic (MSA), not dialectal Arabic
|
| 136 |
+
- Performance may vary with very long texts without proper chunking
|
| 137 |
+
- Voice cloning quality depends on reference audio quality and length
|
| 138 |
+
- Generation speed scales with text length
|
ar/Arabic-TTS-Spark (IbrahimSalah)/config.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "spark-tts",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"SparkTTSModel"
|
| 5 |
+
],
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration_spark_tts.SparkTTSConfig",
|
| 8 |
+
"AutoModel": "modeling_spark_tts.SparkTTSModel",
|
| 9 |
+
"AutoProcessor": "processing_spark_tts.SparkTTSProcessor"
|
| 10 |
+
},
|
| 11 |
+
"processor_class": "processing_spark_tts.SparkTTSProcessor",
|
| 12 |
+
"llm_model_name_or_path": "./LLM",
|
| 13 |
+
"bicodec_model_name_or_path": "./BiCodec",
|
| 14 |
+
"wav2vec2_model_name_or_path": "./wav2vec2-large-xlsr-53",
|
| 15 |
+
"sample_rate": 16000,
|
| 16 |
+
"highpass_cutoff_freq": 40,
|
| 17 |
+
"latent_hop_length": 320,
|
| 18 |
+
"ref_segment_duration": 6.0,
|
| 19 |
+
"volume_normalize": true,
|
| 20 |
+
"torch_dtype": "bfloat16",
|
| 21 |
+
"transformers_version": "4.50.3",
|
| 22 |
+
"_commit_hash": null,
|
| 23 |
+
"bicodec_config": {
|
| 24 |
+
"mel_params": {
|
| 25 |
+
"sample_rate": 16000,
|
| 26 |
+
"n_fft": 1024,
|
| 27 |
+
"win_length": 640,
|
| 28 |
+
"hop_length": 320,
|
| 29 |
+
"mel_fmin": 10,
|
| 30 |
+
"mel_fmax": null,
|
| 31 |
+
"num_mels": 128
|
| 32 |
+
},
|
| 33 |
+
"encoder_config": {
|
| 34 |
+
"input_channels": 1024,
|
| 35 |
+
"vocos_dim": 384,
|
| 36 |
+
"vocos_intermediate_dim": 2048,
|
| 37 |
+
"vocos_num_layers": 12,
|
| 38 |
+
"out_channels": 1024,
|
| 39 |
+
"sample_ratios": [1, 1]
|
| 40 |
+
},
|
| 41 |
+
"decoder_config": {
|
| 42 |
+
"input_channel": 1024,
|
| 43 |
+
"channels": 1536,
|
| 44 |
+
"rates": [8, 5, 4, 2],
|
| 45 |
+
"kernel_sizes": [16, 11, 8, 4]
|
| 46 |
+
},
|
| 47 |
+
"quantizer_config": {
|
| 48 |
+
"input_dim": 1024,
|
| 49 |
+
"codebook_size": 8192,
|
| 50 |
+
"codebook_dim": 8,
|
| 51 |
+
"commitment": 0.25,
|
| 52 |
+
"codebook_loss_weight": 2.0,
|
| 53 |
+
"decay": 0.99,
|
| 54 |
+
"threshold_ema_dead_code": 0.2
|
| 55 |
+
},
|
| 56 |
+
"speaker_encoder_config": {
|
| 57 |
+
"input_dim": 128,
|
| 58 |
+
"out_dim": 1024,
|
| 59 |
+
"latent_dim": 128,
|
| 60 |
+
"token_num": 32,
|
| 61 |
+
"fsq_levels": [4, 4, 4, 4, 4, 4],
|
| 62 |
+
"fsq_num_quantizers": 1
|
| 63 |
+
},
|
| 64 |
+
"prenet_config": {
|
| 65 |
+
"input_channels": 1024,
|
| 66 |
+
"vocos_dim": 384,
|
| 67 |
+
"vocos_intermediate_dim": 2048,
|
| 68 |
+
"vocos_num_layers": 12,
|
| 69 |
+
"out_channels": 1024,
|
| 70 |
+
"condition_dim": 1024,
|
| 71 |
+
"sample_ratios": [1, 1],
|
| 72 |
+
"use_tanh_at_final": false
|
| 73 |
+
},
|
| 74 |
+
"postnet_config": {
|
| 75 |
+
"input_channels": 1024,
|
| 76 |
+
"vocos_dim": 384,
|
| 77 |
+
"vocos_intermediate_dim": 2048,
|
| 78 |
+
"vocos_num_layers": 6,
|
| 79 |
+
"out_channels": 1024,
|
| 80 |
+
"use_tanh_at_final": false
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
ar/Arabic-TTS-Spark (IbrahimSalah)/config.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
highpass_cutoff_freq: 40
|
| 2 |
+
sample_rate: 16000
|
| 3 |
+
segment_duration: 2.4 # (s)
|
| 4 |
+
max_val_duration: 12 # (s)
|
| 5 |
+
latent_hop_length: 320
|
| 6 |
+
ref_segment_duration: 6
|
| 7 |
+
volume_normalize: true
|
ar/Arabic-TTS-Spark (IbrahimSalah)/configuration_spark_tts.py
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2025 SparkAudio & The HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
# ... (License headers remain the same) ...
|
| 4 |
+
""" SparkTTS model configuration"""
|
| 5 |
+
|
| 6 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 7 |
+
from transformers.utils import logging
|
| 8 |
+
from typing import List, Optional # Added typing
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
logger = logging.get_logger(__name__)
|
| 12 |
+
|
| 13 |
+
# --- Define Individual Sub-Component Config Classes ---
|
| 14 |
+
|
| 15 |
+
class SparkTTSMelParamsConfig(PretrainedConfig):
|
| 16 |
+
"""Configuration for Mel Spectrogram parameters."""
|
| 17 |
+
model_type = "spark-tts-mel-params"
|
| 18 |
+
def __init__(self, sample_rate=16000, n_fft=1024, win_length=640, hop_length=320,
|
| 19 |
+
mel_fmin=10, mel_fmax=None, num_mels=128, **kwargs):
|
| 20 |
+
super().__init__(**kwargs)
|
| 21 |
+
self.sample_rate = sample_rate
|
| 22 |
+
self.n_fft = n_fft
|
| 23 |
+
self.win_length = win_length
|
| 24 |
+
self.hop_length = hop_length
|
| 25 |
+
self.mel_fmin = mel_fmin
|
| 26 |
+
self.mel_fmax = mel_fmax
|
| 27 |
+
self.num_mels = num_mels
|
| 28 |
+
|
| 29 |
+
class SparkTTSEncoderConfig(PretrainedConfig):
|
| 30 |
+
"""Configuration for the BiCodec Feature Encoder."""
|
| 31 |
+
model_type = "spark-tts-encoder"
|
| 32 |
+
def __init__(self, input_channels=1024, vocos_dim=384, vocos_intermediate_dim=2048,
|
| 33 |
+
vocos_num_layers=12, out_channels=1024, sample_ratios=[1, 1], **kwargs):
|
| 34 |
+
super().__init__(**kwargs)
|
| 35 |
+
self.input_channels = input_channels
|
| 36 |
+
self.vocos_dim = vocos_dim
|
| 37 |
+
self.vocos_intermediate_dim = vocos_intermediate_dim
|
| 38 |
+
self.vocos_num_layers = vocos_num_layers
|
| 39 |
+
self.out_channels = out_channels
|
| 40 |
+
self.sample_ratios = sample_ratios
|
| 41 |
+
|
| 42 |
+
class SparkTTSDecoderConfig(PretrainedConfig):
|
| 43 |
+
"""Configuration for the BiCodec Wave Generator (Decoder)."""
|
| 44 |
+
model_type = "spark-tts-decoder"
|
| 45 |
+
def __init__(self, input_channel=1024, channels=1536, rates=[8, 5, 4, 2],
|
| 46 |
+
kernel_sizes=[16, 11, 8, 4], **kwargs):
|
| 47 |
+
super().__init__(**kwargs)
|
| 48 |
+
self.input_channel = input_channel
|
| 49 |
+
self.channels = channels
|
| 50 |
+
self.rates = rates
|
| 51 |
+
self.kernel_sizes = kernel_sizes
|
| 52 |
+
|
| 53 |
+
class SparkTTSQuantizerConfig(PretrainedConfig):
|
| 54 |
+
"""Configuration for the BiCodec Factorized Vector Quantizer."""
|
| 55 |
+
model_type = "spark-tts-quantizer"
|
| 56 |
+
def __init__(self, input_dim=1024, codebook_size=8192, codebook_dim=8,
|
| 57 |
+
commitment=0.25, codebook_loss_weight=2.0, decay=0.99,
|
| 58 |
+
threshold_ema_dead_code=0.2, **kwargs):
|
| 59 |
+
# Note: Removed use_l2_normlize as it wasn't in the original class __init__ args
|
| 60 |
+
# Add it back if it's actually used by the FactorizedVectorQuantize class init
|
| 61 |
+
super().__init__(**kwargs)
|
| 62 |
+
self.input_dim = input_dim
|
| 63 |
+
self.codebook_size = codebook_size
|
| 64 |
+
self.codebook_dim = codebook_dim
|
| 65 |
+
self.commitment = commitment
|
| 66 |
+
self.codebook_loss_weight = codebook_loss_weight
|
| 67 |
+
self.decay = decay
|
| 68 |
+
self.threshold_ema_dead_code = threshold_ema_dead_code
|
| 69 |
+
|
| 70 |
+
class SparkTTSSpeakerEncoderConfig(PretrainedConfig):
|
| 71 |
+
"""Configuration for the BiCodec Speaker Encoder."""
|
| 72 |
+
model_type = "spark-tts-speaker-encoder"
|
| 73 |
+
def __init__(self, input_dim=128, out_dim=1024, latent_dim=128, token_num=32,
|
| 74 |
+
fsq_levels=[4, 4, 4, 4, 4, 4], fsq_num_quantizers=1, **kwargs):
|
| 75 |
+
super().__init__(**kwargs)
|
| 76 |
+
self.input_dim = input_dim
|
| 77 |
+
self.out_dim = out_dim
|
| 78 |
+
self.latent_dim = latent_dim
|
| 79 |
+
self.token_num = token_num
|
| 80 |
+
self.fsq_levels = fsq_levels
|
| 81 |
+
self.fsq_num_quantizers = fsq_num_quantizers
|
| 82 |
+
|
| 83 |
+
class SparkTTSPrenetConfig(PretrainedConfig):
|
| 84 |
+
"""Configuration for the BiCodec Prenet."""
|
| 85 |
+
model_type = "spark-tts-prenet"
|
| 86 |
+
def __init__(self, input_channels=1024, vocos_dim=384, vocos_intermediate_dim=2048,
|
| 87 |
+
vocos_num_layers=12, out_channels=1024, condition_dim=1024,
|
| 88 |
+
sample_ratios=[1, 1], use_tanh_at_final=False, **kwargs):
|
| 89 |
+
super().__init__(**kwargs)
|
| 90 |
+
self.input_channels = input_channels
|
| 91 |
+
self.vocos_dim = vocos_dim
|
| 92 |
+
self.vocos_intermediate_dim = vocos_intermediate_dim
|
| 93 |
+
self.vocos_num_layers = vocos_num_layers
|
| 94 |
+
self.out_channels = out_channels
|
| 95 |
+
self.condition_dim = condition_dim
|
| 96 |
+
self.sample_ratios = sample_ratios
|
| 97 |
+
self.use_tanh_at_final = use_tanh_at_final
|
| 98 |
+
|
| 99 |
+
class SparkTTSPostnetConfig(PretrainedConfig):
|
| 100 |
+
"""Configuration for the BiCodec Postnet."""
|
| 101 |
+
model_type = "spark-tts-postnet"
|
| 102 |
+
def __init__(self, input_channels=1024, vocos_dim=384, vocos_intermediate_dim=2048,
|
| 103 |
+
vocos_num_layers=6, out_channels=1024, use_tanh_at_final=False, **kwargs):
|
| 104 |
+
# Note: Removed condition_dim as it wasn't in the original config example for postnet
|
| 105 |
+
super().__init__(**kwargs)
|
| 106 |
+
self.input_channels = input_channels
|
| 107 |
+
self.vocos_dim = vocos_dim
|
| 108 |
+
self.vocos_intermediate_dim = vocos_intermediate_dim
|
| 109 |
+
self.vocos_num_layers = vocos_num_layers
|
| 110 |
+
self.out_channels = out_channels
|
| 111 |
+
self.use_tanh_at_final = use_tanh_at_final
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
# --- Define the Intermediate BiCodec Config Class ---
|
| 115 |
+
|
| 116 |
+
class SparkTTSBiCodecConfig(PretrainedConfig):
|
| 117 |
+
"""
|
| 118 |
+
Intermediate configuration class for the BiCodec component within SparkTTS.
|
| 119 |
+
It holds instances of the individual sub-component configurations.
|
| 120 |
+
"""
|
| 121 |
+
model_type = "spark-tts-bicodec"
|
| 122 |
+
# Map keys in the 'bicodec_config' dict to their respective classes
|
| 123 |
+
sub_configs = {
|
| 124 |
+
"mel_params": SparkTTSMelParamsConfig,
|
| 125 |
+
"encoder_config": SparkTTSEncoderConfig,
|
| 126 |
+
"decoder_config": SparkTTSDecoderConfig,
|
| 127 |
+
"quantizer_config": SparkTTSQuantizerConfig,
|
| 128 |
+
"speaker_encoder_config": SparkTTSSpeakerEncoderConfig,
|
| 129 |
+
"prenet_config": SparkTTSPrenetConfig,
|
| 130 |
+
"postnet_config": SparkTTSPostnetConfig,
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
def __init__(
|
| 134 |
+
self,
|
| 135 |
+
mel_params=None,
|
| 136 |
+
encoder_config=None,
|
| 137 |
+
decoder_config=None,
|
| 138 |
+
quantizer_config=None,
|
| 139 |
+
speaker_encoder_config=None,
|
| 140 |
+
prenet_config=None,
|
| 141 |
+
postnet_config=None,
|
| 142 |
+
**kwargs,
|
| 143 |
+
):
|
| 144 |
+
super().__init__(**kwargs)
|
| 145 |
+
|
| 146 |
+
# Instantiate sub-configs from dictionaries or use defaults/provided instances
|
| 147 |
+
self.mel_params = self._init_sub_config(mel_params, "mel_params")
|
| 148 |
+
self.encoder_config = self._init_sub_config(encoder_config, "encoder_config")
|
| 149 |
+
self.decoder_config = self._init_sub_config(decoder_config, "decoder_config")
|
| 150 |
+
self.quantizer_config = self._init_sub_config(quantizer_config, "quantizer_config")
|
| 151 |
+
self.speaker_encoder_config = self._init_sub_config(speaker_encoder_config, "speaker_encoder_config")
|
| 152 |
+
self.prenet_config = self._init_sub_config(prenet_config, "prenet_config")
|
| 153 |
+
self.postnet_config = self._init_sub_config(postnet_config, "postnet_config")
|
| 154 |
+
|
| 155 |
+
def _init_sub_config(self, config_input, config_key):
|
| 156 |
+
"""Helper to initialize sub-configs."""
|
| 157 |
+
config_cls = self.sub_configs[config_key]
|
| 158 |
+
if isinstance(config_input, dict):
|
| 159 |
+
return config_cls(**config_input)
|
| 160 |
+
elif config_input is None:
|
| 161 |
+
return config_cls() # Initialize with defaults
|
| 162 |
+
elif isinstance(config_input, config_cls):
|
| 163 |
+
return config_input # Already an instance
|
| 164 |
+
else:
|
| 165 |
+
raise TypeError(f"Invalid type for {config_key}: {type(config_input)}. Expected dict, None, or {config_cls.__name__}.")
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# --- Define the Main SparkTTS Config Class ---
|
| 169 |
+
|
| 170 |
+
class SparkTTSConfig(PretrainedConfig):
|
| 171 |
+
r"""
|
| 172 |
+
Main configuration class for SparkTTSModel, including nested BiCodec configuration.
|
| 173 |
+
Args:
|
| 174 |
+
llm_model_name_or_path (`str`, *optional*, defaults to `"./LLM"`): Path/ID for LLM.
|
| 175 |
+
bicodec_model_name_or_path (`str`, *optional*, defaults to `"./BiCodec"`): Path/ID for BiCodec checkpoint.
|
| 176 |
+
wav2vec2_model_name_or_path (`str`, *optional*, defaults to `"./wav2vec2-large-xlsr-53"`): Path/ID for Wav2Vec2.
|
| 177 |
+
sample_rate (`int`, *optional*, defaults to 16000): Audio sample rate.
|
| 178 |
+
# ... (other top-level args: highpass_cutoff_freq, latent_hop_length, ref_segment_duration, volume_normalize) ...
|
| 179 |
+
bicodec_config (`dict`, *optional*): Dictionary to initialize `SparkTTSBiCodecConfig`.
|
| 180 |
+
torch_dtype (`str`, *optional*, defaults to `"auto"`): Torch dtype.
|
| 181 |
+
kwargs (*optional*): Dictionary of keyword arguments.
|
| 182 |
+
"""
|
| 183 |
+
model_type = "spark-tts"
|
| 184 |
+
# Map the key in config.json to the intermediate BiCodec config class
|
| 185 |
+
sub_configs = {"bicodec_config": SparkTTSBiCodecConfig}
|
| 186 |
+
attribute_map = {"hidden_size": "d_model"} # Example
|
| 187 |
+
|
| 188 |
+
def __init__(
|
| 189 |
+
self,
|
| 190 |
+
llm_model_name_or_path="./LLM",
|
| 191 |
+
bicodec_model_name_or_path="./BiCodec",
|
| 192 |
+
wav2vec2_model_name_or_path="./wav2vec2-large-xlsr-53",
|
| 193 |
+
sample_rate=16000,
|
| 194 |
+
highpass_cutoff_freq=40,
|
| 195 |
+
latent_hop_length=320,
|
| 196 |
+
ref_segment_duration=6.0,
|
| 197 |
+
volume_normalize=True,
|
| 198 |
+
bicodec_config=None, # Expects a dictionary or None
|
| 199 |
+
torch_dtype="auto",
|
| 200 |
+
**kwargs,
|
| 201 |
+
):
|
| 202 |
+
# --- Top-level parameters ---
|
| 203 |
+
self.llm_model_name_or_path = llm_model_name_or_path
|
| 204 |
+
self.bicodec_model_name_or_path = bicodec_model_name_or_path
|
| 205 |
+
self.wav2vec2_model_name_or_path = wav2vec2_model_name_or_path
|
| 206 |
+
self.sample_rate = sample_rate
|
| 207 |
+
self.highpass_cutoff_freq = highpass_cutoff_freq
|
| 208 |
+
self.latent_hop_length = latent_hop_length
|
| 209 |
+
self.ref_segment_duration = ref_segment_duration
|
| 210 |
+
self.volume_normalize = volume_normalize
|
| 211 |
+
self.torch_dtype = torch_dtype
|
| 212 |
+
|
| 213 |
+
# --- Nested BiCodec Configuration ---
|
| 214 |
+
# Instantiate the intermediate BiCodec config class, which will handle its own sub-configs
|
| 215 |
+
if isinstance(bicodec_config, dict):
|
| 216 |
+
self.bicodec_config = self.sub_configs["bicodec_config"](**bicodec_config)
|
| 217 |
+
elif bicodec_config is None:
|
| 218 |
+
logger.info("`bicodec_config` not provided. Initializing `SparkTTSBiCodecConfig` with its defaults.")
|
| 219 |
+
self.bicodec_config = self.sub_configs["bicodec_config"]()
|
| 220 |
+
elif isinstance(bicodec_config, self.sub_configs["bicodec_config"]):
|
| 221 |
+
self.bicodec_config = bicodec_config # Use existing instance
|
| 222 |
+
else:
|
| 223 |
+
raise TypeError(f"Invalid type for bicodec_config: {type(bicodec_config)}. Expected dict, None, or SparkTTSBiCodecConfig.")
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
# Set processor class and auto_map
|
| 227 |
+
kwargs["processor_class"] = kwargs.get("processor_class", "SparkTTSProcessor")
|
| 228 |
+
kwargs["auto_map"] = kwargs.get("auto_map", {
|
| 229 |
+
"AutoConfig": "configuration_spark_tts.SparkTTSConfig",
|
| 230 |
+
"AutoModel": "modeling_spark_tts.SparkTTSModel",
|
| 231 |
+
"AutoProcessor": "processing_spark_tts.SparkTTSProcessor"
|
| 232 |
+
})
|
| 233 |
+
super().__init__(**kwargs)
|
ar/Arabic-TTS-Spark (IbrahimSalah)/modeling_spark_tts.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|