-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (75 loc) · 3.85 KB
/
Copy pathMakefile
File metadata and controls
96 lines (75 loc) · 3.85 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
# Packages managed outside the lockfile (CUDA torch installed by scripts/install_cuda_torch.sh).
# --inexact prevents uv sync from removing them; --no-install-package prevents overwriting them.
KEEP_TORCH := --inexact --no-install-package torch --no-install-package torchvision
# LoRA adapters hosted on Hugging Face
ADAPTER_2B_REPO := yurirocha15/Cosmos-Reason2-2B-palletizer-lora
ADAPTER_8B_REPO := yurirocha15/Cosmos-Reason2-8B-palletizer-lora
ADAPTER_2B_DIR := adapters/2B
ADAPTER_8B_DIR := adapters/8B
# ── Primary targets ───────────────────────────────────────────────────────────
.PHONY: init
init: ## First-time setup: sync all packages + install CUDA torch + download adapters
uv sync --all-packages --all-extras $(KEEP_TORCH)
@bash scripts/install_cuda_torch.sh
$(MAKE) adapters
.PHONY: adapters
adapters: ## Download LoRA adapters from Hugging Face (skips if present)
@if [ ! -f "$(ADAPTER_2B_DIR)/adapter_model.safetensors" ]; then \
echo "Downloading 2B adapter from $(ADAPTER_2B_REPO)..."; \
uv run --with "huggingface-hub[cli]" hf download $(ADAPTER_2B_REPO) --local-dir $(ADAPTER_2B_DIR); \
else \
echo "2B adapter already present, skipping."; \
fi
@if [ ! -f "$(ADAPTER_8B_DIR)/adapter_model.safetensors" ]; then \
echo "Downloading 8B adapter from $(ADAPTER_8B_REPO)..."; \
uv run --with "huggingface-hub[cli]" hf download $(ADAPTER_8B_REPO) --local-dir $(ADAPTER_8B_DIR); \
else \
echo "8B adapter already present, skipping."; \
fi
.PHONY: sync
sync: ## Re-sync dependencies without overwriting CUDA torch
uv sync --all-packages --all-extras $(KEEP_TORCH)
.PHONY: install-curobo
install-curobo: ## Install cuRobo from source (run after make init)
@bash scripts/install_curobo.sh
# ── Run wrappers (skip auto-sync to preserve CUDA torch) ─────────────────────
.PHONY: run
run: ## Run a uv command: make run CMD="drp-train --help"
UV_NO_SYNC=1 uv run $(CMD)
# ── Quality ───────────────────────────────────────────────────────────────────
.PHONY: lint
lint: ## Lint and format
uv run ruff check --fix
uv run ruff format
.PHONY: test
test: ## Run tests
UV_NO_SYNC=1 PYTHONPATH="" uv run pytest
.PHONY: check
check: lint test ## Lint + test
# ── Docker ────────────────────────────────────────────────────────────────────
.PHONY: docker-up
docker-up: ## Launch full Docker pipeline
cd docker && bash launch.sh --build
.PHONY: docker-down
docker-down: ## Stop Docker pipeline
cd docker && bash launch.sh --down
.PHONY: docker-test
docker-test: ## Launch test mode (real Isaac Sim + tiny model, no HF token needed)
cd docker && bash launch.sh --test
.PHONY: docker-logs
docker-logs: ## Follow Docker container logs
cd docker && docker compose logs -f
# ── Helpers ───────────────────────────────────────────────────────────────────
.PHONY: cuda-info
cuda-info: ## Show detected CUDA backend and installed torch variant
@echo "--- Detected backend ---"
@cat .torch-backend 2>/dev/null || echo "(not configured -- run 'make init')"
@echo ""
@echo "--- Installed torch ---"
@uv pip show torch 2>/dev/null | grep -E "^(Name|Version|Location)" || echo "torch not installed"
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'