Kaldi nnet3 Upgrade Rollback: Restoring Original Training Scripts After a Failed Build
0 reputation · 15 Aug 2021, 11:46 UTC
0 reputation · 15 Aug 2021, 11:46 UTC
Recover a clean Kaldi environment after an unsuccessful upgrade of the nnet3 training scripts, preserving all existing data and model files.
The upgrade was performed from Kaldi 4.2 to 4.3. The build process terminated with a non‑fatal error, leaving the src directory partially updated. All training data and pre‑trained models in data and exp must remain untouched. The repository’s Makefile and configuration files now reference newer compiler flags that are incompatible with the old binary.
src tree to the last working commit while leaving the data directories intact?34775 reputation · 15 Aug 2021, 19:46 UTC
The upgrade modified files in src/ and the example directories under egs/ (especially steps/ and local/) while leaving data/ and exp/ untouched. The build failed because the new source references compiler flags that the old binaries cannot use.
data/ or exp/.steps/ and local/) is sufficient to recover the 4.2 build system; the src/ tree can be cleaned and rebuilt.make in src/ followed by the recipe’s run.sh will verify that the old binaries work.egs/) or a manual backup of the pre‑upgrade steps/ and local/ directories.cd $KALDI_ROOT
git fetch --all
git checkout <commit‑hash‑of‑last‑working‑build> -- egs/your_recipe/steps egs/your_recipe/local
cd $KALDI_ROOT
cp -r /path/to/backup/egs/your_recipe/steps egs/your_recipe/
cp -r /path/to/backup/egs/your_recipe/local egs/your_recipe/
make clean -C src
./configure --use-cuda=no # adjust flags as needed for your setup
make -j $(nproc) src
cd egs/your_recipe
./run.sh
run.sh output; they should show the nnet3 chain being built and the model directory being created under exp/.steps/nnet3/decode.sh) on a small test set to ensure the binaries are executable.If you are unsure whether the original scripts are still available in git or as a backup, please confirm the location of the last known good commit or backup path; this determines whether to use the git checkout or the manual copy step.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 15 Aug 2021, 19:17 UTC
Besides the steps/ and local/ directories, the upgrade often touches the recipe‑specific path.sh and cmd.sh files (found in egs/<recipe>/). These files are sourced by the training scripts and can introduce incompatible compiler flags or environment variables. To guarantee a clean 4.2 build, restore them together with the script directories:
git checkout HEAD -- egs/your_recipe/path.sh egs/your_recipe/cmd.shsource egs/your_recipe/path.sh and verify that $PATH and $cmd match the original setup.Then proceed with the make clean -C src, ./configure and make src steps already described.