### Setup Documentation Environment Source: https://icefall.readthedocs.io/en/latest/contributing/doc.html Install the required Python packages for documentation development. Navigate to the 'docs' directory before running this command. ```bash cd docs pip install -r requirements.txt ``` -------------------------------- ### Epoch-Based Training Example Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html This example shows how to train for a specific number of epochs and resume from a checkpoint. It sets the total number of epochs and the starting epoch. ```bash cd egs/aishell/ASR ./tdnn_lstm_ctc/train.py --num-epochs 10 --start-epoch 3 ``` -------------------------------- ### Train Conformer CTC Model (Single GPU) Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/conformer_ctc.html Start training the Conformer CTC model. This example shows how to set the number of epochs for training. ```bash cd egs/aishell/ASR ./conformer_ctc/train.py --num-epochs 30 ``` -------------------------------- ### Local TensorBoard Server Confirmation Source: https://icefall.readthedocs.io/en/latest/recipes/Streaming-ASR/librispeech/pruned_transducer_stateless.html Example output when starting a local TensorBoard server, indicating the URL to access the logs. ```text Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all TensorBoard 2.8.0 at http://localhost:6008/ (Press CTRL+C to quit) ``` -------------------------------- ### Install and Configure Pre-commit Hooks Source: https://icefall.readthedocs.io/en/latest/contributing/code-style.html Clone the repository, install pre-commit, and set up the git hooks to automatically check code style on commit. ```bash $ git clone https://github.com/k2-fsa/icefall $ cd icefall $ pip install pre-commit $ pre-commit install ``` -------------------------------- ### Install kaldifeat Source: https://icefall.readthedocs.io/en/latest/for-dummies/model-export.html Install a specific version of kaldifeat with CPU support and PyTorch 2.0.0. ```bash pip install kaldifeat==1.25.0.dev20230726+cpu.torch2.0.0 -f https://csukuangfj.github.io/kaldifeat/cpu.html ``` -------------------------------- ### Install PyTorch and Torchaudio (CPU) Source: https://icefall.readthedocs.io/en/latest/for-dummies/environment-setup.html Installs specific versions of PyTorch and torchaudio optimized for CPU. This order is important for successful installation. ```bash # Caution: Installation order matters! # We use torch 2.0.0 and torchaduio 2.0.0 in this tutorial. # Other versions should also work. pip install torch==2.0.0+cpu torchaudio==2.0.0+cpu -f https://download.pytorch.org/whl/torch_stable.html # If you are using macOS or Windows, please use the following command to install torch and torchaudio # pip install torch==2.0.0 torchaudio==2.0.0 -f https://download.pytorch.org/whl/torch_stable.html # Now install k2 # Please refer to https://k2-fsa.github.io/k2/installation/from_wheels.html#linux-cpu-example pip install k2==1.24.3.dev20230726+cpu.torch2.0.0 -f https://k2-fsa.github.io/k2/cpu.html # Install the latest version of lhotse pip install git+https://github.com/lhotse-speech/lhotse ``` -------------------------------- ### Start Training with 8 GPUs Source: https://icefall.readthedocs.io/en/latest/recipes/Streaming-ASR/librispeech/lstm_pruned_stateless_transducer.html Initiates the training process using 8 GPUs. This command sets up the environment variables and training parameters. ```bash export CUDA_VISIBLE_DEVICES="0,1,2,3,4,5,6,7" ./lstm_transducer_stateless2/train.py \ --world-size 8 \ --num-epochs 35 \ --start-epoch 1 \ --full-libri 1 \ --exp-dir lstm_transducer_stateless2/exp \ --max-duration 500 \ --use-fp16 0 \ --lr-epochs 10 \ --num-workers 2 \ --giga-prob 0.9 ``` -------------------------------- ### TensorBoard Upload Output Example Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html This is an example of the output you might see when uploading TensorBoard logs. It includes a link to view your experiment. ```text TensorFlow installation not found - running with reduced feature set. Upload started and will continue reading any new data as it's added to the logdir. To stop uploading, press Ctrl-C. New experiment created. View your TensorBoard at: https://tensorboard.dev/experiment/LJI9MWUORLOw3jkdhxwk8A/ [2021-09-13T11:59:23] Started scanning logdir. [2021-09-13T11:59:24] Total uploaded: 4454 scalars, 0 tensors, 0 binary objects Listening for new data in logdir... ``` -------------------------------- ### Download and Setup Icefall Environment Source: https://icefall.readthedocs.io/en/latest/installation/index.html Clones the icefall repository, installs dependencies, and sets the PYTHONPATH environment variable to include the icefall directory. ```bash cd /tmp git clone https://github.com/k2-fsa/icefall cd icefall pip install -r requirements.txt export PYTHONPATH=/tmp/icefall:$PYTHONPATH ``` -------------------------------- ### Verify Torchaudio Installation Source: https://icefall.readthedocs.io/en/latest/installation/index.html Execute this command to verify the successful installation of Torchaudio and display its version. ```bash (test-icefall) kuangfangjun:~$ python3 -c "import torchaudio; print(torchaudio.__version__)" 0.13.0+cu116 ``` -------------------------------- ### Resume Training with Epoch and Start Epoch Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/conformer_ctc.html Load a checkpoint and resume training for a specified number of epochs, starting from a given epoch number. ```bash cd egs/aishell/ASR ./conformer_ctc/train.py --num-epochs 10 --start-epoch 3 ``` -------------------------------- ### Distributed Training Example Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html This example demonstrates how to initiate distributed training using two GPUs by setting the CUDA_VISIBLE_DEVICES environment variable and specifying the world size. ```bash cd egs/aishell/ASR export CUDA_VISIBLE_DEVICES="0,3" ./tdnn_lstm_ctc/train.py --world-size 2 ``` -------------------------------- ### View TensorBoard Logs Locally Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/zipformer_mmi.html Starts a local TensorBoard server to visualize training logs. Navigate to the specified URL in your browser. ```bash cd zipformer_mmi/exp/tensorboard tensorboard --logdir . --port 6008 ``` -------------------------------- ### Training Log Example Source: https://icefall.readthedocs.io/en/latest/installation/index.html Example log output during the training process, showing epoch, batch, loss, and total loss information. This is useful for monitoring training progress. ```log 2023-07-27 12:50:59,387 INFO [train.py:422] Epoch 2, batch 20, loss[loss=0.03458, over 2695.00 frames. ], tot_loss[loss=0.04616, over 34971.47 frames. ], batch size: 5 2023-07-27 12:50:59,707 INFO [train.py:444] Epoch 2, validation loss=0.03379, over 18067.00 frames. 2023-07-27 12:50:59,758 INFO [checkpoint.py:75] Saving checkpoint to tdnn/exp/epoch-2.pt ``` ```log 2023-07-27 12:51:23,433 INFO [train.py:422] Epoch 13, batch 0, loss[loss=0.01054, over 2436.00 frames. ], tot_loss[loss=0.01054, over 2436.00 frames. ], batch size: 4 2023-07-27 12:51:23,980 INFO [train.py:422] Epoch 13, batch 10, loss[loss=0.009014, over 2828.00 frames. ], tot_loss[loss=0.009974, over 22192.90 frames. ], batch size: 4 2023-07-27 12:51:24,489 INFO [train.py:444] Epoch 13, validation loss=0.01085, over 18067.00 frames. 2023-07-27 12:51:25,258 INFO [train.py:422] Epoch 13, batch 20, loss[loss=0.01172, over 2695.00 frames. ], tot_loss[loss=0.01055, over 34971.47 frames. ], batch size: 5 2023-07-27 12:51:25,621 INFO [train.py:444] Epoch 13, validation loss=0.01074, over 18067.00 frames. 2023-07-27 12:51:25,699 INFO [checkpoint.py:75] Saving checkpoint to tdnn/exp/epoch-13.pt ``` ```log 2023-07-27 12:51:28,326 INFO [train.py:555] Done! ``` -------------------------------- ### Install Latest Lhotse from GitHub Source: https://icefall.readthedocs.io/en/latest/installation/index.html Installs the latest version of lhotse directly from its GitHub repository. ```bash pip install git+https://github.com/lhotse-speech/lhotse ``` -------------------------------- ### Verify k2 installation Source: https://icefall.readthedocs.io/en/latest/installation/index.html Run this command to check if k2 has been installed successfully and to display its version and build information. ```bash (test-icefall) kuangfangjun:~$ python3 -m k2.version Collecting environment information... k2 version: 1.24.3 Build type: Release Git SHA1: 4c05309499a08454997adf500b56dcc629e35ae5 Git date: Tue Jul 25 16:23:36 2023 Cuda used to build k2: 11.6 cuDNN used to build k2: 8.3.2 Python version used to build k2: 3.8 OS used to build k2: CentOS Linux release 7.9.2009 (Core) CMake version: 3.27.0 GCC version: 9.3.1 CMAKE_CUDA_FLAGS: -Wno-deprecated-gpu-targets -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_35,code=sm_35 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_50,code=sm_50 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_60,code=sm_60 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_61,code=sm_61 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_70,code=sm_70 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_75,code=sm_75 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_80,code=sm_80 -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w --expt-extended-lambda -gencode arch=compute_86,code=sm_86 -DONNX_NAMESPACE=onnx_c2 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --expt-relaxed-constexpr --expt-extended-lambda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall --compiler-options -Wno-strict-overflow --compiler-options -Wno-unknown-pragmas CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable -Wno-strict-overflow PyTorch version used to build k2: 1.13.0+cu116 PyTorch is using Cuda: 11.6 NVTX enabled: True With CUDA: True Disable debug: True Sync kernels : False Disable checks: False Max cpu memory allocate: 214748364800 bytes (or 200.0 GB) k2 abort: False __file__: /star-fj/fangjun/test-icefall/lib/python3.8/site-packages/k2/version/version.py _k2.__file__: /star-fj/fangjun/test-icefall/lib/python3.8/site-packages/_k2.cpython-38-x86_64-linux-gnu.so ``` -------------------------------- ### Example Training Run (Case 1) Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/conformer_ctc.html A typical training command using a subset of LibriSpeech data and limiting max duration to prevent Out-of-Memory errors. ```bash cd egs/librispeech/ASR ./conformer_ctc/train.py --max-duration 200 --full-libri 0 ``` -------------------------------- ### Install k2 from pre-compiled wheels Source: https://icefall.readthedocs.io/en/latest/installation/index.html Use pip to install a specific version of k2 from pre-compiled wheels. Ensure your environment matches the CUDA and PyTorch versions specified. ```bash (test-icefall) kuangfangjun:~$ pip install k2==1.24.3.dev20230725+cuda11.6.torch1.13.0 -f https://k2-fsa.github.io/k2/cuda.html Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Looking in links: https://k2-fsa.github.io/k2/cuda.html Collecting k2==1.24.3.dev20230725+cuda11.6.torch1.13.0 Downloading https://huggingface.co/csukuangfj/k2/resolve/main/ubuntu-cuda/k2-1.24.3.dev20230725%2Bcuda11.6.torch1.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (104.3 MB) ________________________________________ 104.3/104.3 MB 5.1 MB/s eta 0:00:00 Requirement already satisfied: torch==1.13.0 in /star-fj/fangjun/test-icefall/lib/python3.8/site-packages (from k2==1.24.3.dev20230725+cuda11.6.torch1.13.0) (1.13.0+cu116) Collecting graphviz Using cached https://pypi.tuna.tsinghua.edu.cn/packages/de/5e/fcbb22c68208d39edff467809d06c9d81d7d27426460ebc598e55130c1aa/graphviz-0.20.1-py3-none-any.whl (47 kB) Requirement already satisfied: typing-extensions in /star-fj/fangjun/test-icefall/lib/python3.8/site-packages (from torch==1.13.0->k2==1.24.3.dev20230725+cuda11.6.torch1.13.0) (4.7.1) Installing collected packages: graphviz, k2 Successfully installed graphviz-0.20.1 k2-1.24.3.dev20230725+cuda11.6.torch1.13.0 ``` -------------------------------- ### TensorBoard Upload Confirmation and Progress Source: https://icefall.readthedocs.io/en/latest/recipes/Streaming-ASR/librispeech/pruned_transducer_stateless.html Example output from the TensorBoard upload command, showing the experiment URL and upload progress. ```text TensorFlow installation not found - running with reduced feature set. Upload started and will continue reading any new data as it's added to the logdir. To stop uploading, press Ctrl-C. New experiment created. View your TensorBoard at: https://tensorboard.dev/experiment/97VKXf80Ru61CnP2ALWZZg/ [2022-11-20T15:50:50] Started scanning logdir. Uploading 4468 scalars... [2022-11-20T15:53:02] Total uploaded: 210171 scalars, 0 tensors, 0 binary objects Listening for new data in logdir... ``` -------------------------------- ### Start Decoding Process Source: https://icefall.readthedocs.io/en/latest/for-dummies/decoding.html This command initiates the decoding process. Ensure you are in the correct directory and have set up the Python path and CPU usage. ```bash cd /tmp/icefall export PYTHONPATH=/tmp/icefall:$PYTHONPATH cd egs/yesno/ASR # We use CPU for decoding by setting the following environment variable export CUDA_VISIBLE_DEVICES="" ./tdnn/decode.py ``` -------------------------------- ### Build Documentation Locally Source: https://icefall.readthedocs.io/en/latest/contributing/doc.html Build the documentation in HTML format locally. Ensure the environment is set up first. This command is run from the 'docs' directory. ```bash cd docs make html ``` -------------------------------- ### Display Training Options Source: https://icefall.readthedocs.io/en/latest/recipes/Streaming-ASR/librispeech/pruned_transducer_stateless.html Use the --help flag to display all configurable training options for the pruned transducer stateless model. ```bash cd egs/librispeech/ASR ./pruned_transducer_stateless4/train.py --help ``` -------------------------------- ### Start Training with 4 GPUs Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/zipformer_ctc_blankskip.html Initiates the training process using 4 GPUs. This command sets up environment variables and specifies training parameters like epochs, experiment directory, and precision. ```bash export CUDA_VISIBLE_DEVICES="0,1,2,3" ./pruned_transducer_stateless7_ctc_bs/train.py \ --world-size 4 \ --num-epochs 30 \ --start-epoch 1 \ --full-libri 1 \ --exp-dir pruned_transducer_stateless7_ctc_bs/exp \ --max-duration 600 \ --use-fp16 1 ``` -------------------------------- ### Display Training Options Source: https://icefall.readthedocs.io/en/latest/recipes/Streaming-ASR/librispeech/zipformer_transducer.html Use the --help flag to view all available command-line options for training the Zipformer Transducer model. ```bash cd egs/librispeech/ASR ./pruned_transducer_stateless7_streaming/train.py --help ``` -------------------------------- ### Verify Lhotse Installation Source: https://icefall.readthedocs.io/en/latest/installation/index.html After installation, run this Python command to check if Lhotse is accessible and to display its installed version. ```python import lhotse; print(lhotse.__version__) ``` -------------------------------- ### Multi-GPU Training with All Available GPUs Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html Utilize all available GPUs for training by setting the --world-size option to the number of GPUs. This example assumes 4 GPUs are available. ```bash cd egs/aishell/ASR ./tdnn_lstm_ctc/train.py --world-size 4 ``` -------------------------------- ### Install Lhotse from GitHub Source: https://icefall.readthedocs.io/en/latest/installation/index.html Install the Lhotse package directly from its GitHub repository using pip. This command clones the repository and installs the latest development version. ```bash (test-icefall) kuangfangjun:~$ pip install git+https://github.com/lhotse-speech/lhotse Collecting git+https://github.com/lhotse-speech/lhotse Cloning https://github.com/lhotse-speech/lhotse to /tmp/pip-req-build-vq12fd5i Running command git clone --filter=blob:none --quiet https://github.com/lhotse-speech/lhotse /tmp/pip-req-build-vq12fd5i Resolved https://github.com/lhotse-speech/lhotse to commit 7640d663469b22cd0b36f3246ee9b849cd25e3b7 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cytoolz>=0.10.1 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1e/3b/a7828d575aa17fb7acaf1ced49a3655aa36dad7e16eb7e6a2e4df0dda76f/cytoolz-0.12.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB) ________________________________________ 2.0/2.0 MB 33.2 MB/s eta 0:00:00 Collecting pyyaml>=5.3.1 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c8/6b/6600ac24725c7388255b2f5add93f91e58a5d7efaf4af244fdbcc11a541b/PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (736 kB) ________________________________________ 736.6/736.6 kB 38.6 MB/s eta 0:00:00 Collecting dataclasses Downloading https://pypi.tuna.tsinghua.edu.cn/packages/26/2f/1095cdc2868052dd1e64520f7c0d5c8c550ad297e944e641dbf1ffbb9a5d/dataclasses-0.6-py3-none-any.whl (14 kB) Requirement already satisfied: torchaudio in ./test-icefall/lib/python3.8/site-packages (from lhotse==1.16.0.dev0+git.7640d66.clean) (0.13.0+cu116) Collecting lilcom>=1.1.0 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a8/65/df0a69c52bd085ca1ad4e5c4c1a5c680e25f9477d8e49316c4ff1e5084a4/lilcom-1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (87 kB) ________________________________________ 87.1/87.1 kB 8.7 MB/s eta 0:00:00 Collecting tqdm Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e6/02/a2cff6306177ae6bc73bc0665065de51dfb3b9db7373e122e2735faf0d97/tqdm-4.65.0-py3-none-any.whl (77 kB) Requirement already satisfied: numpy>=1.18.1 in ./test-icefall/lib/python3.8/site-packages (from lhotse==1.16.0.dev0+git.7640d66.clean) (1.24.4) Collecting audioread>=2.1.9 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5d/cb/82a002441902dccbe427406785db07af10182245ee639ea9f4d92907c923/audioread-3.0.0.tar.gz (377 kB) Preparing metadata (setup.py) ... done Collecting tabulate>=0.8.1 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/40/44/4a5f08c96eb108af5cb50b41f76142f0afa346dfa99d5296fe7202a11854/tabulate-0.9.0-py3-none-any.whl (35 kB) Collecting click>=7.1.1 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1a/70/e63223f8116931d365993d4a6b7ef653a4d920b41d03de7c59499962821f/click-8.1.6-py3-none-any.whl (97 kB) ________________________________________ 97.9/97.9 kB 8.4 MB/s eta 0:00:00 Collecting packaging Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ab/c3/57f0601a2d4fe15de7a553c00adbc901425661bf048f2a22dfc500caf121/packaging-23.1-py3-none-any.whl (48 kB) Collecting intervaltree>=3.1.0 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/50/fb/396d568039d21344639db96d940d40eb62befe704ef849b27949ded5c3bb/intervaltree-3.1.0.tar.gz (32 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: torch in ./test-icefall/lib/python3.8/site-packages (from lhotse==1.16.0.dev0+git.7640d66.clean) (1.13.0+cu116) Collecting SoundFile>=0.10 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ad/bd/0602167a213d9184fc688b1086dc6d374b7ae8c33eccf169f9b50ce6568c/soundfile-0.12.1-py2.py3-none-manylinux_2_17_x86_64.whl (1.3 MB) ________________________________________ 1.3/1.3 MB 46.5 MB/s eta 0:00:00 Collecting toolz>=0.8.0 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/7f/5c/922a3508f5bda2892be3df86c74f9cf1e01217c2b1f8a0ac4841d903e3e9/toolz-0.12.0-py3-none-any.whl (55 kB) Collecting sortedcontainers<3.0,>=2.0 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB) Collecting cffi>=1.0 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b7/8b/06f30caa03b5b3ac006de4f93478dbd0239e2a16566d81a106c322dc4f79/cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (442 kB) Requirement already satisfied: typing-extensions in ./test-icefall/lib/python3.8/site-packages (from torch->lhotse==1.16.0.dev0+git.7640d66.clean) (4.7.1) Collecting pycparser Using cached https://pypi.tuna.tsinghua.edu.cn/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl (118 kB) Building wheels for collected packages: lhotse, audioread, intervaltree Building wheel for lhotse (pyproject.toml) ... done ``` -------------------------------- ### Show help information for pretrained.py Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/yesno/tdnn.html Run this command to see the usage information and available options for the `./tdnn/pretrained.py` script. ```bash $ cd egs/yesno/ASR $ ./tdnn/pretrained.py --help ``` -------------------------------- ### Verify PyTorch Installation Source: https://icefall.readthedocs.io/en/latest/installation/index.html Run this command to confirm that PyTorch has been installed correctly and check its version. ```bash (test-icefall) kuangfangjun:~$ python3 -c "import torch; print(torch.__version__)" 1.13.0+cu116 ``` -------------------------------- ### Install ONNX Source: https://icefall.readthedocs.io/en/latest/model-export/export-onnx.html Install the ONNX package using pip. This is a prerequisite for exporting models to ONNX format. ```bash pip install onnx ``` -------------------------------- ### Display Help Information for Decoding Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/stateless_transducer.html Run the pretrained.py script with the --help flag to see available decoding options and their usage. ```bash $ cd egs/aishell/ASR $ ./transducer_stateless_modified/pretrained.py --help ``` -------------------------------- ### Create wave_filenames.txt Source: https://icefall.readthedocs.io/en/latest/model-export/export-ncnn-conv-emformer.html Creates a file listing calibration wave files for quantization. Ensure these are 16kHz mono WAV files. ```bash cd egs/librispeech/ASR cd icefall-asr-librispeech-conv-emformer-transducer-stateless2-2022-07-05/exp/ cat < wave_filenames.txt ../test_wavs/1089-134686-0001.wav ../test_wavs/1221-135766-0001.wav ../test_wavs/1221-135766-0002.wav EOF ``` -------------------------------- ### Install optimized_transducer Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/stateless_transducer.html Install the optimized_transducer library using pip. This library is used for computing the transducer loss efficiently. ```bash pip install optimized_transducer ``` -------------------------------- ### Display Training Options Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/pruned_transducer_stateless.html Use the --help flag to display all configurable training options for the pruned_transducer_stateless4 model. ```bash cd egs/librispeech/ASR ./pruned_transducer_stateless4/train.py --help ``` -------------------------------- ### Invoke Training Script Source: https://icefall.readthedocs.io/en/latest/contributing/how-to-create-a-recipe.html Demonstrates how to run the training script for a model within a recipe. It shows the basic command to start training and how to access help for available training options. ```bash $ cd egs/foo/ASR $ ./bar/train.py $ ./bar/train.py --help ``` -------------------------------- ### Install Lhotse using pip Source: https://icefall.readthedocs.io/en/latest/installation/index.html Use pip to install the Lhotse package. This command will download and build necessary dependencies. ```bash pip install lhotse ``` -------------------------------- ### Prepare Data for YesNo Recipe Source: https://icefall.readthedocs.io/en/latest/docker/intro.html Navigate to the 'yesno' recipe directory and execute the `prepare.sh` script to download and prepare the necessary data. ```bash root@60c947eac59c:/workspace/icefall/egs/yesno/ASR# ./prepare.sh ``` -------------------------------- ### Show help for pretrained.py Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/timit/tdnn_ligru_ctc.html Displays the usage information for the pretrained.py script, outlining available options and arguments. ```bash cd egs/timit/ASR ./tdnn_ligru_ctc/pretrained.py --help ``` -------------------------------- ### Serve Generated Documentation Locally Source: https://icefall.readthedocs.io/en/latest/contributing/doc.html Serve the locally built HTML documentation using Python's built-in HTTP server. Navigate to the build directory first. ```bash cd docs/build/html python3 -m http.server ``` -------------------------------- ### HLG Decoding Output Example Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html This is an example of the output generated by the HLG decoding process, showing the decoded text for each input audio file. ```text 2021-09-13 15:00:55,858 INFO [pretrained.py:140] device: cuda:0 2021-09-13 15:00:55,858 INFO [pretrained.py:142] Creating model 2021-09-13 15:01:05,389 INFO [pretrained.py:154] Loading HLG from ./tmp/icefall_asr_aishell_tdnn_lstm_ctc/data/lang_phone/HLG.pt 2021-09-13 15:01:06,531 INFO [pretrained.py:161] Constructing Fbank computer 2021-09-13 15:01:06,536 INFO [pretrained.py:171] Reading sound files: ['./tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0121.wav', './tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0122.wav', './tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0123.wav'] 2021-09-13 15:01:06,539 INFO [pretrained.py:177] Decoding started 2021-09-13 15:01:06,917 INFO [pretrained.py:207] Use HLG decoding 2021-09-13 15:01:07,129 INFO [pretrained.py:220] ./tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0121.wav: 甚至 出现 交易 几乎 停滞 的 情况 ./tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0122.wav: 一二 线 城市 虽然 也 处于 调整 中 ./tmp/icefall_asr_aishell_tdnn_lstm_ctc/test_waves/BAC009S0764W0123.wav: 但 因为 聚集 了 过多 公共 资源 2021-09-13 15:01:07,129 INFO [pretrained.py:222] Decoding Done ``` -------------------------------- ### Run Data Preparation Script Source: https://icefall.readthedocs.io/en/latest/for-dummies/data-preparation.html Execute the `prepare.sh` script to set up all necessary data for training. Ensure you are in the correct directory and have set the PYTHONPATH. ```bash cd /tmp/icefall export PYTHONPATH=/tmp/icefall:$PYTHONPATH cd egs/yesno/ASR ./prepare.sh ``` -------------------------------- ### Install Git LFS Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/tdnn_lstm_ctc.html Install git-lfs if you need to download the 3-gram language model from Hugging Face. This is required for certain data preparation steps. ```bash sudo apt-get install git-lfs git-lfs install ``` -------------------------------- ### Display Training Options Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/stateless_transducer.html Use this command to view all available training options for the stateless transducer model. ```bash cd egs/aishell/ASR ./transducer_stateless_modified/train.py --help ``` -------------------------------- ### Link exported model for CTC guide decoding Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/zipformer_ctc_blankskip.html Create a symbolic link to the exported pretrained model to use it with the CTC guide decoding script. ```bash cd pruned_transducer_stateless7_ctc_bs/exp ln -s pretrained epoch-9999.pt ``` -------------------------------- ### Install PyTorch and Torchaudio Source: https://icefall.readthedocs.io/en/latest/installation/index.html Use this command to install specific versions of PyTorch and Torchaudio that are compatible with your selected CUDA toolkit. Ensure you replace the versions with those appropriate for your environment. ```bash (test-icefall) kuangfangjun:~$ pip install torch==1.13.0+cu116 torchaudio==0.13.0+cu116 -f https://download.pytorch.org/whl/torch_stable.html Looking in links: https://download.pytorch.org/whl/torch_stable.html Collecting torch==1.13.0+cu116 Downloading https://download.pytorch.org/whl/cu116/torch-1.13.0%2Bcu116-cp38-cp38-linux_x86_64.whl (1983.0 MB) ________________________________________ 2.0/2.0 GB 764.4 kB/s eta 0:00:00 Collecting torchaudio==0.13.0+cu116 Downloading https://download.pytorch.org/whl/cu116/torchaudio-0.13.0%2Bcu116-cp38-cp38-linux_x86_64.whl (4.2 MB) ________________________________________ 4.2/4.2 MB 1.3 MB/s eta 0:00:00 Requirement already satisfied: typing-extensions in /star-fj/fangjun/test-icefall/lib/python3.8/site-packages (from torch==1.13.0+cu116) (4.7.1) Installing collected packages: torch, torchaudio Successfully installed torch-1.13.0+cu116 torchaudio-0.13.0+cu116 ``` -------------------------------- ### Start Training with Multiple GPUs Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/pruned_transducer_stateless.html Initiates the ASR model training process using multiple GPUs. Configure the number of GPUs, epochs, and experiment directory as needed. ```bash export CUDA_VISIBLE_DEVICES="0,1,2,3,4,5" ./pruned_transducer_stateless4/train.py \ --world-size 6 \ --num-epochs 30 \ --start-epoch 1 \ --exp-dir pruned_transducer_stateless4/exp \ --full-libri 1 \ --max-duration 300 ``` -------------------------------- ### View Training Options Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/aishell/conformer_ctc.html Display available command-line options for training the Conformer CTC model. This helps in understanding configurable parameters like experiment directory, number of epochs, and start epoch. ```bash cd egs/aishell/ASR ./conformer_ctc/train.py --help ``` -------------------------------- ### Install PyTorch with CUDA 11.1 and Correct Torchaudio Version Source: https://icefall.readthedocs.io/en/latest/faqs.html Use this command to install PyTorch, Torchvision, and Torchaudio with specific CUDA versions, resolving `OSError: libtorch_hip.so`. ```bash pip install \ torch==1.10.0+cu111 \ torchvision==0.11.0+cu111 \ torchaudio==0.10.0+cu111 \ -f https://download.pytorch.org/whl/torch_stable.html ``` -------------------------------- ### NCNN Streaming Decoder Output Example Source: https://icefall.readthedocs.io/en/latest/model-export/export-ncnn-lstm.html This is an example of the output you can expect when running the `streaming-ncnn-decode.py` script. It shows the parsed arguments, initialization steps, and the final decoded text. ```text 2023-02-17 11:37:30,861 INFO [streaming-ncnn-decode.py:255] {'tokens': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/data/lang_bpe_500/tokens.txt', 'encoder_param_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/encoder_jit_trace-pnnx.ncnn.param', 'encoder_bin_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/encoder_jit_trace-pnnx.ncnn.bin', 'decoder_param_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/decoder_jit_trace-pnnx.ncnn.param', 'decoder_bin_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/decoder_jit_trace-pnnx.ncnn.bin', 'joiner_param_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/joiner_jit_trace-pnnx.ncnn.param', 'joiner_bin_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/exp/joiner_jit_trace-pnnx.ncnn.bin', 'sound_filename': './icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/test_wavs/1089-134686-0001.wav'} 2023-02-17 11:37:31,425 INFO [streaming-ncnn-decode.py:263] Constructing Fbank computer 2023-02-17 11:37:31,427 INFO [streaming-ncnn-decode.py:266] Reading sound files: ./icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/test_wavs/1089-134686-0001.wav 2023-02-17 11:37:31,431 INFO [streaming-ncnn-decode.py:271] torch.Size([106000]) 2023-02-17 11:37:34,115 INFO [streaming-ncnn-decode.py:342] ./icefall-asr-librispeech-lstm-transducer-stateless2-2022-09-03/test_wavs/1089-134686-0001.wav 2023-02-17 11:37:34,115 INFO [streaming-ncnn-decode.py:343] AFTER EARLY NIGHTFALL THE YELLOW LAMPS WOULD LIGHT UP HERE AND THERE THE SQUALID QUARTER OF THE BROTHELS ``` -------------------------------- ### Run MVQ Training Source: https://icefall.readthedocs.io/en/latest/recipes/Non-streaming-ASR/librispeech/distillation.html Execute the preparation script to run MVQ training for stage 3. This command initiates the training process. ```bash ./prepare.sh --stage 3 --stop_stage 3 # run MVQ training ``` -------------------------------- ### NCNN Decoding Output Example Source: https://icefall.readthedocs.io/en/latest/model-export/export-ncnn-zipformer.html This is an example of the output produced by the `streaming-ncnn-decode.py` script when processing an audio file with an NCNN-exported model. It shows the parsed arguments and the final transcription. ```log 2023-02-27 20:43:40,283 INFO [streaming-ncnn-decode.py:349] {'tokens': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/data/lang_bpe_500/tokens.txt', 'encoder_param_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/encoder_jit_trace-pnnx.ncnn.param', 'encoder_bin_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/encoder_jit_trace-pnnx.ncnn.bin', 'decoder_param_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/decoder_jit_trace-pnnx.ncnn.param', 'decoder_bin_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/decoder_jit_trace-pnnx.ncnn.bin', 'joiner_param_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/joiner_jit_trace-pnnx.ncnn.param', 'joiner_bin_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/joiner_jit_trace-pnnx.ncnn.bin', 'sound_filename': './icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/test_wavs/1089-134686-0001.wav'} 2023-02-27 20:43:41,260 INFO [streaming-ncnn-decode.py:357] Constructing Fbank computer 2023-02-27 20:43:41,264 INFO [streaming-ncnn-decode.py:360] Reading sound files: ./icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/test_wavs/1089-134686-0001.wav 2023-02-27 20:43:41,269 INFO [streaming-ncnn-decode.py:365] torch.Size([106000]) 2023-02-27 20:43:41,280 INFO [streaming-ncnn-decode.py:372] number of states: 35 2023-02-27 20:43:45,026 INFO [streaming-ncnn-decode.py:410] ./icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/test_wavs/1089-134686-0001.wav 2023-02-27 20:43:45,026 INFO [streaming-ncnn-decode.py:411] AFTER EARLY NIGHTFALL THE YELLOW LAMPS WOULD LIGHT UP HERE AND THERE THE SQUALID QUARTER OF THE BROTHELS ```