Installing MONAI Model Zoo on ROCm

Installing MONAI Model Zoo on ROCm#

2026-09-29

2 min read time

Applies to Linux

MONAI Model Zoo on ROCm installation requires MONAI on ROCm.

  1. Install MONAI on ROCm.

  2. Clone the AMD monai-model-zoo repository.

    The AMD ROCm overlay files are in the AMD monai-model-zoo repository.

    git clone https://github.com/AMD-Ecosystem/monai-model-zoo
    cd monai-model-zoo
    
  3. Download a bundle from the MONAI model registry.

    Replace bundle_name with the bundle you want to download, for example vista3d.

    python -m monai.bundle download bundle_name \
        --bundle_dir models/
    
  4. Set the MIOpen and TorchInductor environment variables. The overlays rely on TorchInductor autotuning and the channels-last MIOpen path.

    export PYTORCH_MIOPEN_SUGGEST_NHWC=1
    export MIOPEN_FIND_MODE=1
    export MIOPEN_FIND_ENFORCE=4
    
    export TORCHINDUCTOR_MAX_AUTOTUNE=1
    export TORCHINDUCTOR_MAX_AUTOTUNE_GEMM=1
    export TORCHINDUCTOR_COORDINATE_DESCENT_TUNING=1
    export TORCHINDUCTOR_EPILOGUE_FUSION=1
    export TORCHINDUCTOR_MAX_AUTOTUNE_CONV_BACKENDS=ATEN,TRITON
    
  5. Change directory to the bundle directory. Bundles load custom code from the bundle’s scripts/ package. This package must be on the Python path when the configuration is initialized.

    cd models/bundle_name
    
  6. Run inference with the ROCm overlay.

    Before running inference, prepare your input data. Refer to the docs/ directory inside the bundle for the expected input format.

    Pass the base inference configuration and the AMD ROCm overlay as a JSON list. The overlay merges into the base configuration at load time. --dataset_dir and --output_dir are resolved relative to the bundle directory. Use absolute paths to avoid ambiguity, for example --dataset_dir /path/to/input_dir.

    python -m monai.bundle run \
        --config_file "['configs/inference.json', \
                        'configs/inference_rocm.json']" \
        --bundle_root . \
        --dataset_dir /path/to/input_dir \
        --output_dir /path/to/output_dir
    

    Note

    Configuration files can be in either JSON or YAML format, depending on the bundle. The input key varies by bundle — for example, vista3d uses --input_dict. Refer to the docs/ directory inside the bundle for input format details. For information about overlay keys, see ROCm overlays. For information about overlay paths and configuration format, see Validated bundles.