-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (83 loc) · 2.44 KB
/
Makefile
File metadata and controls
104 lines (83 loc) · 2.44 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
.PHONY: default
default:
@echo "an explicit target is required"
SHELL=/usr/bin/env bash
PYTHON_FILES=$(shell git ls-files '*.py' | sort | tr '\n' ' ')
export PYTHONPATH := $(shell realpath .)
.PHONY: lock
lock:
# Complex logic needed to pin `setuptools` but not `pip` in Python 3.11 and earlier
PYTHON_VERSION_AT_LEAST_3_12=$(shell python -c 'import sys; print(int(sys.version_info >= (3, 12)))')
ifeq ($(PYTHON_VERSION_AT_LEAST_3_12),1)
pip freeze >requirements-lock.txt
else
pip freeze --all --exclude pip >requirements-lock.txt
endif
# Remove editable packages because they are expected to be available locally
sed --in-place -e '/^-e .*/d' requirements-lock.txt
# Strip local versions so PyTorch is the same on Linux and macOS
sed --in-place -e 's/+[[:alnum:]]\+$$//g' requirements-lock.txt
# Remove nvidia-* and triton because they cannot be installed on macOS
# The packages have no sdists, and their wheels are not available for macOS
# They install automatically on Linux as a requirement of PyTorch
sed --in-place -e '/^\(nvidia-.*\|triton\)==.*/d' requirements-lock.txt
.PHONY: actionlint
actionlint:
pre-commit run --all-files actionlint
.PHONY: black
black:
pre-commit run --all-files black
.PHONY: codespell
codespell:
pre-commit run --all-files codespell
.PHONY: markdownlint
markdownlint:
pre-commit run --all-files markdownlint
.PHONY: mypy
mypy:
ifneq ($(PYTHON_FILES),)
mypy $(PYTHON_FILES)
endif
.PHONY: prettier
prettier:
pre-commit run --all-files prettier
.PHONY: pylint
pylint:
ifneq ($(PYTHON_FILES),)
pylint $(PYTHON_FILES)
endif
.PHONY: ruff
ruff:
pre-commit run --all-files ruff
.PHONY: shellcheck
shellcheck:
pre-commit run --all-files shellcheck
.PHONY: shfmt
shfmt:
pre-commit run --all-files shfmt
.PHONY: yamllint
yamllint:
pre-commit run --all-files yamllint
.PHONY: precommit
precommit:
pre-commit run --all-files
.PHONY: check
check: precommit mypy pylint
.PHONY: fix
fix: lock check
.PHONY: update
update:
pip install --upgrade pip
pip install --upgrade -r requirements-lock.txt --extra-index-url https://download.pytorch.org/whl/cu121
.PHONY: upgrade
upgrade:
pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -r requirements.txt -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cu121
.PHONY: install
install:
# Set up Python environment
make update
# Initialize data directories
python -m src.paths
# Download configured models
bash scripts/download_models.sh