forked from iusztinpaul/hands-on-llms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (62 loc) · 3.52 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
.PHONY: help install install_dev add add_dev export_requirements dev_train_local train_local dev_train_beam train_beam dev_infer_local infer_local dev_infer_beam infer_beam lint_check lint_fix format_check format_fix
### Install ###
install:
@echo "Installing training pipeline..."
poetry env use $(shell which python3.10) && \
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install && \
poetry run pip install torch==2.0.1
install_dev: install
poetry install --with dev
install_only_dev:
poetry install --only dev
add:
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring; poetry add $(package)
add_dev:
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring; poetry add --group dev $(package)
### Beam ###
export_requirements:
@echo "Exporting requirements..."
if [ -f requirements.txt ]; then rm requirements.txt; fi
poetry export -f requirements.txt --output requirements.txt --without-hashes
upload_dataset_to_beam:
beam volume upload finqa_dataset dataset
### Training ###
dev_train_local:
@echo "Running training pipeline locally using the development config..."
poetry run python -m tools.train_run --config_file configs/dev_training_config.yaml --output_dir ./output --dataset_dir ./dataset
train_local:
@echo "Running training pipeline locally using the production config..."
poetry run python -m tools.train_run --config_file configs/training_config.yaml --output_dir ./output --dataset_dir ./dataset
dev_train_beam:
@echo "Running training pipeline on Beam using the development config..."
export BEAM_IGNORE_IMPORTS_OFF=true; beam run ./tools/train_finqa.py:train -d '{"config_file": "configs/dev_training_config.yaml", "output_dir": "./output", "dataset_dir": "./dataset/dataset", "env_file_path": "env", "model_cache_dir": "./model_cache"}'
train_beam:
@echo "Running training pipeline on Beam using the production config..."
export BEAM_IGNORE_IMPORTS_OFF=true; beam run ./tools/train_finqa.py:train -d '{"config_file": "configs/training_config.yaml", "output_dir": "./output", "dataset_dir": "./dataset/dataset", "env_file_path": "env", "model_cache_dir": "./model_cache"}'
### Inference ###
dev_infer_local:
@echo "Running inference pipeline locally using the production config..."
poetry run python -m tools.inference_run --config_file configs/dev_inference_config.yaml --dataset_dir ./dataset
infer_local:
@echo "Running inference pipeline locally using the production config..."
poetry run python -m tools.inference_run --config_file configs/inference_config.yaml --dataset_dir ./dataset
dev_infer_beam:
@echo "Running inference pipeline on Beam using the development config..."
export BEAM_IGNORE_IMPORTS_OFF=true; beam run ./tools/inference_finqa.py:infer -d '{"config_file": "configs/dev_inference_config.yaml", "dataset_dir": "./dataset/dataset", "env_file_path": "env", "model_cache_dir": "./model_cache"}'
infer_beam:
@echo "Running inference pipeline on Beam using the production config..."
export BEAM_IGNORE_IMPORTS_OFF=true; beam run ./tools/inference_finqa.py:infer -d '{"config_file": "configs/inference_config.yaml", "dataset_dir": "./dataset/dataset", "env_file_path": "env", "model_cache_dir": "./model_cache"}'
### PEP 8 ###
# Be sure to install the dev dependencies first #
lint_check:
@echo "Checking for linting issues..."
poetry run ruff check .
lint_fix:
@echo "Fixing linting issues..."
poetry run ruff check --fix .
format_check:
@echo "Checking for formatting issues..."
poetry run black --check .
format_fix:
@echo "Formatting code..."
poetry run black .