Traceback (most recent call last):
File "/content/DiffRhythm-hf/app.py", line 28, in
cfm, tokenizer, muq, vae = prepare_model(device)
^^^^^^^^^^^^^^^^^^^^^
File "/content/DiffRhythm-hf/diffrhythm/infer/infer_utils.py", line 29, in prepare_model
tokenizer = CNENTokenizer()
^^^^^^^^^^^^^^^
File "/content/DiffRhythm-hf/diffrhythm/infer/infer_utils.py", line 97, in init
from diffrhythm.g2p.g2p_generation import chn_eng_g2p
File "/content/DiffRhythm-hf/diffrhythm/g2p/g2p_generation.py", line 9, in
from diffrhythm.g2p.g2p import PhonemeBpeTokenizer
File "/content/DiffRhythm-hf/diffrhythm/g2p/g2p/init.py", line 9, in
import LangSegment
File "/usr/local/lib/python3.11/dist-packages/LangSegment/init.py", line 1, in
from .LangSegment import LangSegment,getTexts,classify,getCounts,printList,setLangfilters,getLangfilters,setfilters,getfilters
ImportError: cannot import name 'setLangfilters' from 'LangSegment.LangSegment' (/usr/local/lib/python3.11/dist-packages/LangSegment/LangSegment.py)
Assistant
The error message shows:
ImportError: cannot import name 'setLangfilters' from 'LangSegment.LangSegment'
User
ERROR: Could not find a version that satisfies the requirement LangSegment==0.3.5 (from versions: 0.2.0)
ERROR: No matching distribution found for LangSegment==0.3.5
Assistant
The error message tells us that PyPI only has a very limited set of versions of LangSegment available—in your case, 0.2.0 is the only one found, and (or any others) are not available.
This means that the LangSegment package you installed does not contain a function named setLangfilters in its LangSegment module.
Possible reasons and solutions:
API changes in LangSegment package:
The package may have been updated, adding/removing/changing functions. Your version of diffrhythm expects setLangfilters but your installed LangSegment doesn't provide it.
Check the installed version of LangSegment:
Run:
pip show LangSegment
Check the package version.
Look up the LangSegment repo (or whatever the official repo is) for the version that contains setLangfilters.
Downgrade or upgrade LangSegment:
If your LangSegment version is too new and dropped setLangfilters, try to install an older version:
pip install LangSegment==<version>
If it's too old and the function is missing, upgrade:
pip install --upgrade LangSegment
Manually check or patch LangSegment:
Inspect the file /usr/local/lib/python3.11/dist-packages/LangSegment/LangSegment.py to see if setLangfilters exists.
If setLangfilters was renamed or removed, you may need to fix the diffrhythm source to match the new API.
Temporary workaround by commenting the import:
Not ideal, but if setLangfilters is unused in your workflow, try commenting out the import line in: