代码是快速体验内容 报错内容: 'segmentation-clustering is not in the pipelines registry group segmentation-clustering. Please make sure the correct version of ModelScope library is used.'
错误提示 'segmentation-clustering is not in the pipelines registry'。这个错误提示表明 ModelScope 没有找到名为 'segmentation-clustering' 的管道(pipeline)。
可能出现这个错误的原因是因为您使用的 ModelScope 版本过低,不支持 'segmentation-clustering' 管道。请确保您使用的是 ModelScope 1.6.1 或更高版本,以获得对 'segmentation-clustering' 管道的支持。
提供能在其他服务器ubuntu环境下跑通的脚本,亲测有效
环境如下:
Ubuntu 20.04 + Python3.8
+---------------------------------------------------------------------------------------+ | NVIDIA-SMI 530.30.02 Driver Version: 530.30.02 CUDA Version: 12.1 | |-----------------------------------------+----------------------+----------------------+
‘’‘ #!/bin/bash
cat>/etc/profile.d/proxy.sh<<EOF export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:32 EOF
apt update apt upgrade -y apt list --upgradable -a
apt-get install libsndfile1 sox nano wget curl git zip -y
apt autoclean -y apt autoremove -y
source /etc/profile.d/proxy.sh
git clone https://github.com/modelscope/modelscope.git
cd modelscope python -m pip install --upgrade pip pip install -r requirements/tests.txt pip install -r requirements/framework.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html pip install -r requirements/audio.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html pip install -r requirements/nlp.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html pip install . pip install tts-autolabel -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
pip install typeguard==2.13.3 pydantic==1.10.10 numpy==1.21.6 kantts==0.0.1 -y pip uninstall funasr -y
cd ~ wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/download_files/nltk_data.zip unzip nltk_data.zip
‘’‘
‘’‘
from modelscope.tools import run_auto_label from modelscope.metainfo import Trainers from modelscope.trainers import build_trainer from modelscope.utils.audio.audio_utils import TtsTrainType import os from modelscope.models.audio.tts import SambertHifigan from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks import torch print(torch.version) print(torch.cuda.is_available())
from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks
text = '待合成文本' model_id = 'damo/speech_sambert-hifigan_tts_zh-cn_16k' sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id) output = sambert_hifigan_tts(input=text, voice='zhitian_emo') wav = output[OutputKeys.OUTPUT_WAV] with open('output.wav', 'wb') as f: f.write(wav)
‘’‘
kwargs = dict( model=pretrained_model_id, # 指定要finetune的模型 model_revision = "v1.0.4", # 就是这里,只有改成1.0.4才顺利通过 work_dir=pretrain_work_dir, # 指定临时工作目录 train_dataset=dataset_id, # 指定数据集id train_type=train_info # 指定要训练类型及参数 )