-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (44 loc) · 1.66 KB
/
Makefile
File metadata and controls
57 lines (44 loc) · 1.66 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
.PHONY: help install install-dev test lint format clean train eval
help:
@echo "TRNTR Development Commands"
@echo "=========================="
@echo "install Install package and dependencies"
@echo "install-dev Install with development dependencies"
@echo "test Run unit tests"
@echo "lint Run code linters (flake8, isort, black check)"
@echo "format Format code with black and isort"
@echo "clean Remove build artifacts and cache"
@echo "train Run training with default config"
@echo "eval Run evaluation on all benchmarks"
install:
pip install -e .
install-dev:
pip install -e ".[all]"
pre-commit install
test:
pytest tests/ -v --cov=src/trntr --cov-report=html --cov-report=term
lint:
flake8 src/ tests/ scripts/
isort --check-only src/ tests/ scripts/
black --check src/ tests/ scripts/
format:
isort src/ tests/ scripts/
black src/ tests/ scripts/
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf build/ dist/ .pytest_cache/ .coverage htmlcov/
rm -rf outputs/ multirun/ .hydra/
train:
python train.py
eval:
python scripts/evaluate.py --checkpoint checkpoints/best_model.pt --benchmark all
# Development shortcuts
quick-test:
pytest tests/ -v -k "not slow"
watch-train:
watch -n 5 'tail -n 30 logs/train.log'
count-params:
python -c "from src.trntr.models import build_model; from omegaconf import OmegaConf; cfg = OmegaConf.load('configs/model/trntr_7m.yaml'); m = build_model(cfg); print(f'Parameters: {sum(p.numel() for p in m.parameters()):,}')"