Windows ROCm (RX 9070 XT) fix: two crashes on a clean venv_rocm install — vector_quantize_pytorch dist_nn import + torchao/quantization
#1285
Replies: 1 comment
TitleUpdate: third Windows ROCm fix (LoRA/LoKr preprocessing) + correction on the quantization patch PostFollow-up to my earlier post on Windows ROCm crashes (vector_quantize_pytorch Setup, unchanged: RX 9070 XT, Windows 11, ROCm SDK 7.2.26024, torch Correction: the quantization/torchao patch may no longer be neededAfter pulling latest Still true and worth repeating: don't manually New: LoRA/LoKr dataset preprocessing crashHit this while trying to build a training dataset (Preprocess to Tensors step): Same underlying cause as the other torchcodec-related issues on ROCm: Fix — import torch
import torchaudio
import soundfile as sf
def load_audio_stereo(audio_path: str, target_sample_rate: int, max_duration: float):
"""Load audio, resample, convert to stereo, and truncate."""
try:
audio, sr = torchaudio.load(audio_path)
except Exception:
data, sr = sf.read(audio_path, always_2d=True, dtype="float32")
audio = torch.from_numpy(data.T)
if sr != target_sample_rate:
resampler = torchaudio.transforms.Resample(sr, target_sample_rate)
audio = resampler(audio)
if audio.shape[0] == 1:
audio = audio.repeat(2, 1)
elif audio.shape[0] > 2:
audio = audio[:2, :]
max_samples = int(max_duration * target_sample_rate)
if audio.shape[1] > max_samples:
audio = audio[:, :max_samples]
return audio, srWith this in place, LoRA and LoKr training both ran end-to-end on this card — training completed, export worked, and the adapter loaded correctly for generation (see note below on a confusing-but-harmless log warning you'll likely see). Side note: confusing (but harmless) LoKr load warningIf you train and load a LoKr adapter, you'll likely see this in the log and think it failed: This is a false alarm. That message comes from the PEFT-LoRA-specific adapter registry ( Updated patch scriptAll three fixes (dist_nn, quantization fallback as a no-op-safe legacy patch, preprocess_audio) are now in one idempotent script — detects what's already applied/not applicable and skips accordingly, backs up originals before touching anything: [link to your gist/repo] Unblock-File -Path .\apply_rocm_patches.ps1 # first run only if downloaded via browser
.\apply_rocm_patches.ps1 |
Uh oh!
There was an error while loading. Please reload this page.
Title
README.md
Post
Posting this in case it saves someone else the troubleshooting time — hit two separate crashes getting ACE-Step 1.5 running on Windows + ROCm, both reproducible on a completely clean
venv_rocmfollowing the officialrequirements-rocm.txtinstall path. Neither is specific to my card; both trace back to gaps in AMD's Windows ROCm torch build itself.Setup: RX 9070 XT, Windows 11, ROCm SDK 7.2.26024, torch
2.9.1+rocmsdk20260116, Python 3.12.Crash 1:
vector_quantize_pytorch— cannot importgroupfromtorch.distributedvector_quantize_pytorchunconditionally importstorch.distributed.nnat module load, even though ACE-Step only needs it for single-GPU inference. The Windows ROCm torch build ships an incompletetorch.distributed(nn/grouparen't there), so the import fails and takes model loading down with it. The package's ownis_distributed()/maybe_distributed_mean()helpers already guard their usage ofdist/dist_nn, so it's safe to just let the import fail quietly:Saw the identical trace reported on a 9060 XT in #644, so this isn't card-specific.
Crash 2:
torchaorequired for quantization — and can't actually be installed on Windows ROCmACE-Step auto-picks a quantization mode for some GPU memory tiers (mine, 16GB-class, was one), and
handler.pytreats missingtorchaoas fatal instead of falling back.Important: don't just
pip install torchao— it makes things worse. torchao's float8 path eagerly importstorch.distributed._functional_collectives, which needstorch._C._distributed_c10d— a native compiled component that's simply missing from the Windows ROCm torch build. This crashes even earlier than the original error (atdiffusersimport time):There's no Windows ROCm build of torchao — it's built around CUDA kernels. The working fix is to catch the missing import in
handler.pyand just disable quantization:Saw several people hit the missing-torchao error and try to force-install it in #55, #84, #124 — none mentioned the deeper native
torch._C._distributed_c10dfailure that causes on Windows ROCm specifically, so flagging that explicitly here.Patch script
Wrote a small PowerShell script that applies both fixes to a
venv_rocm+ repo checkout. It's idempotent (detects and skips anything already patched) and backs up originals to<filename>.bak:Re-run it after recreating
venv_rocm, afterpip install -r requirements-rocm.txt, or after agit pull(fix #2 lives inhandler.py, so an update can overwrite it).Full script + writeup: [link to your gist/repo]
Happy to open this as a proper PR if a maintainer points me at the right approach for the quantization-tier auto-selection logic — the patch above is a workaround (quantization is disabled entirely on ROCm, not made to work), not a real fix for that path.
apply_rocm_patches.zip
All reactions