Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime Error: torchvision::nms Operator Doesn't Exist #241

Open
prestonzen opened this issue Mar 9, 2025 · 4 comments
Open

Runtime Error: torchvision::nms Operator Doesn't Exist #241

prestonzen opened this issue Mar 9, 2025 · 4 comments

Comments

@prestonzen
Copy link

Runtime Error: torchvision::nms Operator Doesn't Exist

System Configuration

  • Platform: Runpod Container (Ubuntu Jammy 22.04)
  • Python Version: 3.10.9
  • CUDA Version: 12.4
  • GPU: 2 x RTX A6000
  • Installation Command Used:
    conda create -n HunyuanVideo python==3.10.9
    conda activate HunyuanVideo
    conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.4 -c pytorch -c nvidia

Error Message

After installing torchvision, I get the following error when trying to run sample_video.py:

RuntimeError: Didn't find operator for torchvision::nms. This could be because the operator doesn't exist or was omitted when the model was exported.

Steps to Reproduce

  1. Followed all steps from the [HunyuanVideo Installation Guide for Linux](https://github.com/Tencent/HunyuanVideo?tab=readme-ov-file#installation-guide-for-linux).
  2. Installed all models listed in the [HunyuanVideo Model Checkpoints](https://github.com/Tencent/HunyuanVideo/blob/main/ckpts/README.md).
  3. Tried running the following command:
    python3 sample_video.py \
        --video-size 720 1280 \
        --video-length 129 \
        --infer-steps 50 \
        --prompt "A cat walks on the grass, realistic style." \
        --flow-reverse \
        --use-cpu-offload \
        --save-path ./results
  4. Encountered the runtime error.

Debugging Attempts

  • Verified torchvision installation with:
    python -c "import torchvision; print(torchvision.__version__)"
    Output: 0.19.0
  • Checked available torchvision.ops:
    import torchvision.ops
    print(dir(torchvision.ops))  # `nms` is missing from the list
  • Reinstalled torchvision:
    pip uninstall torchvision
    pip install torchvision --no-cache-dir --force-reinstall
  • Ensured CUDA is available:
    import torch
    print(torch.cuda.is_available())  # Returns: True
  • Tried installing PyTorch and torchvision with:
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Expected Behavior

The torchvision.ops.nms function should work correctly without missing operator errors, allowing sample_video.py to run successfully.

Questions

  1. Is torchvision==0.19.0 fully compatible with pytorch==2.4.0 on CUDA 12.4?
  2. Should torchvision be compiled from source to fix this?
  3. Is this a known issue with nms being omitted in recent builds?
  4. Does HunyuanVideo require a specific torchvision version for proper functionality?

Any insights or solutions would be greatly appreciated. Thanks!

@prestonzen
Copy link
Author

It looks like the requirements.txt file didn't specify a CUDA version, leading to the wrong CUDA version being installed. By default, CUDA 12.8 was installed, but the correct version for compatibility with the installed PyTorch version is CUDA 11.8.

@prestonzen
Copy link
Author

Seems like a pip package dependency overrode the pytorch version

@qihanghou726
Copy link

Same problem

@mengsiwei
Copy link

After "pip install --upgrade torchvision", problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants