Views
No views yet
1# Create a virtual environment (recommended)
2python -m venv venv
3source venv/bin/activate # On Windows: venv\Scripts\activate
4
5# Install PyTorch (choose based on your CUDA version)
6# For CUDA 11.8:
7pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
8
9# For CUDA 12.1:
10pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
11
12# For CPU only:
13pip install torch torchvision torchaudio
14
15# Install LeRobot
16git clone https://github.com/huggingface/lerobot.git
17cd lerobot
18pip install -e .
19
20# Install additional dependencies
21pip install huggingface_hub pillow numpy pandas tqdm draccus1pip install huggingface_hub
2python -c "from huggingface_hub import snapshot_download; snapshot_download('kavinrajkrupsurge/act-lampe-movements')"1# Download the inference script from the repository
2# Or use the one provided in this repository
3
4python inference_hf.py \
5 --repo-id kavinrajkrupsurge/act-lampe-movements \
6 --image path/to/your/image.jpg \
7 --dataset-root /path/to/dataset # Optional if you have the dataset1from inference_hf import ACTInference
2from PIL import Image
3import numpy as np
4
5# Initialize model (will download automatically from Hugging Face)
6model = ACTInference(
7 repo_id="kavinrajkrupsurge/act-lampe-movements",
8 device="cuda" # or "cpu"
9)
10
11# Load image
12image = Image.open("path/to/image.jpg")
13
14# Predict action
15action = model.predict(
16 image=image,
17 state=np.array([0.0, 0.0]) # [position, velocity]
18)
19
20print(f"Position: {action[0]:.4f}, Velocity: {action[1]:.4f}")1from inference_hf import ACTInference
2from huggingface_hub import hf_hub_download
3import json
4import torch
5from pathlib import Path
6
7# Download specific checkpoint
8checkpoint_path = hf_hub_download(
9 repo_id="kavinrajkrupsurge/act-lampe-movements",
10 filename="checkpoints/checkpoint-003000/pretrained_model/config.json"
11)
12# Use the checkpoint path with ACTInference or modify the code to load from local pathauto_lampe_search/
├── auto_lampe_search_0/
│ ├── frames/
│ │ ├── frame_0000.jpg
│ │ ├── frame_0001.jpg
│ │ └── ...
│ ├── joint_trajectory.csv
│ └── metadata.json
├── auto_lampe_search_1/
│ └── ...
└── ...auto_lampe_search_{N}/frames/: Directory with images named frame_{XXXX}.jpgjoint_trajectory.csv: CSV with columns base_joint, velocity (and optionally joint2, joint3, joint4)metadata.json: JSON with episode metadata1# Clone the repository or download convert_to_lerobot.py
2python convert_to_lerobot.py/workspace/lerobot_dataset.1# Install LeRobot first (see installation section above)
2cd lerobot
3
4python -m lerobot.scripts.lerobot_train \
5 --dataset.repo_id=local/auto_lampe_search \
6 --dataset.root=/path/to/lerobot_dataset \
7 --policy.type=act \
8 --policy.push_to_hub=false \
9 --output_dir=/path/to/outputs/act_lampe_search \
10 --job_name=act_lampe_search \
11 --policy.device=cuda \
12 --batch_size=16 \
13 --steps=5000 \
14 --policy.optimizer_lr=1e-4 \
15 --policy.optimizer_weight_decay=1e-2 \
16 --policy.chunk_size=20 \
17 --policy.n_action_steps=20 \
18 --policy.n_obs_steps=1 \
19 --policy.dropout=0.3 \
20 --policy.dim_model=256 \
21 --policy.dim_feedforward=1024 \
22 --policy.n_encoder_layers=2 \
23 --policy.n_decoder_layers=1 \
24 --policy.use_vae=false \
25 --save_freq=1000 \
26 --wandb.enable=falsepython push_to_huggingface.py[position, velocity][position, velocity]act-lampe-movements/
├── README.md # This file
├── inference_hf.py # Inference script
├── config.json # Model configuration (checkpoint-005000)
├── model.safetensors # Model weights (checkpoint-005000)
├── policy_preprocessor.json # Preprocessor config
├── policy_postprocessor.json # Postprocessor config
├── train_config.json # Training configuration
└── checkpoints/ # All training checkpoints
├── checkpoint-001000/
│ └── pretrained_model/
├── checkpoint-002000/
│ └── pretrained_model/
├── checkpoint-003000/
│ └── pretrained_model/
├── checkpoint-004000/
│ └── pretrained_model/
└── checkpoint-005000/
└── pretrained_model/torch>=2.0.0
torchvision>=0.15.0
lerobot
huggingface_hub
pillow
numpy
pandas
tqdm
draccus1pip install torch torchvision torchaudio huggingface_hub pillow numpy pandas tqdm draccus
2pip install -e lerobot # After cloning lerobot repository--batch_size=8 or --batch_size=4--policy.device=cpu (slower but uses less memory)--policy.dim_model and --policy.dim_feedforwardconvert_to_lerobot.py are correcthuggingface_hub installed: pip install huggingface_hubhuggingface-cli login[position, velocity]device="cuda"1@misc{act-lampe-movements,
2 author = {Your Name},
3 title = {ACT Model for Lamp Search Task},
4 year = {2024},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/kavinrajkrupsurge/act-lampe-movements}}
7}