Skip to content

Commit 3047591

Browse files
committed
fix lint
1 parent 5a00aef commit 3047591

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

cosyvoice/llm/llm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ def forward_dpo(
401401
speech_token_combined_emb = self.speech_embedding(speech_token_combined)
402402

403403
# 3. prepare llm_input/target
404-
lm_target, lm_input, lm_input_len = self.prepare_lm_input_target(text_token.repeat(2, 1), text_token_emb.repeat(2, 1, 1), text_token_len.repeat(2), speech_token_combined, speech_token_combined_emb, speech_token_combined_len)
404+
lm_target, lm_input, lm_input_len = self.prepare_lm_input_target(text_token.repeat(2, 1), text_token_emb.repeat(2, 1, 1), text_token_len.repeat(2), \
405+
speech_token_combined, speech_token_combined_emb, speech_token_combined_len)
405406
lm_target = lm_target.to(device)
406407

407408
# 4. run lm forward

examples/libritts/cosyvoice/local/prepare_reject_sample.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import logging
33
import os
44
from tqdm import tqdm
5-
import torch, torchaudio
5+
import torch
6+
import torchaudio
67
from cosyvoice.cli.cosyvoice import CosyVoice2
78
from cosyvoice.utils.file_utils import load_wav
89

@@ -30,7 +31,7 @@ def main():
3031
if prompt_speech_16k.shape[1] >= 30 * 16000:
3132
continue
3233
speech_list = []
33-
for i, j in enumerate(cosyvoice.inference_zero_shot(utt2text[utt], utt2text[utt], prompt_speech_16k, stream=False, text_frontend=False)):
34+
for _, j in enumerate(cosyvoice.inference_zero_shot(utt2text[utt], utt2text[utt], prompt_speech_16k, stream=False, text_frontend=False)):
3435
speech_list.append(j['tts_speech'])
3536
negative_wav = os.path.abspath('{}/wav/{}'.format(args.des_dir, os.path.basename(wav)))
3637
torchaudio.save(negative_wav, torch.concat(speech_list, dim=1), cosyvoice.sample_rate, backend='soundfile')

vllm_example.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
from cosyvoice.utils.common import set_all_random_seed
1010
from tqdm import tqdm
1111

12+
1213
def main():
1314
cosyvoice = CosyVoice2('pretrained_models/CosyVoice2-0.5B', load_jit=True, load_trt=True, load_vllm=True, fp16=True)
1415
prompt_speech_16k = load_wav('./asset/zero_shot_prompt.wav', 16000)
1516
for i in tqdm(range(100)):
1617
set_all_random_seed(i)
17-
for i, j in enumerate(cosyvoice.inference_zero_shot('收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。', '希望你以后能够做的比我还好呦。', prompt_speech_16k, stream=False)):
18+
for _, _ in enumerate(cosyvoice.inference_zero_shot('收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。', '希望你以后能够做的比我还好呦。', prompt_speech_16k, stream=False)):
1819
continue
1920

20-
if __name__=='__main__':
21+
22+
if __name__ == '__main__':
2123
main()

0 commit comments

Comments
 (0)