### Example output of nvidia-smi CUDA version check Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Example output from the nvidia-smi command. The CUDA Version shown is the maximum CUDA toolkit version you can install. ```text | NVIDIA-SMI 580.65.06 Driver Version: 580.65.06 CUDA Version: 13.0 | ``` -------------------------------- ### Example output of nvcc version check Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Example output from the nvcc version check, showing the compiler path and version details. ```text /home/shahn/.local/cuda-12.8/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Fri_Feb_21_20:23:50_PST_2025 Cuda compilation tools, release 12.8, V12.8.93 Build cuda_12.8.r12.8/compiler.35583870_0 ``` -------------------------------- ### Install all features packages Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/index.md Second step for full installation after following Installation for Training. Installs torchmetrics, jiwer, ONNX tooling, and OpenAI Whisper. Requires onnxruntime-gpu matching your CUDA version; CPU fallback makes DNSMOS/SCOREQ run on CPU and metrics_ns.py slow. ```bash pip install torchmetrics jiwer onnx onnxsim onnxscript pip install git+https://github.com/openai/whisper.git ``` -------------------------------- ### Download and install CUDA toolkit 12.8 runfile Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Download the CUDA toolkit 12.8.1 local runfile and install it silently to /home/shahn/.local/cuda-12.8 with the specified options. This installs the toolkit without OpenGL, DRM, or man pages. ```bash wget https://developer.download.nvidia.com/compute/cuda/12.8.1/local_installers/cuda_12.8.1_570.124.06_linux.run chmod +x cuda_12.8.1_570.124.06_linux.run ./cuda_12.8.1_570.124.06_linux.run \ --silent \ --toolkit \ --installpath=/home/shahn/.local/cuda-12.8 \ --no-opengl-libs \ --no-drm \ --no-man-page ``` -------------------------------- ### Install ONNXRuntime spec2spec packages Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/index.md Second step for minimal installation required by scripts/test_onnx_spec.py, after installing PyTorch (CPU version acceptable). Installs numpy, scipy, librosa, and tqdm. Then install onnxruntime; CPU or GPU version doesn't matter because code runs on CPU anyway. ```bash pip install numpy scipy librosa tqdm ``` -------------------------------- ### Install ONNX exporting packages Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/index.md Second step for minimal installation required by scripts/export_onnx.py and scripts/export_onnx_spec.py, after following Installation for Training. Installs onnx, onnxsim, and onnxscript. ```bash pip install onnx onnxsim onnxscript ``` -------------------------------- ### Check nvcc installation and version Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Verify that nvcc is installed and check its version. The output should show the path to nvcc and the CUDA compiler version. ```bash which nvcc nvcc --version ``` -------------------------------- ### Install other Python dependencies Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Install additional Python packages required for training and evaluation, including Jupyter, matplotlib, librosa, and evaluation metrics. ```bash pip install jupyter notebook matplotlib tensorboard scipy librosa unidecode einops cython tqdm pyyaml pesq pystoi torch-pesq torchmetrics ``` -------------------------------- ### Set CUDA environment variables Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Set CUDA_HOME, PATH, and LD_LIBRARY_PATH to point to the local CUDA installation. These environment variables are required for the build and runtime. ```bash export CUDA_HOME=/home/shahn/.local/cuda-12.8 export PATH=$CUDA_HOME/bin:$PATH export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$CUDA_HOME/lib:$LD_LIBRARY_PATH ``` -------------------------------- ### Install PyTorch and Torchaudio with CUDA 12.8 Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Install PyTorch 2.7.1 and matching torchaudio 2.7.1 with CUDA 12.8 support from the PyTorch index. Ensure the torchaudio version matches your PyTorch version. ```bash pip install torch==2.7.1+cu128 torchaudio==2.7.1+cu128 --index-url https://download.pytorch.org/whl ``` -------------------------------- ### Install objective metrics packages Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/index.md Second step for minimal installation required by metrics_ns.py, after following Installation for Training. Installs torchmetrics, jiwer, and OpenAI Whisper. Requires onnxruntime-gpu matching your CUDA version; CPU fallback makes DNSMOS/SCOREQ run on CPU and metrics_ns.py slow. ```bash pip install torchmetrics jiwer pip install git+https://github.com/openai/whisper.git ``` -------------------------------- ### Create and activate conda environment for FastEnhancer Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Create a new conda environment named 'fastenhancer' with Python 3.13 and activate it. This is the recommended environment manager for the installation. ```bash conda create -n fastenhancer python=3.13 -c conda-forge conda activate fastenhancer ``` -------------------------------- ### Install MkDocs Material Source: https://github.com/aask1357/fastenhancer/blob/main/docs/README.md Install the mkdocs-material package using pip. ```bash pip install mkdocs-material ``` -------------------------------- ### Log directory structure before cleaning Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/index.md Shows the expected layout of the log directory with multiple checkpoints per model before running the cleanup script. ```text logs ├─ vbd | ├─ fastenhancer_b | | ├─ 00020.pth | | ├─ ... | | ├─ 00480.pth | | └─ 00500.pth | └─ fastenhancer_t | ├─ 00020.pth | ├─ ... | ├─ 00480.pth | └─ 00500.pth └─ dns └─ fastenhancer_b ├─ 00020.pth ├─ ... ├─ 00480.pth └─ 00500.pth ``` -------------------------------- ### Check CUDA toolkit version supported by NVIDIA driver Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Run this command to see the maximum CUDA toolkit version your NVIDIA driver supports. The output shows the driver version and the maximum CUDA version you can install. ```bash nvidia-smi | grep "CUDA Version" ``` -------------------------------- ### Extract cuDNN tar file into CUDA directory Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/installation/training.md Extract the cuDNN 8.9.7 archive for CUDA 12.x into the CUDA toolkit installation directory, stripping the top-level components. ```bash tar xvf cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz --strip-components=1 -C /home/shahn/.local/cuda-12.8 ``` -------------------------------- ### Start FSPEN training with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fspen.md Alternative way to launch FSPEN training using torchrun with a single process. Equivalent to the python train.py command, using the same arguments and batch size. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/fspen \ -c configs/others/fspen.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Run PyTorch Inference with scripts.test_pytorch Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/pytorch.md Enhances all audio files in a directory using a pre-trained model checkpoint. Assumes the checkpoint is in logs/fastenhancer_l, input noisy audio in ~/Datasets/noisy, and output saved to enhanced. ```bash CUDA_VISIBLE_DEVICES=0 python -m scripts.test_pytorch -n fastenhancer_l -i ~/Datasets/noisy -o enhanced ``` -------------------------------- ### Start FSPEN training with python train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fspen.md Launches FSPEN training on Voicebank-Demand at 16kHz using a single GPU. Uses batch size 64 and forces overwrite of the config file with -f. The -n flag sets the base directory for logs and checkpoints. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/fspen \ -c configs/others/fspen.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Preview deletable checkpoints without deleting Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/index.md Runs the cleanup script without the --delete flag to check how many checkpoints can be deleted without actually removing them. ```bash python scripts/clean_checkpoints.py -n vbd ``` -------------------------------- ### Train FastEnhancer-Small on 48kHz dataset Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Starts training FastEnhancer-Small on a 48kHz dataset using a single GPU. The command sets the experiment name to '48khz/fastenhancer_s', uses the configuration file 'configs/fastenhancer_48khz/s.yaml', and enables the '-f' flag to force overwrite. Training uses mixed-precision with fp16 and a batch size of 64 per GPU. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n 48khz/fastenhancer_s \ -c configs/fastenhancer_48khz/s.yaml \ -f ``` -------------------------------- ### Train LiSenNet with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/lisennet.md Starts training LiSenNet on Voicebank-Demand at 16kHz with batch size 64. Saves config, tensorboard logs, and checkpoints to logs/vbd/16khz/lisennet. The -f flag forces overwriting the config file if the base directory exists. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/lisennet \ -c configs/others/lisennet.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Log directory structure after cleaning Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/index.md Shows the log directory after deleting all checkpoints except the last one in logs/vbd; only 00500.pth remains for each model under vbd. ```text logs ├─ vbd | ├─ fastenhancer_b | | └─ 00500.pth | └─ fastenhancer_t | └─ 00500.pth └─ dns └─ fastenhancer_b ├─ 00020.pth ├─ ... ├─ 00480.pth └─ 00500.pth ``` -------------------------------- ### Test LiSenNet training code Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/lisennet.md Runs a quick test of the training pipeline: executes 10 training steps, then validation, then objective metric calculation (pesq.interval=1) and terminates. Use this before starting full training; delete the logs/delete_it directory afterward. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n delete_it \ -c configs/others/lisennet.yaml \ -p train.test=True pesq.interval=1 \ -f ``` -------------------------------- ### Test training code with train.test=True Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Runs a quick test of the training code before starting full training. It executes only 10 training steps, then runs validation, and finally calculates objective metrics due to 'pesq.interval=1'. The experiment name is 'delete_it' and the configuration is 'configs/fastenhancer/l.yaml'. After the test, you can delete the 'logs/delete_it' directory. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n delete_it \ -c configs/fastenhancer/l.yaml \ -p train.test=True pesq.interval=1 \ -f ``` -------------------------------- ### Delete all checkpoints except the last one in logs/vbd Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/index.md Runs the cleanup script with the --delete flag to actually remove all checkpoints except the last one in the specified log directory. ```bash python scripts/clean_checkpoints.py -n vbd --delete ``` -------------------------------- ### Train BSRNN-xxt with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/bsrnn.md Starts training the BSRNN-xxt model on Voicebank-Demand at 16kHz using a single GPU. Uses configs/others/bsrnn_xxt.yaml, batch size 64, and forces overwrite of the config file with -f. Saves logs to logs/vbd/16khz/bsrnn_xxt. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/bsrnn_xxt \ -c configs/others/bsrnn_xxt.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Downsample dataset to 24kHz using scripts/resample.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/dataset/dns-challenge.md Run this command to downsample the DNS-Challenge dataset to a target sampling rate, e.g., 24kHz. Adjust --to-sr, --from-dir, and --to-dir as needed. ```bash python -m scripts.resample --to-sr 24000 --from-dir ~/Datasets/DNS_Challenge/dataset_fullband --to-dir ~/Datasets/DNS_Challenge/dataset_24khz ``` -------------------------------- ### Train FastEnhancer-Huge on DNS-Challenge with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Launches training for FastEnhancer-Huge-Noncausal on DNS-Challenge at 16kHz using 4 GPUs with mixed-precision fp16. Batch size is 16 per GPU (total 64). The -f flag forces overwriting the config file if the base directory exists. ```bash CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py \ -n dns/16khz/fastenhancer_h \ -c configs/fastenhancer_dns/huge_noncausal.yaml \ -p train.batch_size=16 valid.batch_size=16 pesq.batch_size=4 \ -f ``` -------------------------------- ### Build and Deploy with mkdocs gh-deploy Source: https://github.com/aask1357/fastenhancer/blob/main/docs/README.md Build the documentation and deploy it to GitHub Pages. After running this command, visit your GitHub repository, navigate to Settings->Pages->Build and deployment->Branch, select 'gh-pages', and save. ```bash mkdocs gh-deploy ``` -------------------------------- ### Resume LiSenNet training with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/lisennet.md Alternative resume command using torchrun. Loads the checkpoint from logs/vbd/16khz/lisennet and resumes training. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/lisennet ``` -------------------------------- ### Train LiSenNet with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/lisennet.md Alternative training command using torchrun with a single process. Equivalent to the train.py command, saving to the same base directory and using the same configuration and batch size. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/lisennet \ -c configs/others/lisennet.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Resume FSPEN training with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fspen.md Resumes training using torchrun with a single process, loading the checkpoint from the base directory. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/fspen ``` -------------------------------- ### Resume LiSenNet training with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/lisennet.md Resumes training from the checkpoint saved in logs/vbd/16khz/lisennet. Only the base directory is required; the configuration file is loaded from that directory. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/lisennet ``` -------------------------------- ### Resume training with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Resumes training from a saved checkpoint located at 'logs/vbd/16khz/fastenhancer_l' using four GPUs. The command uses the same experiment name to load the checkpoint and continue training. ```bash CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py \ -n vbd/16khz/fastenhancer_l ``` -------------------------------- ### Run ONNXRuntime for wav2wav model with scripts.test_onnx Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Executes a downloaded wav2wav ONNX file. The script supports both older overlapping-frame and newer hop-size-chunk input formats, reading the model's input shape to select framing and adding initial zero overlap for older models. Keep --hop-size equal to the model's output chunk size. ```bash python -m scripts.test_onnx --onnx-path onnx/fastenhancer_t.onnx ``` -------------------------------- ### Voicebank-Demand directory structure after download Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/dataset/voicebank-demand.md Expected directory layout after downloading and optionally downsampling the dataset. Shows the 16k and 48k subdirectories with clean/noisy train/test sets and the logfiles folder. ```text voicebank-demand ├─ 16k | ├─ clean_testset_wav | ├─ clean_trainset_28spk_wav | ├─ noisy_testset_wav | └─ noisy_trainset_28spk_wav ├─ 48k | ├─ clean_testset_wav | ├─ clean_trainset_28spk_wav | ├─ noisy_testset_wav | └─ noisy_trainset_28spk_wav └─ logfiles ├─ log_readme.txt ├─ log_testset.txt ├─ log_trainset_28spk.txt └─ transcript_testset.txt ``` -------------------------------- ### Resume training with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Alternative way to resume training from the same checkpoint using torchrun with four processes on a single node. This command uses 'train_torchrun.py' and the same experiment name 'vbd/16khz/fastenhancer_l'. ```bash CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --standalone --nproc_per_node=4 \ train_torchrun.py \ -n vbd/16khz/fastenhancer_l ``` -------------------------------- ### Train FastEnhancer-Large on Voicebank-Demand with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Launches training for FastEnhancer-Large on Voicebank-Demand at 16kHz using 4 GPUs with mixed-precision fp16. Batch size is 16 per GPU (total 64). The -f flag forces overwriting the config file if the base directory exists. ```bash CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py \ -n vbd/16khz/fastenhancer_l \ -c configs/fastenhancer/l.yaml \ -p train.batch_size=16 valid.batch_size=16 pesq.batch_size=4 \ -f ``` -------------------------------- ### Run metrics for DNS-Challenge without WER Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/metrics.md Use this command to calculate objective metrics for a model in `logs/fastenhancer_l` on the DNS-Challenge dev testset. WER is disabled because no transcript is available for this dataset. ```bash CUDA_VISIBLE_DEVICES=0 python -m scripts.metrics_ns -n fastenhancer_l --wer False ``` -------------------------------- ### Resume FSPEN training with python train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fspen.md Resumes training from the checkpoint saved in the base directory specified by -n. No -c flag is needed because the config file is loaded from the base directory. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/fspen ``` -------------------------------- ### Resume BSRNN-xxt training with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/bsrnn.md Alternative resume command using torchrun. Loads the checkpoint from the same base directory. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/bsrnn_xxt ``` -------------------------------- ### Test FSPEN training code Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fspen.md Runs a quick test of the training pipeline: executes 10 training steps, then validation, then objective metric calculation (pesq.interval=1) and terminates. Use -f to overwrite the config file. The logs are saved under logs/delete_it and can be deleted after the test. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n delete_it \ -c configs/others/fspen.yaml \ -p train.test=True pesq.interval=1 \ -f ``` -------------------------------- ### Train BSRNN-xxt with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/bsrnn.md Alternative training command using torchrun with a single process. Equivalent to the train.py command, using the same configuration and batch size. ```bash CUDA_VISIBLE_DEVICES=0 torchrun --standalone --nproc_per_node=1 \ train_torchrun.py \ -n vbd/16khz/bsrnn_xxt \ -c configs/others/bsrnn_xxt.yaml \ -p train.batch_size=64 valid.batch_size=64 \ -f ``` -------------------------------- ### Run ONNXRuntime for spec2spec model with scripts.test_onnx_spec Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Executes a downloaded spec2spec ONNX file. Use this command when the ONNX file is a spec2spec version. ```bash python -m scripts.test_onnx_spec --onnx-path onnx/fastenhancer_t_spec.onnx ``` -------------------------------- ### Train FastEnhancer-Large on Voicebank-Demand with torchrun Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Alternative launch for FastEnhancer-Large on Voicebank-Demand using torchrun with 4 processes. Uses the same configuration and batch size settings as the train.py variant. ```bash CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --standalone --nproc_per_node=4 \ train_torchrun.py \ -n vbd/16khz/fastenhancer_l \ -c configs/fastenhancer/l.yaml \ -p train.batch_size=16 valid.batch_size=16 pesq.batch_size=4 \ -f ``` -------------------------------- ### Downsample Voicebank-Demand to 16kHz using scripts/resample.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/dataset/voicebank-demand.md Run this command to downsample the Voicebank-Demand dataset from 48kHz to 16kHz. Adjust --to-sr, --from-dir, and --to-dir as needed. ```bash python -m scripts.resample --to-sr 16000 --from-dir ~/Datasets/voicebank-demand/48k --to-dir ~/Datasets/voicebank-demand/16k ``` -------------------------------- ### Export wav2wav ONNX model with scripts.export_onnx Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Exports a trained model to a wav2wav ONNX file using torchdynamo. The command assumes checkpoints are saved at logs/fastenhancer_l and saves the ONNX file to onnx/fastenhancer_l.onnx. ```bash python -m scripts.export_onnx -n fastenhancer_l --onnx-path onnx/fastenhancer_l.onnx ``` -------------------------------- ### Run metrics for Voicebank-Demand with transcript Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/metrics.md Use this command to calculate objective metrics for a model in `logs/fastenhancer_l` on the Voicebank-Demand testset. Requires the transcript directory path; WER is computed using Whisper-large-v3-turbo. ```bash CUDA_VISIBLE_DEVICES=0 python -m scripts.metrics_ns -n fastenhancer_l --transcript-dir PATH-TO-TRANSCRIPT ``` -------------------------------- ### Run ONNXRuntime for FastEnhancer-M with --hop-size 160 Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Model-specific setting for FastEnhancer-M: set --hop-size 160 when running the wav2wav ONNX test. ```bash python -m scripts.test_onnx --onnx-path onnx/fastenhancer_m.onnx --hop-size 160 ``` -------------------------------- ### Resume BSRNN-xxt training with train.py Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/bsrnn.md Resumes training from the checkpoint saved in logs/vbd/16khz/bsrnn_xxt. Only the -n flag is needed; the configuration file is loaded from the base directory. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n vbd/16khz/bsrnn_xxt ``` -------------------------------- ### Run ONNXRuntime for FastEnhancer-L with --hop-size 100 Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Model-specific setting for FastEnhancer-L: set --hop-size 100 when running the wav2wav ONNX test. ```bash python -m scripts.test_onnx --onnx-path onnx/fastenhancer_l.onnx --hop-size 100 ``` -------------------------------- ### Test BSRNN-xxt training code Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/bsrnn.md Runs a quick test of the training pipeline: executes 10 training steps, then validation, then computes objective metrics (pesq.interval=1) and terminates. Use -f to overwrite the config file. The logs are saved under logs/delete_it and can be deleted after the test. ```bash CUDA_VISIBLE_DEVICES=0 python train.py \ -n delete_it \ -c configs/others/bsrnn_xxt.yaml \ -p train.test=True pesq.interval=1 \ -f ``` -------------------------------- ### Return first h samples: return y[0:h] Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Returns the first h samples of the enhanced signal, which are now fully completed after overlap-add. ```python return y[0:h] ``` -------------------------------- ### Input cache concatenation: x = torch.cat([cache_in, x]) Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Concatenates the new input chunk with the input cache to form a full-length input of size n. The cache_in holds the previous n-h samples. ```python x = torch.cat([cache_in, x]) ``` -------------------------------- ### Update input cache: cache_in = x[h:n] Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Saves the last n-h samples of the current input as the new input cache for the next iteration. ```python cache_in = x[h:n] ``` -------------------------------- ### Generate enhanced signal: y = model(x) Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Runs the model on the full-length input to produce an enhanced signal of length n. ```python y = model(x) ``` -------------------------------- ### Set projection=channelwise and layerwise for scale-invariant parameters Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Manually sets projection modes for parameters that AdamP(projection=auto) may fail to detect as scale-invariant under mixed-precision training (train.fp16=True). The first group applies channelwise projection to weight_v and conv1d before BN; the second applies layerwise projection to the final conv weight. ```yaml - regex_list: - ".+parametrizations.+original1$" # weight_v - "enc_pre\.0\.weight" # conv1d before BN projection: channelwise - regex_list: - "dec_post\.3\.weight" # final conv projection: layerwise ``` -------------------------------- ### Export spec2spec ONNX model with scripts.export_onnx_spec Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Exports a trained model to a spec2spec ONNX file using torch.export. The command assumes checkpoints are saved at logs/fastenhancer_l and saves the ONNX file to onnx/fastenhancer_l.onnx. ```bash python -m scripts.export_onnx_spec -n fastenhancer_l --onnx-path onnx/fastenhancer_l.onnx ``` -------------------------------- ### Set weight_decay=0 and projection=disabled for GRU weight_g and final conv scale Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/train/fastenhancer.md Configures optimizer groups in configs/fastenhancer/l.yaml to disable weight decay and projection for GRU weight_g parameters and the final convolution scale parameter. Applying weight_decay=0 to weight_g improves performance due to tanh/sigmoid functions, and weight decay should not be applied to the final mask prediction. ```yaml - regex_list: - "rf_block\.\d\.rnn\.parametrizations.+original0$" # GRU weight_g - "dec_post\.3\.scale" # scale parameter of the final conv weight_decay: 0 projection: disabled ``` -------------------------------- ### Run ONNXRuntime for GTCRN with --win-type hann-sqrt Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Model-specific setting for GTCRN: set --win-type hann-sqrt when running the spec2spec ONNX test. ```bash python -m scripts.test_onnx_spec --onnx-path onnx/gtcrn_spec.onnx --win-type hann-sqrt ``` -------------------------------- ### Update output cache: cache_out = y[h:n] Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Saves the last n-h samples of the current output as the new output cache for the next iteration. ```python cache_out = y[h:n] ``` -------------------------------- ### Overlap-add with output cache: y[0:n-h] += cache_out Source: https://github.com/aask1357/fastenhancer/blob/main/docs/docs/onnx.md Adds the previous output cache to the beginning of the current output to perform overlap-add. ```python y[0:n-h] += cache_out ```