A newer version of the Gradio SDK is available: 6.14.0
ROCm Migration Cookbook
PyTorch device handling
Use a runtime device abstraction instead of hardcoding .cuda() or torch.device("cuda") everywhere.
import torch
# ROCm PyTorch exposes AMD GPUs through the torch.cuda namespace.
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)
inputs = inputs.to(device)
GPU inspection
Replace NVIDIA-only commands with ROCm equivalents:
rocm-smi --showproductname --showmeminfo vram --showuse
Containers
For vLLM serving on AMD GPUs, use the ROCm-enabled vLLM image:
docker pull vllm/vllm-openai-rocm:latest
Run with AMD GPU device access:
docker run --rm -it --device /dev/kfd --device /dev/dri --group-add video --ipc=host --network=host --security-opt seccomp=unconfined vllm/vllm-openai-rocm:latest
Manual review cases
Manual migration is still required for CUDA C++ kernels, CUDA-only binary wheels, custom Triton kernels, and libraries that ship only CUDA builds.