forked from h2oai/h2o-llmstudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (92 loc) · 2.71 KB
/
Makefile
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
105
106
107
108
109
110
111
112
PYTHON_VERSION ?= 3.10
PYTHON ?= python$(PYTHON_VERSION)
PIP ?= $(PYTHON) -m pip
PIPENV ?= $(PYTHON) -m pipenv
PIPENV_PYTHON = $(PIPENV) run python
PIPENV_PIP = $(PIPENV_PYTHON) -m pip
PWD = $(shell pwd)
PHONY: pipenv
pipenv:
$(PIP) install pip --upgrade
$(PIP) install pipenv==2022.10.4
.PHONY: setup
setup: pipenv
$(PIPENV) install --verbose --python $(PYTHON_VERSION)
$(PIPENV_PIP) install https://github.com/h2oai/wave/releases/download/nightly/h2o_wave-nightly-py3-none-manylinux1_x86_64.whl --force-reinstall
.PHONY: setup-dev
setup-dev: pipenv
$(PIPENV) install --verbose --dev --python $(PYTHON_VERSION)
$(PIPENV_PIP) install https://github.com/h2oai/wave/releases/download/nightly/h2o_wave-nightly-py3-none-manylinux1_x86_64.whl --force-reinstall
.PHONY: export-requirements
export-requirements: pipenv
$(PIPENV) requirements > requirements.txt
echo "https://github.com/h2oai/wave/releases/download/nightly/h2o_wave-nightly-py3-none-manylinux1_x86_64.whl" >> requirements.txt
clean-env:
$(PIPENV) --rm
clean-data:
rm -rf data
clean-output:
rm -rf output
reports:
mkdir -p reports
.PHONY: style
style: reports pipenv
@echo -n > reports/flake8_errors.log
@echo -n > reports/mypy_errors.log
@echo -n > reports/mypy.log
@echo
-$(PIPENV) run flake8 | tee -a reports/flake8_errors.log
@if [ -s reports/flake8_errors.log ]; then exit 1; fi
-$(PIPENV) run mypy . --check-untyped-defs | tee -a reports/mypy.log || echo "mypy failed" >> reports/mypy_errors.log
@if [ -s reports/mypy_errors.log ]; then exit 1; fi
.PHONY: format
format: pipenv
$(PIPENV) run isort .
$(PIPENV) run black .
.PHONY: isort
isort: pipenv
$(PIPENV) run isort .
.PHONY: black
black: pipenv
$(PIPENV) run black .
.PHONY: test
test: reports
export PYTHONPATH=$(PWD) && $(PIPENV) run pytest -v -s -x \
--junitxml=./reports/junit.xml \
tests/* | tee reports/pytest.log
.PHONY: wave
wave:
H2O_WAVE_MAX_REQUEST_SIZE=25MB \
H2O_WAVE_NO_LOG=True \
H2O_WAVE_PRIVATE_DIR="/download/@$(PWD)/output/download" \
$(PIPENV) run wave run app
.PHONY: wave-no-reload
wave-no-reload:
H2O_WAVE_MAX_REQUEST_SIZE=25MB \
H2O_WAVE_NO_LOG=True \
H2O_WAVE_PRIVATE_DIR="/download/@$(PWD)/output/download" \
$(PIPENV) run wave run --no-reload app
.PHONY: docker-build-nightly
docker-build-nightly:
docker build -t gcr.io/vorvan/h2oai/h2o-llmstudio:nightly .
.PHONY: docker-run-nightly
docker-run-nightly:
ifeq (,$(wildcard ./data))
mkdir data
endif
ifeq (,$(wildcard ./output))
mkdir output
endif
docker run \
--runtime=nvidia \
--shm-size=64g \
--init \
--rm \
-u `id -u`:`id -g` \
-p 10101:10101 \
-v `pwd`/data:/workspace/data \
-v `pwd`/output:/workspace/output \
gcr.io/vorvan/h2oai/h2o-llmstudio:nightly
.PHONY: shell
shell:
$(PIPENV) shell