Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/lerobot/policies/pi05/modeling_pi05.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,18 @@ def __init__(self, config: PI05Config, rtc_processor: RTCProcessor | None = None
self.gradient_checkpointing_enabled = False

# Compile model if requested
# Note: torch.compile is not fully supported on MPS (Apple Silicon) yet
if config.compile_model:
torch.set_float32_matmul_precision("high")
self.sample_actions = torch.compile(self.sample_actions, mode=config.compile_mode)
# Also compile the main forward pass used during training
self.forward = torch.compile(self.forward, mode=config.compile_mode)
if config.device == "mps":
logging.warning(
"torch.compile is not fully supported on MPS device. "
"Skipping model compilation. Performance may be slower than on CUDA."
)
else:
torch.set_float32_matmul_precision("high")
self.sample_actions = torch.compile(self.sample_actions, mode=config.compile_mode)
# Also compile the main forward pass used during training
self.forward = torch.compile(self.forward, mode=config.compile_mode)

msg = """An incorrect transformer version is used, please create an issue on https://github.com/huggingface/lerobot/issues"""

Expand Down