forked from PaddlePaddle/PaddleFormers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (72 loc) · 2.53 KB
/
Makefile
File metadata and controls
87 lines (72 loc) · 2.53 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
# Makefile for PaddleFormers
#
# GitHb: https://github.com/PaddlePaddle/PaddleFormers
# Author: Paddle Team https://github.com/PaddlePaddle
#
.PHONY: all
all : lint test
check_dirs := paddleformers scripts tests
# # # # # # # # # # # # # # # Format Block # # # # # # # # # # # # # # #
format:
pre-commit run isort
pre-commit run black
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # Lint Block # # # # # # # # # # # # # # #
.PHONY: lint
lint:
$(eval modified_py_files := $(shell python scripts/codestyle/get_modified_files.py $(check_dirs)))
@if test -n "$(modified_py_files)"; then \
echo ${modified_py_files}; \
pre-commit run --files ${modified_py_files}; \
else \
echo "No library .py files were modified"; \
fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # Test Block # # # # # # # # # # # # # # #
.PHONY: test
test: unit-test
unit-test:
DOWNLOAD_SOURCE=aistudio \
PYTHONPATH=$(shell pwd) pytest -v \
--retries 1 --retry-delay 1 \
--durations 20 \
--cov=./paddleformers \
--cov-report=xml:coverage.xml
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.PHONY: install
install:
@echo "Checking CUDA version and selecting pip source..."
@if ! command -v nvcc >/dev/null 2>&1; then \
echo "ERROR: nvcc (CUDA) not found. Please install CUDA before proceeding."; \
exit 1; \
fi; \
cuda_version=$$(nvcc --version | grep release | awk '{print $$5}' | sed 's/,//'); \
echo "Detected CUDA version: $$cuda_version"; \
if [ "$$cuda_version" = "12.6" ]; then \
PADDLE_SOURCE="https://www.paddlepaddle.org.cn/packages/nightly/cu126/"; \
elif [ "$$cuda_version" = "12.9" ]; then \
PADDLE_SOURCE="https://www.paddlepaddle.org.cn/packages/nightly/cu129/"; \
elif [ "$$cuda_version" = "13.0" ]; then \
PADDLE_SOURCE="https://www.paddlepaddle.org.cn/packages/nightly/cu130/"; \
else \
PADDLE_SOURCE=""; \
echo "Unknown CUDA version."; \
fi; \
echo "Using pip source: $$PADDLE_SOURCE"; \
pip install -r tests/requirements.txt \
pip install -r requirements.txt --extra-index-url "$$PADDLE_SOURCE"; \
pre-commit install
.PHONY: deploy-ppdiffusers
deploy-ppdiffusers:
cd ppdiffusers && make install && make
.PHONY: deploy-paddle-pipelines
deploy-paddle-pipelines:
cd pipelines && make install && make
.PHONY: deploy-paddleformers
deploy-paddleformers:
# install related package
make install
# build
python3 setup.py sdist bdist_wheel
# upload
twine upload --skip-existing dist/*