-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (113 loc) · 5.14 KB
/
Copy pathMakefile
File metadata and controls
139 lines (113 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
export PYTHONPATH=$(shell pwd)
.PHONY: help install setup-mise setup-env collect-data train eval clean format lint test gpu-info
# Colors
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[1;33m
BLUE := \033[0;34m
NC := \033[0m
help: ## Show this help message
@printf "${BLUE}ACT Robot Manipulation Project${NC}\n"
@printf "${YELLOW}Available commands:${NC}\n"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " ${GREEN}%-20s${NC} %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# =============================================================================
# ENVIRONMENT SETUP
# =============================================================================
setup-mise: ## Install mise and set up tool versions
@printf "${BLUE}Setting up mise...${NC}\n"
@if ! command -v mise &> /dev/null; then \
curl https://mise.run | sh; \
echo 'eval "$$(mise activate bash)"' >> ~/.bashrc; \
fi
@mise install
@mise use python@3.12
@printf "${GREEN}✓ Mise setup complete${NC}\n"
install: setup-mise ## Install all dependencies
@printf "${BLUE}Installing dependencies...${NC}\n"
@python -m pip install --upgrade pip
@pip install -r requirements/base.txt
@pip install -r requirements/dev.txt
@$(MAKE) install-gpu-deps
@pre-commit install || true
@printf "${GREEN}✓ Installation complete${NC}\n"
install-gpu-deps: ## Install GPU-specific dependencies
@printf "${BLUE}Detecting GPU and installing dependencies...${NC}\n"
@python -c "import src.utils.gpu_utils; src.utils.gpu_utils.install_gpu_dependencies()"
setup-env: ## Set up environment variables
@if [ ! -f .env ]; then \
cp .env.example .env; \
printf "${YELLOW}Created .env file. Please edit with your settings.${NC}\n"; \
fi
# =============================================================================
# DATA & TRAINING
# =============================================================================
collect-data: ## Run interactive data collection
@printf "${BLUE}Starting data collection...${NC}\n"
@printf "${YELLOW}Press keys in terminal to control robot${NC}\n"
@python -m src.collect_data
train: ## Train ACT policy
@printf "${BLUE}Starting training...${NC}\n"
@python -m src.train_act
@printf "${GREEN}✓ Training complete!${NC}\n"
eval: ## Evaluate trained policy
@printf "${BLUE}Running evaluation...${NC}\n"
@python -m src.eval
@printf "${GREEN}✓ Evaluation complete! Check outputs/videos/${NC}\n"
# =============================================================================
# CODE QUALITY
# =============================================================================
format: ## Format code with black and ruff
@printf "${BLUE}Formatting code...${NC}\n"
@black src/ tests/
@ruff check src/ tests/ --fix
@printf "${GREEN}✓ Code formatted${NC}\n"
lint: ## Lint code with ruff
@printf "${BLUE}Linting code...${NC}\n"
@ruff check src/ tests/
@black --check src/ tests/
test: ## Run tests
@printf "${BLUE}Running tests...${NC}\n"
@pytest tests/ -v --cov=src --cov-report=html --cov-report=term
@printf "${GREEN}✓ Tests completed${NC}\n"
pre-commit: ## Run all pre-commit hooks
@printf "${BLUE}Running pre-commit hooks...${NC}\n"
@pre-commit run --all-files
@printf "${GREEN}✓ Pre-commit checks passed${NC}\n"
check: format test ## Format code and run tests (pre-commit prep)
@printf "${GREEN}✓ All checks passed - ready to commit${NC}\n"
# =============================================================================
# UTILITIES
# =============================================================================
clean: ## Clean temporary files and caches
@printf "${BLUE}Cleaning project...${NC}\n"
@find . -type f -name "*.pyc" -delete
@find . -type d -name "__pycache__" -delete
@find . -type d -name "*.egg-info" -exec rm -rf {} + || true
@rm -rf .pytest_cache/ htmlcov/ .ruff_cache/
@printf "${GREEN}✓ Project cleaned${NC}\n"
gpu-info: ## Display GPU information
@python -c "import src.utils.gpu_utils; src.utils.gpu_utils.display_gpu_info()"
monitor: ## Open WandB dashboard
@printf "${BLUE}Opening WandB dashboard...${NC}\n"
@python -c "import webbrowser; webbrowser.open('https://wandb.ai')"
# =============================================================================
# DEVELOPMENT
# =============================================================================
dev-setup: ## Complete development environment setup
@$(MAKE) setup-mise
@$(MAKE) setup-env
@$(MAKE) install
@printf "${GREEN}✓ Development environment ready!${NC}\n"
@printf "${YELLOW}Next steps:${NC}\n"
@printf " 1. ${GREEN}make collect-data${NC} - Collect demonstrations\n"
@printf " 2. ${GREEN}make train${NC} - Train ACT policy\n"
@printf " 3. ${GREEN}make eval${NC} - Evaluate and generate videos\n"
quick-test: ## Quick verification that everything works
@printf "${BLUE}Running quick verification...${NC}\n"
@python -c "import torch; import mujoco; print('✓ Core imports successful')"
@python -c "from src.policies.act import ACTPolicy; print('✓ ACT policy loads')"
@printf "${GREEN}✓ Quick test passed!${NC}\n"
test-dataset: ## Test dataset slicing capability
@printf "${BLUE}Testing dataset slicing...${NC}\n"
@python -m src.test_dataset
@printf "${GREEN}✓ Test complete${NC}\n"