Lerobot RuntimeError: HIP error: invalid device function
I was trying to run lerobot-train within the lerobot container. However the script fails with
RuntimeError: HIP error: invalid device function
My setup:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
PyTorch version: 2.4.0a0+git7cecbf6
ROCm version: 6.3.42134-a9a80e791
CUDA available: True
Device count: 1
Device 0: AMD Radeon RX 5700
Memory: 8.0 GB
Compute capability: 10.1
Output from lerobot-train:
python lerobot_train.py --dataset.repo_id=mark/test1 \
--policy.type=act \
--output_dir=outputs/train/act_so101_test \
--job_name=act_so101_test \
--policy.device=cuda \
--wandb.enable=false \
--policy.push_to_hub=false\
--steps=300000
WARNING:root:'torchcodec' is not available in your platform, falling back to 'pyav' as a default decoder
WARNING:root:'torchcodec' is not available in your platform, falling back to 'pyav' as a default decoder
INFO 2025-10-19 20:05:38 ot_train.py:163 {'batch_size': 8,
'dataset': {'episodes': None,
'image_transforms': {'enable': False,
'max_num_transforms': 3,
'random_order': False,
'tfs': {'brightness': {'kwargs': {'brightness': [0.8,
1.2]},
'type': 'ColorJitter',
'weight': 1.0},
'contrast': {'kwargs': {'contrast': [0.8,
1.2]},
'type': 'ColorJitter',
'weight': 1.0},
'hue': {'kwargs': {'hue': [-0.05,
0.05]},
'type': 'ColorJitter',
'weight': 1.0},
'saturation': {'kwargs': {'saturation': [0.5,
1.5]},
'type': 'ColorJitter',
'weight': 1.0},
'sharpness': {'kwargs': {'sharpness': [0.5,
1.5]},
'type': 'SharpnessJitter',
'weight': 1.0}}},
'repo_id': 'mark/test1',
'revision': None,
'root': None,
'streaming': False,
'use_imagenet_stats': True,
'video_backend': 'pyav'},
'env': None,
'eval': {'batch_size': 50, 'n_episodes': 50, 'use_async_envs': False},
'eval_freq': 20000,
'job_name': 'act_so101_test',
'log_freq': 200,
'num_workers': 4,
'optimizer': {'betas': [0.9, 0.999],
'eps': 1e-08,
'grad_clip_norm': 10.0,
'lr': 1e-05,
'type': 'adamw',
'weight_decay': 0.0001},
'output_dir': 'outputs/train/act_so101_test',
'policy': {'chunk_size': 100,
'device': 'cuda',
'dim_feedforward': 3200,
'dim_model': 512,
'dropout': 0.1,
'feedforward_activation': 'relu',
'input_features': {},
'kl_weight': 10.0,
'latent_dim': 32,
'license': None,
'n_action_steps': 100,
'n_decoder_layers': 1,
'n_encoder_layers': 4,
'n_heads': 8,
'n_obs_steps': 1,
'n_vae_encoder_layers': 4,
'normalization_mapping': {'ACTION': <NormalizationMode.MEAN_STD: 'MEAN_STD'>,
'STATE': <NormalizationMode.MEAN_STD: 'MEAN_STD'>,
'VISUAL': <NormalizationMode.MEAN_STD: 'MEAN_STD'>},
'optimizer_lr': 1e-05,
'optimizer_lr_backbone': 1e-05,
'optimizer_weight_decay': 0.0001,
'output_features': {},
'pre_norm': False,
'pretrained_backbone_weights': 'ResNet18_Weights.IMAGENET1K_V1',
'pretrained_path': None,
'private': None,
'push_to_hub': False,
'replace_final_stride_with_dilation': False,
'repo_id': None,
'tags': None,
'temporal_ensemble_coeff': None,
'type': 'act',
'use_amp': False,
'use_vae': True,
'vision_backbone': 'resnet18'},
'resume': False,
'save_checkpoint': True,
'save_freq': 20000,
'scheduler': None,
'seed': 1000,
'steps': 300000,
'use_policy_training_preset': True,
'wandb': {'disable_artifact': False,
'enable': False,
'entity': None,
'mode': None,
'notes': None,
'project': 'lerobot',
'run_id': None}}
INFO 2025-10-19 20:05:38 ot_train.py:171 Logs will be saved locally.
INFO 2025-10-19 20:05:38 ot_train.py:183 Creating dataset
INFO 2025-10-19 20:05:38 ot_train.py:202 Creating policy
Downloading: "https://download.pytorch.org/models/resnet18-f37072fd.pth" to /root/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 44.7M/44.7M [00:01<00:00, 28.4MB/s]
INFO 2025-10-19 20:05:41 ot_train.py:243 Creating optimizer and scheduler
INFO 2025-10-19 20:05:41 ot_train.py:255 Output dir: outputs/train/act_so101_test
INFO 2025-10-19 20:05:41 ot_train.py:258 cfg.steps=300000 (300K)
INFO 2025-10-19 20:05:41 ot_train.py:259 dataset.num_frames=316 (316)
INFO 2025-10-19 20:05:41 ot_train.py:260 dataset.num_episodes=2
INFO 2025-10-19 20:05:41 ot_train.py:263 Effective batch size: 8 x 1 = 8
INFO 2025-10-19 20:05:41 ot_train.py:264 num_learnable_params=51597190 (52M)
INFO 2025-10-19 20:05:41 ot_train.py:265 num_total_params=51597190 (52M)
INFO 2025-10-19 20:05:41 ot_train.py:320 Start offline training on a fixed dataset
Traceback (most recent call last):
File "/ryzers/lerobot/src/lerobot/scripts/lerobot_train.py", line 444, in <module>
main()
File "/ryzers/lerobot/src/lerobot/scripts/lerobot_train.py", line 440, in main
train()
File "/ryzers/lerobot/src/lerobot/configs/parser.py", line 225, in wrapper_inner
response = fn(cfg, *args, **kwargs)
File "/ryzers/lerobot/src/lerobot/scripts/lerobot_train.py", line 325, in train
batch = preprocessor(batch)
File "/ryzers/lerobot/src/lerobot/processor/pipeline.py", line 294, in __call__
transformed_transition = self._forward(transition)
File "/ryzers/lerobot/src/lerobot/processor/pipeline.py", line 311, in _forward
transition = processor_step(transition)
File "/ryzers/lerobot/src/lerobot/processor/normalize_processor.py", line 451, in __call__
new_transition[TransitionKey.OBSERVATION] = self._normalize_observation(
File "/ryzers/lerobot/src/lerobot/processor/normalize_processor.py", line 260, in _normalize_observation
new_observation[key] = self._apply_transform(tensor, key, feature.type, inverse=inverse)
File "/ryzers/lerobot/src/lerobot/processor/normalize_processor.py", line 335, in _apply_transform
denom = std + self.eps
RuntimeError: HIP error: invalid device function
HIP kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing AMD_SERIALIZE_KERNEL=3
Compile with `TORCH_USE_HIP_DSA` to enable device-side assertions.
Exception in thread Thread-3 (_pin_memory_loop):
Traceback (most recent call last):
File "/opt/conda/envs/py_3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
hi @Mk-arc - can you try running export HSA_OVERRIDE_GFX_VERSION=11.0.0 before the train script?
Tried it I am getting very weird behavior with this, its like the entire container freezes and when I want to stop it, then even the host crashes, reproducible.
It seems to freeze also in different points in time after executing lerobot-train, sometimes here:
INFO 2025-10-23 20:36:25 ot_train.py:171 Logs will be saved locally.
INFO 2025-10-23 20:36:25 ot_train.py:183 Creating dataset
INFO 2025-10-23 20:36:25 ot_train.py:202 Creating policy
Sometimes a little later.
hi @Mk-arc, have you been able to run any pytorch stuff with ROCm7?
It seems like gfx1010 (AMD Radeon RX 5700) isn't listed as a supported card for this release: https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html
Our goto override of 11.0.0 usually works when working with RDNA3 or RDNA3.5 iGPUs you find on minipcs (which is what we're primarily targeting with ryzers)
You might need to try a different HSA_OVERRIDE that works for your card or patch the init_image to use a different ROCm version.
Hmm even in the list past compatibility list i could need find my GPU as supported. So maybe that is the core issue here.
Regarding torch. I Tried this:
import torch
for i in range(torch.cuda.device_count()):
print(torch.cuda.get_device_properties(i).name)
Which succecsfully showed my GPU as cuda device. Thus, I got hopeful that it might work.
Hi @Mk-arc, I'm closing this out since we only support devices with ROCm7.0 support and beyond.
But let us know if you found an HSA override or anything that worked for you. It would be good know if it's possible for anyone else coming across similar issues.