lifeiteng / vall-e

PyTorch implementation of VALL-E(Zero-Shot Text-To-Speech), Reproduced Demo https://lifeiteng.github.io/valle/index.html
https://lifeiteng.github.io/valle/index.html
Apache License 2.0
1.99k stars 320 forks source link

SyntaxError: invalid syntax at ../../egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py #105

Closed RuntimeRacer closed 1 year ago

RuntimeRacer commented 1 year ago

Hi, I am just trying to run inference for testing on the model which was shared here: https://github.com/lifeiteng/vall-e/issues/58#issuecomment-1483700593

For some reason I get this error in BOTH Plain Win10 and WSL:

Traceback (most recent call last):
  File "/mnt/d/speechexperiments/vall-e/valle/bin/infer.py", line 37, in <module>
    from valle.data import (
  File "/mnt/d/speechexperiments/vall-e/valle/__init__.py", line 1, in <module>
    from . import data, models, modules, utils
  File "/mnt/d/speechexperiments/vall-e/valle/data/__init__.py", line 1, in <module>
    from .datamodule import *
  File "/mnt/d/speechexperiments/vall-e/valle/data/datamodule.py", line 26, in <module>
    from icefall.utils import str2bool
  File "/mnt/d/speechexperiments/icefall/icefall/__init__.py", line 72, in <module>
    from .lm_wrapper import LmScorer
  File "/mnt/d/speechexperiments/icefall/icefall/lm_wrapper.py", line 24, in <module>
    from icefall.transformer_lm.model import TransformerLM
  File "/mnt/d/speechexperiments/icefall/icefall/transformer_lm/model.py", line 23, in <module>
    from icefall.transformer_lm.encoder import Transformer
  File "/mnt/d/speechexperiments/icefall/icefall/transformer_lm/encoder.py", line 25, in <module>
    from icefall.transformer_lm.attention import RelPositionMultiheadAttention
  File "/mnt/d/speechexperiments/icefall/icefall/transformer_lm/attention.py", line 23, in <module>
    from icefall.transformer_lm.scaling import (
  File "/mnt/d/speechexperiments/icefall/icefall/transformer_lm/scaling.py", line 1
    ../../egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py
    ^
SyntaxError: invalid syntax

The command line I executed: python bin/infer.py --output-dir ./ --model-name valle --norm-first true --add-prenet false --decoder-dim 1024 --nhead 16 --num-decoder-layers 12 --text-prompts "KNOT one point one five miles per hour." --audio-prompts ./prompts/8463_294825_000043_000000.wav --text "To get up and running quickly just follow the steps below." --checkpoint exp/epoch-100.pt

Any help is highly appreciated. :-)

RuntimeRacer commented 1 year ago

Ok I figured out that at basically all occassions I could, I turned the wrong way:

  1. After I couldn't get it working on Windows with this error and tried in WSL, I just went to the mounted Windows drive and set up conda on it within WSL.
  2. Since I hit the same error, I copied the vall-e folder from the windows partition to WSL - with all it's nasty windows line endings and stuff that breaks Linux FS functionality. But I didn't realize that yet, I still had above issue.
  3. Checking out a fresh repo of icefall in within WSL filesystem and pointing PYTHONPATH to it, made the firsterror go away. However, I hit a new error: ModuleNotFoundError: No module named 'matplotlib'
  4. Installing matplotlib via pip was not possible, because of this friend here: AssertionError: Egg-link /mnt/d/speechexperiments/vall-e does not match installed location of valle (at /home/runtimeracer/speechexperiments/vall-e)
  5. This was caused by my initial setup of conda under windows. So I had to remove that egg first: rm /home/runtimeracer/anaconda3/envs/vall-e/lib/python3.10/site-packages/valle.egg-link and reinitialize it in the proper folder: pip install -e .
  6. After this I was able to install matplotlib
  7. Then I ran into this friend: FileNotFoundError: [Errno 2] No such file or directory: 'data/tokenized/unique_text_tokens.k2symbols' - Ok I forgot to setup the dataset. Alright, let's go to examples/libritts - weird, doesn't work, examples is just a file why would he use it as path in the setup instruction?
  8. ok then just do cd egs/libritts/ and run bash prepare.sh --stage -1 --stop-stage 3... but nope: prepare.sh: line 2: $'\r': command not found and bunch of weird errors from the bash script.
  9. I already started questioning my dev skills of 15 years by this point. But then I remembered, that I copied this repo from the Windows drive...
  10. Alright, backed up the model checkpoint, re-initialized a fresh vall-e repo... Suddently also all the symlinks were there and working again (-: - fuuu Windows!
  11. Now I finally was able to download the dataset and run the Inference script.
bank010 commented 1 year ago

您好,请问您解决了吗? 我也是从Windows上传的ubuntu上的,然后就出现了这种问题

hkeliang commented 1 year ago

您好,请问您解决了吗? 我也是从Windows上传的ubuntu上的,然后就出现了这种问题

https://github.com/k2-fsa/icefall/blob/master/egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py 把下面的代码复制到icefall/transformer_lm/scaling.py这个文件下删除../../egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py