Training workers are spawned via multiprocessing spawn before detect_hardware() runs, so IS_ROCM is still False. If the user never set HIP_VISIBLE_DEVICES in their shell, _inherits_rocm_visibility is also False, leaving the worker with only CUDA_VISIBLE_DEVICES set. On ROCm hosts the HIP runtime honors HIP_VISIBLE_DEVICES over CUDA_VISIBLE_DEVICES, so the worker saw the full device list and torch raised "no usable HIP accelerator" on some setups. Fall back to probing torch.version.hip (a build-time attribute, safe to read before GPU init) to detect ROCm when neither IS_ROCM nor inherited env vars are available. Mirrors the existing fix in llama_cpp.py for llama-server subprocess GPU pinning. Fixes https://github.com/unslothai/unsloth/issues/5180 |
||
|---|---|---|
| .. | ||
| python | ||
| qlora | ||
| saving | ||
| sh | ||
| studio | ||
| utils | ||
| __init__.py | ||
| run_all.sh | ||
| test_cli_export_unpacking.py | ||
| test_gemma4_chat_template.py | ||
| test_get_model_name.py | ||
| test_loader_glob_skip.py | ||
| test_model_registry.py | ||
| test_peft_weight_converter_compat.py | ||
| test_raw_text.py | ||
| test_resolve_model_class.py | ||