Run this model with HF Jobs
Run nvidia/audio-codec-22khz on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/nvidia/audio-codec-22khz. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/nvidia/audio-codec-22khz on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use nvidia/audio-codec-22khz with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- NeMo
How to use nvidia/audio-codec-22khz with NeMo:
# tag did not correspond to a valid NeMo domain.
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files58 unmodified lines59606162636465666768692 unmodified lines7273747576777879808124 unmodified lines10610710810911011111258 unmodified linesimport soundfile as sffrom nemo.collections.tts.models import AudioCodecModelcodec_path = ??? # set here the model .nemo checkpoint pathpath_to_input_audio = ??? # path of the input audiopath_to_output_audio = ??? # path of the reconstructed output audionemo_codec_model = AudioCodecModel.restore_from(restore_path=codec_path, map_location="cpu").eval()# get discrete tokens from audioaudio, _ = librosa.load(path_to_input_audio, sr=nemo_codec_model.sample_rate)2 unmodified linesaudio_tensor = torch.from_numpy(audio).unsqueeze(dim=0).to(device)audio_len = torch.tensor([audio_tensor[0].shape[0]]).to(device)encoded_tokens, encoded_len = nemo_codec_model.encode(audio=audio_tensor, audio_len=audio_len)# Reconstruct audio from tokensreconstructed_audio, _ = nemo_codec_model.decode(tokens=encoded_tokens, tokens_len=encoded_len)# save reconstructed audiooutput_audio = reconstructed_audio.cpu().numpy().squeeze()24 unmodified linesWe evaluate our codec using several objective audio quality metrics. We evaluate [ViSQOL](https://github.com/google/visqol) and [PESQ](https://lightning.ai/docs/torchmetrics/stable/audio/perceptual_evaluation_speech_quality.html) for perception quality, [ESTOI](https://ieeexplore.ieee.org/document/7539284) for intelligbility, mel spectrogram and STFT distances for spectral reconstruction accuracy, and [SI-SDR](https://arxiv.org/abs/1811.02508) for phase reconstruction accuracy. Metrics are reported on the test set for both the MLS English and CommonVoice data. The model has not been trained or evaluated on non-speech audio.| Dataset | ViSQOL |PESQ |ESTOI |Mel Distance |STFT Distance|SI-SDR||:-----------:|:----------:|:----------:|:----------:|:-----------:|:-----------:|:-----------:|| MLS English | 4.50 | 3.69 | 0.94 | 0.066 | 0.033 | 8.33 || CommonVoice | 4.53 | 3.55 | 0.93 | 0.100 | 0.057 | 7.63 |58 unmodified lines59606162636465666768692 unmodified lines727374757677787980818224 unmodified lines10710810911011111211358 unmodified linesimport soundfile as sffrom nemo.collections.tts.models import AudioCodecModelmodel_name = "nvidia/audio-codec-22khz"path_to_input_audio = ??? # path of the input audiopath_to_output_audio = ??? # path of the reconstructed output audionemo_codec_model = AudioCodecModel.from_pretrained(model_name).eval()# get discrete tokens from audioaudio, _ = librosa.load(path_to_input_audio, sr=nemo_codec_model.sample_rate)2 unmodified linesaudio_tensor = torch.from_numpy(audio).unsqueeze(dim=0).to(device)audio_len = torch.tensor([audio_tensor[0].shape[0]]).to(device)with torch.no_grad():encoded_tokens, encoded_len = nemo_codec_model.encode(audio=audio_tensor, audio_len=audio_len)# Reconstruct audio from tokensreconstructed_audio, _ = nemo_codec_model.decode(tokens=encoded_tokens, tokens_len=encoded_len)# save reconstructed audiooutput_audio = reconstructed_audio.cpu().numpy().squeeze()24 unmodified linesWe evaluate our codec using several objective audio quality metrics. We evaluate [ViSQOL](https://github.com/google/visqol) and [PESQ](https://lightning.ai/docs/torchmetrics/stable/audio/perceptual_evaluation_speech_quality.html) for perception quality, [ESTOI](https://ieeexplore.ieee.org/document/7539284) for intelligbility, mel spectrogram and STFT distances for spectral reconstruction accuracy, and [SI-SDR](https://arxiv.org/abs/1811.02508) for phase reconstruction accuracy. Metrics are reported on the test set for both the MLS English and CommonVoice data. The model has not been trained or evaluated on non-speech audio.| Dataset | ViSQOL |PESQ |ESTOI |Mel Distance |STFT Distance|SI-SDR ||:-----------:|:----------:|:----------:|:----------:|:-----------:|:-----------:|:-----------:|| MLS English | 4.50 | 3.69 | 0.94 | 0.066 | 0.033 | 8.33 || CommonVoice | 4.53 | 3.55 | 0.93 | 0.100 | 0.057 | 7.63 |
README.md+8-7