-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (57 loc) · 1.83 KB
/
Copy pathMakefile
File metadata and controls
69 lines (57 loc) · 1.83 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
PYTHON = python3
PIP = pip install
SRC_DIR = src
DATA_DIR = data
TEST_DIR = tests
MODELS_DIR = models
.PHONY: setup preprocess train tune clean
setup:
$(PIP) -r requirements.txt
$(PYTHON) -m nltk.downloader stopwords
preprocess:
$(PYTHON) -m $(SRC_DIR).preprocess \
--data_dir $(DATA_DIR) \
--min_density 35 \
--max_length 128
train:
$(PYTHON) -m $(SRC_DIR).train \
--hparams configs/best_hparams.yml \
--train_data $(DATA_DIR)/processed_train.parquet \
--test_data $(DATA_DIR)/processed_test.parquet \
--save_path models/final_model.pth
tune:
$(PYTHON) -m $(SRC_DIR).optimize \
--config configs/hparams_search.yml \
--train_data $(DATA_DIR)/processed_train.parquet \
--val_data $(DATA_DIR)/processed_val.parquet \
--save_path $(MODELS_DIR)/best_model_state.pth \
--train_subset 100000 \
--val_subset 10000
export_onnx:
$(PYTHON) -m $(SRC_DIR).export_onnx \
--hparams configs/best_hparams.yml \
--model_path models/final_model.pth \
--output_path models/arabic_diacritizer.onnx
evaluate_onnx:
$(PYTHON) -m src.evaluate \
--model models/arabic_diacritizer.onnx \
--test_data data/processed_test.parquet \
--max_samples 10000
test:
$(PYTHON) -m pytest $(TEST_DIR) -v
test-fast:
$(PYTHON) -m pytest $(TEST_DIR) -x -v
test-cov:
$(PYTHON) -m pytest $(TEST_DIR) --cov=$(SRC_DIR) --cov-report=term-missing
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
help:
@echo "Available commands:"
@echo " make setup : Install dependencies"
@echo " make preprocess : Merge MSA with CA and Clean data"
@echo " make train : train on a single run"
@echo " make tune : Run Optuna optimization"
@echo " make test : Run all tests"
@echo " make test-fast : Stop on first failure"
@echo " make test-cov : Run tests with coverage"
@echo " make clean : Clean the repo"