your checkpoint love 'VoxCPM2Tokenizer' but ONLY 'LlamaTokenizerFast' is present.
pip install voxcpm==2.0.2
在调用 VoxCPM.from_pretrained(local_model_path) 时输出警告信息: The tokenizer class you load from this checkpoint is 'VoxCPM2Tokenizer'. The class this function is called from is 'LlamaTokenizerFast'.
按下面方法修改 .venv\Lib\site-packages\voxcpm\model\voxcpm2.py,可以消除这个警告。 所以请告诉我:号称 Tokenizer-Free 的模型要的 VoxCPM2Tokenizer 在哪里可以获得?开源吗?
from transformers import LlamaTokenizerFast
+ class VoxCPM2Tokenizer(LlamaTokenizerFast):
+ """VoxCPM2 Tokenizer"""
VoxCPM2Tokenizer
def from_local(cls, path: str, optimize: bool = True, training: bool = False, lora_config: LoRAConfig = None):
config = VoxCPMConfig.model_validate_json(open(os.path.join(path, "config.json")).read())
- tokenizer = LlamaTokenizerFast.from_pretrained(path)
+ tokenizer = VoxCPM2Tokenizer.from_pretrained(path)
我不是很清楚你想表达什么,能不能提供一下你的 python 各个包的环境信息。
你要的 tokenizer 是不是这个 https://huggingface.co/openbmb/VoxCPM2/blob/main/tokenization_voxcpm2.py
我的步骤如下:
- 安装 voxcpm 2.0.2
- modelscope下载模型到指定目录 model_path
from modelscope import snapshot_download
parent_dir = os.path.dirname(model_path)
downloaded_path = snapshot_download(
'OpenBMB/VoxCPM2',
cache_dir=parent_dir,
revision='master'
)
- 获得模型对象
logger.info(f"⏳ Initializing VoxCPM model from {model_path} (this may take a while)...")
self.model = VoxCPM.from_pretrained(model_path)
logger.info(f"✅ Initialized with model_path: {model_path}")
我对第3步输出的警告信息有疑问,不知道为什么模型要加载 VoxCPM2Tokenizer 这个 2.0.2 中不存在的 tokonizer 类型?
⏳ Initializing VoxCPM model from D:\llm-models\OpenBMB\VoxCPM2 (this may take a while)...
voxcpm_model_path: D:\llm-models\OpenBMB\VoxCPM2, zipenhancer_model_path: iic/speech_zipenhancer_ans_multiloss_16k_base, enable_denoiser: True
**The tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization.
The tokenizer class you load from this checkpoint is 'VoxCPM2Tokenizer'.
The class this function is called from is 'LlamaTokenizerFast'**.
D:\tony\bukreedor\.venv\Lib\site-packages\torch\nn\utils\weight_norm.py:144: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.
WeightNorm.apply(module, name, dim)
Loading AudioVAE from pytorch: D:\llm-models\OpenBMB\VoxCPM2\audiovae.pth
Running on device: cpu, dtype: bfloat16
以下是我的python 环境
> python --version
Python 3.12.10
> pip list
Package Version
----------------------------- ----------------
absl-py 2.4.0
accelerate 1.12.0
addict 2.4.0
aiofiles 24.1.0
aiohappyeyeballs 2.6.1
aiohttp 3.13.3
aiosignal 1.4.0
albucore 0.0.24
albumentations 2.0.8
aliyun-python-sdk-core 2.16.0
aliyun-python-sdk-kms 2.16.5
annotated-doc 0.0.4
annotated-types 0.7.0
antlr4-python3-runtime 4.9.3
anyascii 0.3.3
anyio 4.12.1
argbind 0.3.9
attrs 25.4.0
audioread 3.1.0
av 16.1.0
beautifulsoup4 4.14.3
bitsandbytes 0.49.2
boto3 1.42.63
botocore 1.42.63
brotli 1.2.0
cached_path 1.8.10
certifi 2026.1.4
cffi 2.0.0
cfgv 3.5.0
charset-normalizer 3.4.4
click 8.3.1
cobble 0.1.4
colorama 0.4.6
colorlog 6.10.1
comtypes 1.4.16
contourpy 1.3.3
contractions 0.1.73
coqpit-config 0.2.4
coqui-tts 0.27.5
coqui-tts-trainer 0.3.3
coverage 7.13.4
crcmod 1.7
cryptography 46.0.5
cycler 0.12.1
datasets 3.6.0
decorator 5.2.1
dill 0.3.7
distlib 0.4.0
distro 1.9.0
doclayout_yolo 0.0.4
docopt 0.6.2
docstring_parser 0.18.0
editdistance 0.8.1
einops 0.8.2
einx 0.4.3
ema-pytorch 0.7.9
encodec 0.1.1
et_xmlfile 2.0.0
f5-tts 1.1.18
fast-langdetect 0.2.5
fastapi 0.132.0
fasttext-predict 0.9.2.4
ffmpeg 1.4
ffmpy 1.0.0
filelock 3.24.3
fire 0.7.1
flatbuffers 25.12.19
fonttools 4.61.1
frozendict 2.4.7
frozenlist 1.8.0
fsspec 2025.3.0
ftfy 6.3.1
funasr 1.3.1
gitdb 4.0.12
GitPython 3.1.46
google-api-core 2.30.3
google-auth 2.49.2
google-cloud-core 2.5.1
google-cloud-storage 3.10.1
google-crc32c 1.8.0
google-resumable-media 2.8.2
googleapis-common-protos 1.74.0
gradio 6.12.0
gradio_client 2.4.1
gradio_pdf 0.0.22
groovy 0.1.2
grpcio 1.78.1
h11 0.16.0
hf-gradio 0.3.0
hf-xet 1.2.0
httpcore 1.0.9
httpx 0.28.1
httpx-retries 0.4.6
huggingface_hub 0.36.2
hydra-core 1.3.2
identify 2.6.16
idna 3.11
ImageIO 2.37.2
inflect 7.5.0
iniconfig 2.3.0
jaconv 0.5.0
jamo 0.4.1
jieba 0.42.1
Jinja2 3.1.6
jiter 0.13.0
jmespath 0.10.0
joblib 1.5.3
json_repair 0.58.4
kaldifst 1.8.0
kaldiio 2.18.1
kiwisolver 1.4.9
ko-speech-tools 0.1.0
langdetect 1.0.9
lazy_loader 0.4
librosa 0.11.0
librt 0.8.1
llvmlite 0.46.0
loguru 0.7.3
lxml 6.0.2
magika 1.0.2
mammoth 1.12.0
Markdown 3.10.2
markdown-it-py 4.0.0
MarkupSafe 3.0.3
matplotlib 3.10.8
mccabe 0.7.0
mdurl 0.1.2
mineru 3.1.6
mineru_vl_utils 0.2.6
modelscope 1.34.0
monotonic-alignment-search 0.2.1
more-itertools 10.8.0
mpmath 1.3.0
msgpack 1.1.2
multidict 6.7.1
multiprocess 0.70.15
mypy_extensions 1.1.0
networkx 3.6.1
nodeenv 1.10.0
num2words 0.5.14
numba 0.64.0
numpy 2.4.4
omegaconf 2.3.0
onnxruntime 1.24.3
openai 1.109.1
openai-whisper 20250625
opencv-python 4.13.0.92
opencv-python-headless 4.13.0.92
openpyxl 3.1.5
orjson 3.11.7
oss2 2.19.1
packaging 26.0
pandas 2.3.3
pathspec 1.0.4
pdfminer.six 20260107
pdftext 0.6.3
pillow 11.3.0
pip 26.0.1
platformdirs 4.9.2
pluggy 1.6.0
polars 1.38.1
polars-runtime-32 1.38.1
pooch 1.9.0
propcache 0.4.1
proto-plus 1.27.2
protobuf 6.33.5
psutil 7.2.2
py-cpuinfo 9.0.0
pyahocorasick 2.3.1
pyarrow 23.0.1
pyasn1 0.6.3
pyasn1_modules 0.4.2
pyclipper 1.4.0
pycodestyle 2.14.0
pycparser 3.0
pycryptodome 3.23.0
pydantic 2.10.6
pydantic_core 2.27.2
pydantic-settings 2.13.1
pydub 0.25.1
pyflakes 3.4.0
Pygments 2.19.2
pylatexenc 2.10
PyMuPDF 1.24.14
pynndescent 0.6.0
pyparsing 3.3.2
pypdf 6.7.5
PyPDF2 3.0.1
pypdfium2 4.30.0
pypinyin 0.55.0
pypptx-with-oxml 1.0.3
pysbd 0.3.4
pytest 9.0.2
pytest-cov 7.0.0
python-dateutil 2.9.0.post0
python-docx 1.2.0
python-dotenv 1.2.1
python-fire 0.1.0
python-multipart 0.0.22
pytokens 0.4.1
pytorch-wpe 0.0.1
pytz 2025.2
PyYAML 6.0.3
qwen-tts 0.1.1
qwen-vl-utils 0.0.14
rapid-table 1.0.5
regex 2026.2.19
reportlab 4.4.10
requests 2.32.5
rich 13.9.4
rjieba 0.2.0
robust-downloader 0.0.2
ruff 0.15.10
s3transfer 0.16.0
safehttpx 0.1.7
safetensors 0.7.0
scikit-image 0.26.0
scikit-learn 1.8.0
scipy 1.17.1
seaborn 0.13.2
semantic-version 2.10.0
sentencepiece 0.2.1
sentry-sdk 2.58.0
setuptools 81.0.0
shapely 2.1.2
shellingham 1.5.4
simplejson 4.1.1
simsimd 6.5.15
six 1.17.0
smmap 5.0.3
sniffio 1.3.1
sortedcontainers 2.4.0
soundfile 0.13.1
soupsieve 2.8.3
sox 1.5.0
soxr 1.0.0
spaces 0.49.0
starlette 0.52.1
stringzilla 4.6.0
sympy 1.14.0
tensorboard 2.20.0
tensorboard-data-server 0.7.2
tensorboardX 2.6.5
termcolor 3.3.0
textsearch 0.0.24
thop 0.1.1-2209072238
threadpoolctl 3.6.0
tifffile 2026.3.3
tiktoken 0.12.0
tokenizers 0.22.2
tomli 2.4.1
tomlkit 0.13.3
torch 2.8.0
torch-complex 0.4.4
torchaudio 2.8.0
torchcodec 0.8.0
torchdiffeq 0.2.5
torchvision 0.23.0
tqdm 4.67.3
transformers 4.57.3
transformers-stream-generator 0.0.5
typeguard 4.5.1
typer 0.24.1
typer-slim 0.24.0
typing_extensions 4.15.0
typing-inspection 0.4.2
tzdata 2025.3
ultralytics 8.4.21
ultralytics-thop 2.0.18
umap-learn 0.5.12
Unidecode 1.4.0
urllib3 2.6.3
uvicorn 0.41.0
virtualenv 20.39.0
vocos 0.1.0
voxcpm 2.0.2
wandb 0.26.0
wcwidth 0.6.0
websockets 15.0.1
Werkzeug 3.1.6
wetext 0.1.2
wheel 0.46.3
win32_setctime 1.2.0
x-transformers 2.17.10
xlsxwriter 3.2.9
xxhash 3.6.0
yarl 1.22.0
当然,我不确定这个警告和“VoxCPM is a tokenizer-free Text-to-Speech system that directly generates continuous speech representations via an end-to-end diffusion autoregressive architecture, bypassing discrete tokenization to achieve highly natural and expressive synthesis.” 的描述是否矛盾?
I've been posting a bunch of VoxCPM2 stuff this week to my YouTube channel and I love how it's totally freaking people out and they're saying how much they hate it, which means it's hitting a nerve, which means it's really good. But this one was worth sharing here as I show a VoxCPM2 snippet passing an A.I. detector test. 99 percent sure it's human. LOL!!! https://youtube.com/shorts/uJgyIIgjOo0?feature=share
On Wed, May 13, 2026 at 8:17 AM Tonyfield @.***> wrote:
Tonyfield left a comment (OpenBMB/VoxCPM#299) https://github.com/OpenBMB/VoxCPM/issues/299#issuecomment-4442440211
我的步骤如下:
安装 voxcpm 2.0.2
modelscope下载模型到指定目录 model_path
from modelscope import snapshot_download parent_dir = os.path.dirname(model_path) downloaded_path = snapshot_download( 'OpenBMB/VoxCPM2', cache_dir=parent_dir, revision='master' )获得模型对象
logger.info(f"⏳ Initializing VoxCPM model from {model_path} (this may take a while)...") self.model = VoxCPM.from_pretrained(model_path) logger.info(f"✅ Initialized with model_path: {model_path}")我对第3步输出的警告信息有疑问,不知道为什么模型要加载 VoxCPM2Tokenizer 这个 2.0.2 中不存在的 tokonizer 类型?
⏳ Initializing VoxCPM model from D:\llm-models\OpenBMB\VoxCPM2 (this may take a while)... voxcpm_model_path: D:\llm-models\OpenBMB\VoxCPM2, zipenhancer_model_path: iic/speech_zipenhancer_ans_multiloss_16k_base, enable_denoiser: TrueThe tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization. The tokenizer class you load from this checkpoint is 'VoxCPM2Tokenizer'. The class this function is called from is 'LlamaTokenizerFast'. D:\tony\bukreedor.venv\Lib\site-packages\torch\nn\utils\weight_norm.py:144: FutureWarning:
torch.nn.utils.weight_normis deprecated in favor oftorch.nn.utils.parametrizations.weight_norm. WeightNorm.apply(module, name, dim) Loading AudioVAE from pytorch: D:\llm-models\OpenBMB\VoxCPM2\audiovae.pth Running on device: cpu, dtype: bfloat16以下是我的python 环境
python --version Python 3.12.10> pip list Package Version
absl-py 2.4.0 accelerate 1.12.0 addict 2.4.0 aiofiles 24.1.0 aiohappyeyeballs 2.6.1 aiohttp 3.13.3 aiosignal 1.4.0 albucore 0.0.24 albumentations 2.0.8 aliyun-python-sdk-core 2.16.0 aliyun-python-sdk-kms 2.16.5 annotated-doc 0.0.4 annotated-types 0.7.0 antlr4-python3-runtime 4.9.3 anyascii 0.3.3 anyio 4.12.1 argbind 0.3.9 attrs 25.4.0 audioread 3.1.0 av 16.1.0 beautifulsoup4 4.14.3 bitsandbytes 0.49.2 boto3 1.42.63 botocore 1.42.63 brotli 1.2.0 cached_path 1.8.10 certifi 2026.1.4 cffi 2.0.0 cfgv 3.5.0 charset-normalizer 3.4.4 click 8.3.1 cobble 0.1.4 colorama 0.4.6 colorlog 6.10.1 comtypes 1.4.16 contourpy 1.3.3 contractions 0.1.73 coqpit-config 0.2.4 coqui-tts 0.27.5 coqui-tts-trainer 0.3.3 coverage 7.13.4 crcmod 1.7 cryptography 46.0.5 cycler 0.12.1 datasets 3.6.0 decorator 5.2.1 dill 0.3.7 distlib 0.4.0 distro 1.9.0 doclayout_yolo 0.0.4 docopt 0.6.2 docstring_parser 0.18.0 editdistance 0.8.1 einops 0.8.2 einx 0.4.3 ema-pytorch 0.7.9 encodec 0.1.1 et_xmlfile 2.0.0 f5-tts 1.1.18 fast-langdetect 0.2.5 fastapi 0.132.0 fasttext-predict 0.9.2.4 ffmpeg 1.4 ffmpy 1.0.0 filelock 3.24.3 fire 0.7.1 flatbuffers 25.12.19 fonttools 4.61.1 frozendict 2.4.7 frozenlist 1.8.0 fsspec 2025.3.0 ftfy 6.3.1 funasr 1.3.1 gitdb 4.0.12 GitPython 3.1.46 google-api-core 2.30.3 google-auth 2.49.2 google-cloud-core 2.5.1 google-cloud-storage 3.10.1 google-crc32c 1.8.0 google-resumable-media 2.8.2 googleapis-common-protos 1.74.0 gradio 6.12.0 gradio_client 2.4.1 gradio_pdf 0.0.22 groovy 0.1.2 grpcio 1.78.1 h11 0.16.0 hf-gradio 0.3.0 hf-xet 1.2.0 httpcore 1.0.9 httpx 0.28.1 httpx-retries 0.4.6 huggingface_hub 0.36.2 hydra-core 1.3.2 identify 2.6.16 idna 3.11 ImageIO 2.37.2 inflect 7.5.0 iniconfig 2.3.0 jaconv 0.5.0 jamo 0.4.1 jieba 0.42.1 Jinja2 3.1.6 jiter 0.13.0 jmespath 0.10.0 joblib 1.5.3 json_repair 0.58.4 kaldifst 1.8.0 kaldiio 2.18.1 kiwisolver 1.4.9 ko-speech-tools 0.1.0 langdetect 1.0.9 lazy_loader 0.4 librosa 0.11.0 librt 0.8.1 llvmlite 0.46.0 loguru 0.7.3 lxml 6.0.2 magika 1.0.2 mammoth 1.12.0 Markdown 3.10.2 markdown-it-py 4.0.0 MarkupSafe 3.0.3 matplotlib 3.10.8 mccabe 0.7.0 mdurl 0.1.2 mineru 3.1.6 mineru_vl_utils 0.2.6 modelscope 1.34.0 monotonic-alignment-search 0.2.1 more-itertools 10.8.0 mpmath 1.3.0 msgpack 1.1.2 multidict 6.7.1 multiprocess 0.70.15 mypy_extensions 1.1.0 networkx 3.6.1 nodeenv 1.10.0 num2words 0.5.14 numba 0.64.0 numpy 2.4.4 omegaconf 2.3.0 onnxruntime 1.24.3 openai 1.109.1 openai-whisper 20250625 opencv-python 4.13.0.92 opencv-python-headless 4.13.0.92 openpyxl 3.1.5 orjson 3.11.7 oss2 2.19.1 packaging 26.0 pandas 2.3.3 pathspec 1.0.4 pdfminer.six 20260107 pdftext 0.6.3 pillow 11.3.0 pip 26.0.1 platformdirs 4.9.2 pluggy 1.6.0 polars 1.38.1 polars-runtime-32 1.38.1 pooch 1.9.0 propcache 0.4.1 proto-plus 1.27.2 protobuf 6.33.5 psutil 7.2.2 py-cpuinfo 9.0.0 pyahocorasick 2.3.1 pyarrow 23.0.1 pyasn1 0.6.3 pyasn1_modules 0.4.2 pyclipper 1.4.0 pycodestyle 2.14.0 pycparser 3.0 pycryptodome 3.23.0 pydantic 2.10.6 pydantic_core 2.27.2 pydantic-settings 2.13.1 pydub 0.25.1 pyflakes 3.4.0 Pygments 2.19.2 pylatexenc 2.10 PyMuPDF 1.24.14 pynndescent 0.6.0 pyparsing 3.3.2 pypdf 6.7.5 PyPDF2 3.0.1 pypdfium2 4.30.0 pypinyin 0.55.0 pypptx-with-oxml 1.0.3 pysbd 0.3.4 pytest 9.0.2 pytest-cov 7.0.0 python-dateutil 2.9.0.post0 python-docx 1.2.0 python-dotenv 1.2.1 python-fire 0.1.0 python-multipart 0.0.22 pytokens 0.4.1 pytorch-wpe 0.0.1 pytz 2025.2 PyYAML 6.0.3 qwen-tts 0.1.1 qwen-vl-utils 0.0.14 rapid-table 1.0.5 regex 2026.2.19 reportlab 4.4.10 requests 2.32.5 rich 13.9.4 rjieba 0.2.0 robust-downloader 0.0.2 ruff 0.15.10 s3transfer 0.16.0 safehttpx 0.1.7 safetensors 0.7.0 scikit-image 0.26.0 scikit-learn 1.8.0 scipy 1.17.1 seaborn 0.13.2 semantic-version 2.10.0 sentencepiece 0.2.1 sentry-sdk 2.58.0 setuptools 81.0.0 shapely 2.1.2 shellingham 1.5.4 simplejson 4.1.1 simsimd 6.5.15 six 1.17.0 smmap 5.0.3 sniffio 1.3.1 sortedcontainers 2.4.0 soundfile 0.13.1 soupsieve 2.8.3 sox 1.5.0 soxr 1.0.0 spaces 0.49.0 starlette 0.52.1 stringzilla 4.6.0 sympy 1.14.0 tensorboard 2.20.0 tensorboard-data-server 0.7.2 tensorboardX 2.6.5 termcolor 3.3.0 textsearch 0.0.24 thop 0.1.1-2209072238 threadpoolctl 3.6.0 tifffile 2026.3.3 tiktoken 0.12.0 tokenizers 0.22.2 tomli 2.4.1 tomlkit 0.13.3 torch 2.8.0 torch-complex 0.4.4 torchaudio 2.8.0 torchcodec 0.8.0 torchdiffeq 0.2.5 torchvision 0.23.0 tqdm 4.67.3 transformers 4.57.3 transformers-stream-generator 0.0.5 typeguard 4.5.1 typer 0.24.1 typer-slim 0.24.0 typing_extensions 4.15.0 typing-inspection 0.4.2 tzdata 2025.3 ultralytics 8.4.21 ultralytics-thop 2.0.18 umap-learn 0.5.12 Unidecode 1.4.0 urllib3 2.6.3 uvicorn 0.41.0 virtualenv 20.39.0 vocos 0.1.0 voxcpm 2.0.2 wandb 0.26.0 wcwidth 0.6.0 websockets 15.0.1 Werkzeug 3.1.6 wetext 0.1.2 wheel 0.46.3 win32_setctime 1.2.0 x-transformers 2.17.10 xlsxwriter 3.2.9 xxhash 3.6.0 yarl 1.22.0
当然,我不确定这个警告和“VoxCPM is a tokenizer-free Text-to-Speech system that directly generates continuous speech representations via an end-to-end diffusion autoregressive architecture, bypassing discrete tokenization to achieve highly natural and expressive synthesis.” 的描述是否矛盾?
— Reply to this email directly, view it on GitHub https://github.com/OpenBMB/VoxCPM/issues/299#issuecomment-4442440211, or unsubscribe https://github.com/notifications/unsubscribe-auth/B7M2BXKA5PIN55Z4P5S75UT42SGYJAVCNFSM6AAAAACYXW6CS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINBSGQ2DAMRRGE . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
@Tonyfield 我知道你的问题了,你试下从 huggingface 拉去镜像(可以用 hf mirror)能不能解决问题呢。modelscope 上的模型还需要时间排查下问题。 另外对于你说的 tokenizer-free 是指的是音频部分不需要 token,如果你对相关工作感兴趣可以去阅读一下技术报告。