forked from vllm-project/llm-compressor
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (50 loc) · 1.7 KB
/
Makefile
File metadata and controls
58 lines (50 loc) · 1.7 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
BUILDDIR := $(PWD)
CHECKDIRS := src tests examples setup.py
DOCDIR := docs
BUILD_ARGS := # set nightly to build nightly release
# refer to setup.py for allowed values for BUILD_TYPE
BUILD_TYPE?=dev
export BUILD_TYPE
TARGETS := ""
PYTEST_ARGS ?= ""
ifneq ($(findstring transformers,$(TARGETS)),transformers)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/llmcompressor/transformers
endif
ifneq ($(findstring pytorch,$(TARGETS)),pytorch)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/llmcompressor/pytorch
endif
ifneq ($(findstring examples,$(TARGETS)),examples)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/examples
endif
ifneq ($(findstring sparsity,$(TARGETS)),sparsity)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/sparsity
endif
# run checks on all files for the repo
# leaving out mypy src for now
quality:
@echo "Running python quality checks";
ruff check $(CHECKDIRS);
ruff format --check $(CHECKDIRS);
# style the code according to accepted standards for the repo
# Note: We run `ruff format` twice. Once to fix long lines before lint check
# and again to fix any formatting issues introduced by ruff check --fix
style:
@echo "Running python styling";
ruff format $(CHECKDIRS);
ruff check --fix $(CHECKDIRS);
ruff format --silent $(CHECKDIRS);
# run tests for the repo
test:
@echo "Running python tests";
pytest -ra tests $(PYTEST_ARGS) --ignore tests/lmeval
# run tests under emulated XPU (requires CUDA hardware)
pytest -ra -c pytest-xpu.ini --emulate-xpu;
# creates wheel file
.PHONY: build
build:
python3 setup.py sdist bdist_wheel $(BUILD_ARGS)
# clean package
clean:
rm -fr .pytest_cache;
rm -fr docs/_build docs/build;
find $(CHECKDIRS) | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -fr;