NVIDIA / NeMo

A scalable generative AI framework built for researchers and developers working on Large Language Models, Multimodal, and Speech AI (Automatic Speech Recognition and Text-to-Speech)
https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html
Apache License 2.0
12.3k stars 2.55k forks source link

canary-1b is not exportable #11004

Open pdufour opened 1 month ago

pdufour commented 1 month ago

Describe the bug

The Canary model is not exportable to onnx. It seems like it was not configured to be exportable.

Steps/Code to reproduce bug

import nemo.collections.asr as nemo_asr

def main():
    # Load Canary model
    model_name = "nvidia/canary-1b"
    print(f"Loading model: {model_name}")
    model = nemo_asr.models.ASRModel.from_pretrained(model_name=model_name)

    # Prepare for export
    model.eval()

    # Try to export - this will raise the error
    output_path = "canary.onnx"
    print("Attempting ONNX export...")
    model.export(
        output_path,
        onnx_opset_version=17,
        verbose=True
    )

if __name__ == "__main__":
    main()

This gives the error:

AttributeError: 'EncDecMultiTaskModel' object has no attribute 'output_names'
Traceback:
File "venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
             ^^^^^^
File "venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
    exec(code, module.__dict__)
File "app.py", line 22, in <module>
    main()
File "app.py", line 15, in main
    model.export(
File "nemo/core/classes/exportable.py", line 117, in export
    out, descr, out_example = model._export(
                              ^^^^^^^^^^^^^^
File "nemo/core/classes/exportable.py", line 196, in _export
    output_names = self.output_names
                   ^^^^^^^^^^^^^^^^^
File "venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1931, in __getattr__
    raise AttributeError(

Expected behavior

I would expect to be able to export this model.

Environment overview (please complete the following information)

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

pdufour commented 1 week ago

Hi just commenting since GH marked this as stale.