This post records the process of getting familiar with espnet and running its scripts from scratch.
Background
espnet2 is installed, and I understand the 13 stages of enh.sh and how the pipeline runs.
See Analysis of espnet’s enh.sh for details
Now it’s time to actually run the code and get familiar with the concrete workflow through step-by-step debugging and other methods.
Steps
Data Preparation Stage
First run the first stage to prepare the data1
./run.sh --stage 1 --stop-stage 1
It errored out; I found that db.sh needs the dataset paths for WSJ0 and WSJ1 filled in
After filling in the paths of the locally downloaded datasets, it errored with “matlab not found”
For legacy reasons, the mixture audio generation script requires matlab; if you already have the WSJ0_MIX data, it can be commented out in /local/data.sh1
2# local/wsj0_create_mixture.sh ${wsj_2mix_scripts} ${WSJ0} ${wsj_full_wav} \
# ${wsj_2mix_wav} || exit 1;
Then add the mixture dataset to the corresponding data directory by linking in the 2speakers part of the local WSJ0_MIX.
Run again! Error:1
22025-03-17T21:51:16 (data.sh:74:main) local/wsj_data_prep.sh /mnt/rdata/wsj/WSJ0/??-{?,??}.? /mnt/rdata/wsj/WSJ1/??-{?,??}.?
Could not find (or execute) the sph2pipe program at sph2pipe
I suspected an environment configuration problem, so I set up the environment with the setup scripts in the espnet/tools directory; it is a bit more convenient if conda is already installed
Installing the environment from the scripts kept running into errors1
2
3ERROR: Requested lightning from https://files.pythonhosted.org/packages/84/21/4a6ca0f7d0679794cc209da282728839d3296337d3759f86048eb4f1d027/lightning-1.8.3.post2-py3-none-any.whl has invalid metadata: .* suffix can only be used with `==` or `!=` operators
torch (>=1.9.*)
~~~~~~^
After struggling repeatedly without success, I chose to install the packages manually1
./installers/install_transformers.sh
Finally it could run, although stage1 generated a pile of strange data…
It ran smoothly through stage4, completing the data preparation.
Training Stage
Started running stage5; it errored, and I diagnosed it as an environment problem
So I recreated the espnet2 environment and reconfigured it with make, following the specific instructions in the readme under the espnet/tools directory
Along the way I hit this error:1
2
3
4
5
6Using cached lightning-1.8.0.post1-py3-none-any.whl.metadata (22 kB)
WARNING: Ignoring version 1.8.0.post1 of lightning since it has invalid metadata:
Requested lightning from https://files.pythonhosted.org/packages/89/dc/93c33bb378c0674855c5f1aef24317a9cb37c9cec9235334b6ceb712c662/lightning-1.8.0.post1-py3-none-any.whl has invalid metadata: .* suffix can only be used with `==` or `!=` operators
torch (>=1.9.*)
~~~~~~^
Please use pip<24.1 if you need to use this version.
It looked like a version dependency problem between the various packages. I wrestled with copilot for a long time without resolving it, and finally asked my teacher lcd for help
Since he wrote all of the base code, which had only been hacked on a bit later, perhaps the newly added features caused some environment incompatibilities. In the end he ran the following in the espnet directory1
pip install -e ./
which presumably invoked setup.py to configure the espnet2 environment properly
But running stage5 still errored, showing:1
OSError: /home/xxx/anaconda3/envs/espnet2/lib/python3.8/site-packages/torchaudio/lib/libtorchaudio.so: undefined symbol: _ZNK5torch8autograd4Node4nameEv
This was really frustrating; I had no choice but to ask copilot, which said it was because the torch and torchaudio versions were incompatible
Fine, fine, fine. After a round of operations, I blew up the espnet2 environment again
So I created a fresh espnet3 environment, this time installing directly with pip install -e ./. It still errored; after manually installing torchaudio, torch and torchaudio had the same version number, and I fell into despair once again
This time I asked zx, a senior student, who was also baffled at first. After checking for a while, he found that the tools/activate_python.sh script was still activating the espnet2 environment, which is why it reported version mismatch errors
After fixing that, it errored with a missing package import. Fine, fine, fine, still an environment problem. This time I commented out the torch installation part of the makefile and re-ran make, and it finally ran successfully all the way through stage5. Total time spent so far: 3h…
Translated from the Chinese original.

