### Install AI4Bharat NeMo Source: https://github.com/ai4bharat/indicconformerasr/blob/master/README.md Clone the AI4Bharat NeMo repository and checkout the nemo-v2 branch to install the necessary tools for working with IndicConformer models. This command is required before loading, training, or fine-tuning. ```bash git clone https://github.com/AI4Bharat/NeMo.git && cd NeMo && git checkout nemo-v2 && bash reinstall.sh ``` -------------------------------- ### Install AI4Bharat NeMo Fork Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Clone and install the AI4Bharat fork of NeMo from the specified Git repository and branch. This is a prerequisite for loading and running IndicConformer models. ```bash git clone https://github.com/AI4Bharat/NeMo.git cd NeMo git checkout nemo-v2 bash reinstall.sh ``` -------------------------------- ### Download IndicConformer Models Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Download pre-trained IndicConformer .nemo model files from the object store. Supports both a large multilingual model and specific monolingual models. ```bash wget https://objectstore.e2enetworks.net/indicconformer/models/indicconformer_stt_multi_hybrid_rnnt_600m.nemo ``` ```bash wget https://objectstore.e2enetworks.net/indicconformer/models/indicconformer_stt_hi_hybrid_rnnt_large.nemo ``` ```bash wget https://objectstore.e2enetworks.net/indicconformer/models/indicconformer_stt_ta_hybrid_rnnt_large.nemo ``` -------------------------------- ### Load IndicConformer Model with NeMo Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Load a downloaded .nemo model file using the NeMo framework. This prepares the model for subsequent inference or fine-tuning tasks. ```python import nemo.collections.asr as nemo_asr asr_model = nemo_asr.models.EncDecRNNTBPEModel.restore_from( restore_path="indicconformer_stt_multi_hybrid_rnnt_600m.nemo" ) print(asr_model) ``` -------------------------------- ### Programmatically Construct Model Download URLs Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Generates download URLs for IndicConformer ASR models based on language code. Handles both single language and multilingual models. ```python BASE_URL = "https://objectstore.e2enetworks.net/indicconformer/models/" def get_model_url(lang_code: str) -> str: if lang_code == "multi": return BASE_URL + "indicconformer_stt_multi_hybrid_rnnt_600m.nemo" return BASE_URL + f"indicconformer_stt_{lang_code}_hybrid_rnnt_large.nemo" print(get_model_url("ta")) # Tamil # https://objectstore.e2enetworks.net/indicconformer/models/indicconformer_stt_ta_hybrid_rnnt_large.nemo print(get_model_url("multi")) # Multilingual # https://objectstore.e2enetworks.net/indicconformer/models/indicconformer_stt_multi_hybrid_rnnt_600m.nemo ``` -------------------------------- ### Run Inference on Audio Files Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Transcribe one or more audio files using a loaded IndicConformer model. Ensure audio files are in WAV format, preferably 16kHz mono for optimal results. ```python import nemo.collections.asr as nemo_asr asr_model = nemo_asr.models.EncDecRNNTBPEModel.restore_from( restore_path="indicconformer_stt_hi_hybrid_rnnt_large.nemo" ) audio_files = ["speech_hindi_1.wav", "speech_hindi_2.wav"] transcriptions = asr_model.transcribe(paths2audio_files=audio_files) for path, text in zip(audio_files, transcriptions): print(f"{path}: {text}") ``` -------------------------------- ### Multilingual Inference with IndicConformer Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Utilize the single 600M multilingual IndicConformer model to transcribe audio across various Indian languages without needing to switch models. This demonstrates the model's broad linguistic coverage. ```python import nemo.collections.asr as nemo_asr asr_model = nemo_asr.models.EncDecRNNTBPEModel.restore_from( restore_path="indicconformer_stt_multi_hybrid_rnnt_600m.nemo" ) mixed_audio = [ "audio_assamese.wav", # as "audio_tamil.wav", # ta "audio_bengali.wav", # bn "audio_urdu.wav", # ur ] transcriptions = asr_model.transcribe(paths2audio_files=mixed_audio) for path, text in zip(mixed_audio, transcriptions): print(f"{path}: {text}") ``` -------------------------------- ### Fine-Tune IndicConformer Model Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Fine-tune an existing IndicConformer model on a custom dataset using the NeMo training pipeline. Requires a training configuration file (train_config.yaml) specifying dataset manifests and trainer settings. ```python import pytorch_lightning as pl import nemo.collections.asr as nemo_asr from omegaconf import OmegaConf asr_model = nemo_asr.models.EncDecRNNTBPEModel.restore_from( restore_path="indicconformer_stt_hi_hybrid_rnnt_large.nemo" ) cfg = OmegaConf.load("train_config.yaml") trainer = pl.Trainer( max_epochs=cfg.trainer.max_epochs, devices=cfg.trainer.devices, accelerator="gpu", ) asr_model.set_trainer(trainer) asr_model.setup_training_data(cfg.model.train_ds) asr_model.setup_validation_data(cfg.model.validation_ds) trainer.fit(asr_model) ``` -------------------------------- ### Save Fine-tuned ASR Model Source: https://context7.com/ai4bharat/indicconformerasr/llms.txt Saves a fine-tuned ASR model to a specified file path. Ensure the model object is properly trained before saving. ```python asr_model.save_to("indicconformer_hi_finetuned.nemo") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.