tanbw commited on
Commit
1383b23
1 Parent(s): c4011c4

no message

Browse files
Files changed (4) hide show
  1. README.md +2 -4
  2. deploy.sh +9 -7
  3. requirements_.txt → requirements.txt +0 -0
  4. webui.py +22 -16
README.md CHANGED
@@ -1,11 +1,9 @@
1
  ---
2
- license: apache-2.0
3
  title: CosyVoice
4
  sdk: gradio
5
  emoji: 🏃
6
  colorFrom: yellow
7
  colorTo: green
8
- python_version: 3.8.20
9
- sdk_version: 4.44.0
10
- app_file: deploy.py
11
  ---
 
1
  ---
 
2
  title: CosyVoice
3
  sdk: gradio
4
  emoji: 🏃
5
  colorFrom: yellow
6
  colorTo: green
7
+ python_version: 3.8.9
8
+ app_file: webui.py
 
9
  ---
deploy.sh CHANGED
@@ -3,23 +3,23 @@ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
3
  sh Miniconda3-latest-Linux-x86_64.sh -b
4
  source ~/miniconda3/bin/activate
5
 
6
- conda create -n cosyvoice python=3.8
7
- conda activate cosyvoice
8
- conda install -y -c conda-forge pynini==2.1.5
9
  # pynini is required by WeTextProcessing, use conda to install it as it can be executed on all platform.
10
  pip install -r requirements_.txt
11
 
12
  # If you encounter sox compatibility issues
13
  # ubuntu
14
  apt-get -y update
15
- apt-get install sox libsox-dev
16
 
17
  mkdir -p pretrained_models
18
- git clone https://www.modelscope.cn/iic/CosyVoice-300M.git pretrained_models/CosyVoice-300M
19
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-25Hz.git pretrained_models/CosyVoice-300M-25Hz
20
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-SFT.git pretrained_models/CosyVoice-300M-SFT
21
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-Instruct.git pretrained_models/CosyVoice-300M-Instruct
22
- git clone https://www.modelscope.cn/iic/CosyVoice-ttsfrd.git pretrained_models/CosyVoice-ttsfrd
23
  #huggingface-cli download model-scope/CosyVoice-300M --local-dir pretrained_models/CosyVoice-300M --token=$hf_token
24
  #huggingface-cli download model-scope/CosyVoice-300M-SFT --local-dir pretrained_models/CosyVoice-300M-SFT --token=$hf_token
25
  #huggingface-cli download FunAudioLLM/CosyVoice-ttsfrd --local-dir pretrained_models/CosyVoice-ttsfrd --token=$hf_token
@@ -30,4 +30,6 @@ cd pretrained_models/CosyVoice-ttsfrd/
30
  unzip resource.zip -d .
31
  pip install ttsfrd-0.3.6-cp38-cp38-linux_x86_64.whl
32
 
33
- export PYTHONPATH=third_party/Matcha-TTS
 
 
 
3
  sh Miniconda3-latest-Linux-x86_64.sh -b
4
  source ~/miniconda3/bin/activate
5
 
6
+ #conda create -n cosyvoice python=3.8
7
+ #conda activate cosyvoice
8
+ #conda install -y -c conda-forge pynini==2.1.5
9
  # pynini is required by WeTextProcessing, use conda to install it as it can be executed on all platform.
10
  pip install -r requirements_.txt
11
 
12
  # If you encounter sox compatibility issues
13
  # ubuntu
14
  apt-get -y update
15
+ apt-get -y install sox libsox-dev
16
 
17
  mkdir -p pretrained_models
18
+ #git clone https://www.modelscope.cn/iic/CosyVoice-300M.git pretrained_models/CosyVoice-300M
19
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-25Hz.git pretrained_models/CosyVoice-300M-25Hz
20
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-SFT.git pretrained_models/CosyVoice-300M-SFT
21
  #git clone https://www.modelscope.cn/iic/CosyVoice-300M-Instruct.git pretrained_models/CosyVoice-300M-Instruct
22
+ #git clone https://www.modelscope.cn/iic/CosyVoice-ttsfrd.git pretrained_models/CosyVoice-ttsfrd
23
  #huggingface-cli download model-scope/CosyVoice-300M --local-dir pretrained_models/CosyVoice-300M --token=$hf_token
24
  #huggingface-cli download model-scope/CosyVoice-300M-SFT --local-dir pretrained_models/CosyVoice-300M-SFT --token=$hf_token
25
  #huggingface-cli download FunAudioLLM/CosyVoice-ttsfrd --local-dir pretrained_models/CosyVoice-ttsfrd --token=$hf_token
 
30
  unzip resource.zip -d .
31
  pip install ttsfrd-0.3.6-cp38-cp38-linux_x86_64.whl
32
 
33
+ export PYTHONPATH=third_party/Matcha-TTS
34
+
35
+ python3 webui.py
requirements_.txt → requirements.txt RENAMED
File without changes
webui.py CHANGED
@@ -132,7 +132,7 @@ def generate_audio(tts_text, mode_checkbox_group, sft_dropdown, prompt_text, pro
132
  yield (target_sr, i['tts_speech'].numpy().flatten())
133
 
134
 
135
- def main(args,sft_spk):
136
  with gr.Blocks() as demo:
137
  gr.Markdown("### 代码库 [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) \
138
  预训练模型 [CosyVoice-300M](https://www.modelscope.cn/models/iic/CosyVoice-300M) \
@@ -171,18 +171,24 @@ def main(args,sft_spk):
171
  demo.launch(server_name='0.0.0.0', server_port=args.port)
172
 
173
 
174
- if __name__ == '__main__':
175
- parser = argparse.ArgumentParser()
176
- parser.add_argument('--port',
177
- type=int,
178
- default=8000)
179
- parser.add_argument('--model_dir',
180
- type=str,
181
- default='pretrained_models/CosyVoice-300M',
182
- help='local path or modelscope repo id')
183
- args = parser.parse_args()
184
- cosyvoice = CosyVoice(args.model_dir)
185
- sft_spk = cosyvoice.list_avaliable_spks()
186
- prompt_sr, target_sr = 16000, 22050
187
- default_data = np.zeros(target_sr)
188
- main(args)
 
 
 
 
 
 
 
132
  yield (target_sr, i['tts_speech'].numpy().flatten())
133
 
134
 
135
+ def main():
136
  with gr.Blocks() as demo:
137
  gr.Markdown("### 代码库 [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) \
138
  预训练模型 [CosyVoice-300M](https://www.modelscope.cn/models/iic/CosyVoice-300M) \
 
171
  demo.launch(server_name='0.0.0.0', server_port=args.port)
172
 
173
 
174
+
175
+ # SDK模型下载
176
+ from modelscope import snapshot_download
177
+ snapshot_download('iic/CosyVoice-300M', local_dir='pretrained_models/CosyVoice-300M')
178
+
179
+ os.system('apt-get -y update && apt-get -y install sox libsox-dev')
180
+
181
+ parser = argparse.ArgumentParser()
182
+ parser.add_argument('--port',
183
+ type=int,
184
+ default=8000)
185
+ parser.add_argument('--model_dir',
186
+ type=str,
187
+ default='pretrained_models/CosyVoice-300M',
188
+ help='local path or modelscope repo id')
189
+ args = parser.parse_args()
190
+ cosyvoice = CosyVoice(args.model_dir)
191
+ sft_spk = cosyvoice.list_avaliable_spks()
192
+ prompt_sr, target_sr = 16000, 22050
193
+ default_data = np.zeros(target_sr)
194
+ main()