WhisperASR can not initialize in nano_llm Agent studio

When I try to install WhisperASR using nano_llm.studio, I get the below error:

File "/usr/local/lib/python3.10/dist-packages/whisper/model.py", line 124, in qkv_attention
    a = scaled_dot_product_attention(
TypeError: scaled_dot_product_attention(): argument 'is_causal' must be bool, not Tensor

When I tried to change the function call in that file from the current :

a = scaled_dot_product_attention(
    q, k, v,
    is_causal=mask is not None and n_ctx > 1
)

to

a = scaled_dot_product_attention(
    q, k, v,
    is_causal=True
)

then I get an error later down the stack

04:34:20 | INFO | loading Whisper model 'base.en' with TensorRT
/opt/whisper_trt/whisper_trt/model.py:334: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  checkpoint = torch.load(trt_model_path)
[01/26/2025-04:34:20] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[01/26/2025-04:34:20] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[01/26/2025-04:34:21] [TRT] [E] IExecutionContext::setTensorAddress: Error Code 3: Internal Error (Given invalid tensor name: mask. Get valid tensor names with getIOTensorName())
[01/26/2025-04:34:23] [TRT] [E] IExecutionContext::setInputShape: Error Code 3: Internal Error (Given invalid tensor name: mask. Get valid tensor names with getIOTensorName())
... repeated quite a bit of times.....

04:34:23 | WARNING | attempted to set unknown parameter WhisperASR.init_kwargs={'model': 'base', 'language_code': 'en_US', 'partial_transcripts': 0.25, 'name': 'WhisperASR'} (skipping)
04:34:23 | INFO | Loaded WhisperASR in 3.9 seconds<br/>&nbsp;&nbsp;{ 'language_code': 'en_US',<br/>  'model': 'base',<br/>  'name': 'WhisperASR',<br/>  'partial_transcripts': 0.25}
04:34:23 | INFO | plugin | connected WebAudioIn to VADFilter on channel 0
04:34:23 | INFO | plugin | connected VADFilter to WhisperASR on channel 0
04:34:23 | INFO | Loaded preset WhisperASR (3 nodes)

I am assuming the whisper model in the docker image is not compatible with the PyTorch (2.4) in the image. Is there an updated whisper model and how can I resolve the issue above?

1 Like

I am using nano_llm:r36.4.0 with JetPack -
# R36 (release), REVISION: 4.0, GCID: 37537400, BOARD: generic, EABI: aarch64, DATE: Fri Sep 13 04:36:44 UTC 2024

using NVIDIA Jetson AGX Orin 64GB Developer Kit

Was your issue resolved? I’m experiencing the same problem—even after updating nano_llm to version 36.4.2, it still hasn’t been fixed.

Yes, based on the suggestion here: failed to run with whisper 20240930 · Issue #12 · NVIDIA-AI-IOT/whisper_trt · GitHub

Applied the fix to the docker image and saved it. Long term fix is needed in the repo itself.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.