Skip to content

Instantly share code, notes, and snippets.

@shreyasgite
Created March 15, 2025 04:28
Show Gist options
  • Save shreyasgite/1285cb0f49dc02d8d294f2811fd8c132 to your computer and use it in GitHub Desktop.
Save shreyasgite/1285cb0f49dc02d8d294f2811fd8c132 to your computer and use it in GitHub Desktop.
Training script for lerobot using modal
import modal
# how to run:
# modal run modal_deploy.py
# modal run --detach modal_deploy.py
image = (
modal.Image
.debian_slim()
.pip_install_from_pyproject("pyproject.toml")
.add_local_python_source("lerobot")
)
app = modal.App(name="lerobot-train", image=image)
@app.function(gpu="A10G", volumes={"/out": modal.Volume.from_name("lerobot")}, timeout=86400)
def train_lerobot():
import subprocess
command = [
"python", "lerobot/scripts/train.py",
f"--dataset.repo_id=shreyasgite/so100",
"--policy.type=act",
"--output_dir=/out/so100",
"--job_name=act_so100_base_env",
"--device=cuda",
# "--wandb.enable=true"
]
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1) as process:
for line in process.stdout:
print(line, end='') # Print each line as it is received
process.wait() # Wait for the process to complete
@app.local_entrypoint()
def main():
return train_lerobot.remote()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment