#5781 翻译字幕阶段出错 [Hy-MT2-1.8B(本地内置)] Couldn't instantiate the backend tokenizer from one of: (1) a `tokenizers` library serializ

2409:8a02* Posted at: 2 days ago

翻译字幕阶段出错 [Hy-MT2-1.8B(本地内置)] Couldn't instantiate the backend tokenizer from one of:
(1) a tokenizers library serialization file,
(2) a slow tokenizer instance to convert or
(3) an equivalent slow tokenizer class to instantiate and convert.
You need to have sentencepiece or tiktoken installed to convert a slow tokenizer to a fast one.
Traceback (most recent call last):

File "videotrans\task\job.py", line 35, in run

File "videotrans\task\job.py", line 135, in process_task

File "videotrans\task\translate_srt.py", line 47, in trans

File "videotrans\translator\_runner.py", line 63, in run

File "videotrans\translator\_base.py", line 68, in run

File "videotrans\translator\_base.py", line 91, in _run_text

File "videotrans\translator\_base.py", line 136, in _hymt2

File "D:\Download\win-pyvideotrans-v4.05-0709\_internal\transformers\models\auto\tokenization_auto.py", line 773, in from_pretrained

return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)

File "D:\Download\win-pyvideotrans-v4.05-0709\_internal\transformers\tokenization_utils_base.py", line 1721, in from_pretrained

return cls._from_pretrained(

File "D:\Download\win-pyvideotrans-v4.05-0709\_internal\transformers\tokenization_utils_base.py", line 1910, in _from_pretrained

tokenizer = cls(*init_inputs, **init_kwargs)

File "D:\Download\win-pyvideotrans-v4.05-0709\_internal\transformers\tokenization_utils_tokenizers.py", line 341, in init

raise ValueError(

ValueError: Couldn't instantiate the backend tokenizer from one of:
(1) a tokenizers library serialization file,
(2) a slow tokenizer instance to convert or
(3) an equivalent slow tokenizer class to instantiate and convert.
You need to have sentencepiece or tiktoken installed to convert a slow tokenizer to a fast one.
cfg=TaskCfgSTS(uuid='14a23f78b0', name='C:/Users/ilove/Desktop/bandicam 2026-07-12 01-56-58-841.srt', dirname='C:/Users/ilove/Desktop', noextname='bandicam 2026-07-12 01-56-58-841', basename='bandicam 2026-07-12 01-56-58-841.srt', ext='srt', target_dir='C:/Users/ilove/Desktop', cache_folder=None, is_cuda=False, source_language=None, source_language_code='Japanese', source_sub='C:/Users/ilove/Desktop/bandicam 2026-07-12 01-56-58-841.srt', source_wav=None, source_wav_output=None, target_language=None, target_language_code='Simplified Chinese', target_sub='C:/Users/ilove/Desktop/bandicam 2026-07-12 01-56-58-841.Simplified Chinese.srt', target_wav=None, target_wav_output=None, translate_type=3)


=
system:Windows-10-10.0.22631-SP0
version:v4.05
frozen:True
language:zh
root_dir:D:/Download/win-pyvideotrans-v4.05-0709

1 Replies

这个错误是由于 Hy-MT2-1.8B 模型文件下载不完整或缺少 tokenizer 组件(如 tokenizer.jsonsentencepiece 模型文件)导致的。

解决方案:

  1. 检查模型目录完整性:进入软件安装目录下的 models/models--tencent--Hy-MT2-1.8B 文件夹,确认是否包含所有必要的文件(尤其是 tokenizer.jsontokenizer_config.jsonmodel.safetensorspytorch_model.bin 等)。
  2. 若文件不全,请手动删除该文件夹,重新运行软件并再次触发翻译任务(软件会自动重新下载模型)。由于模型较大,网络不稳定可能导致下载中断,建议保持网络稳定或使用科学上网工具,若自动下载多次失败,可手动从 HuggingFace 仓库 下载所有文件并放入该目录。
  3. 如果网络条件有限,也可切换为其他翻译渠道(如 Google 翻译、Microsoft 翻译),避免使用依赖本地模型的 Hy-MT2。在翻译渠道中选择免费传统翻译即可。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Dondate via PayPal

Related resource