-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
151 lines (114 loc) · 3.91 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
SHELL := /bin/bash
REMOTE_HOST = vast
create-env:
conda create -n vocab python=3.10 -y ; \
conda activate vocab ; \
pip install -r requirements.txt
update-env:
pip freeze > requirements.txt
package:
@echo "[ Clean up... ]"
rm -rf dist build vocab_coverage.egg-info
@echo "[ Build package... ]"
python setup.py sdist bdist_wheel
twine check dist/*
@echo "[ Upload package... ]"
twine upload dist/* --verbose
package-clean:
python setup.py clean --all
rm -rf dist build vocab_coverage.egg-info
ENV_TEST_NAME = vocab_package_test
test-env:
if conda env list | grep -q "^$(ENV_TEST_NAME) "; then \
conda env remove -n $(ENV_TEST_NAME) -y; \
fi
conda create -n $(ENV_TEST_NAME) python=3.10 -y
@echo "conda activate $(ENV_TEST_NAME)"
test-package:
pip install -e .; \
vocab-coverage --help
charsets:
python vocab_coverage/main.py charset --charset_file vocab_coverage/charset.json
generate-coverage: generate-coverage-char generate-coverage-token
generate-coverage-char:
python vocab_coverage/generate.py coverage --debug --granularity=char
generate-coverage-token:
python vocab_coverage/generate.py coverage --debug --granularity=token
generate-embedding:
python vocab_coverage/generate.py embedding --debug --granularity=token,char,word,sentence,paragraph --position=input,output
generate-embedding-token:
python vocab_coverage/generate.py embedding --debug --granularity=token --position=input,output
generate-embedding-char:
python vocab_coverage/generate.py embedding --debug --granularity=char --position=input,output
generate-embedding-word:
python vocab_coverage/generate.py embedding --debug --granularity=word --position=input,output
generate-new:
python vocab_coverage/generate.py coverage --debug --granularity=token,char --group=new
python vocab_coverage/generate.py embedding --debug --no_cache --granularity=token,char,word,sentence,paragraph --position=input,output --group=new
generate-thumbnail:
python vocab_coverage/generate.py thumbnail
generate-markdown: generate-thumbnail
python vocab_coverage/generate.py markdown
generate: generate-coverage generate-embedding generate-thumbnail generate-markdown
sync-from-vast:
rsync -avP 'vast:./vocab/images/fullsize/*' images/fullsize/
sync-graph: sync-from-vast generate-markdown sync-to-oss
clean-cache:
rm -rf ~/.cache/huggingface/hub/*
sync-to-oss: sync-to-oss-thumbnail sync-to-oss-fullsize
sync-to-oss-fullsize:
aliyun oss sync \
--region=ap-southeast-2 \
--update \
--include='*.jpg' \
--jobs=10 \
--output-dir=logs/ \
images/fullsize oss://lab99-syd-pub/vocab-coverage/fullsize/
sync-to-oss-thumbnail:
aliyun oss sync \
--region=ap-southeast-2 \
--update \
--include='*.jpg' \
--jobs=10 \
--output-dir=logs/ \
images/thumbnail oss://lab99-syd-pub/vocab-coverage/thumbnail/
# --meta='Cache-Control:no-cache'
# sync-to-oss:
# aliyun oss cp \
# --region=ap-southeast-2 \
# --recursive \
# --include='*.jpg' \
# --jobs=10 \
# images/assets oss://lab99-syd-pub/vocab-coverage/
# sync-to-oss-thumbnails:
# aliyun oss cp \
# --region=ap-southeast-2 \
# --recursive \
# --include='*.jpg' \
# --jobs=10 \
# images/thumbnails oss://lab99-syd-pub/vocab-coverage/thumbnails/
sync-from-oss:
aliyun oss sync \
--region=ap-southeast-2 \
--update \
--include='*.jpg' \
--jobs=10 \
--output-dir=logs/ \
oss://lab99-syd-pub/vocab-coverage/ images/
# remote
remote-sync:
rsync -avzP --exclude-from=.gitignore --exclude='*.png' --exclude='.git' --exclude='images' . $(REMOTE_HOST):./vocab
sync-to-remote-cache:
rsync -avzP vocab_coverage/.cache/ $(REMOTE_HOST):./vocab/.cache/
sync-from-remote-cache:
rsync -avzP $(REMOTE_HOST):./vocab/.cache/ vocab_coverage/.cache/
remote-download-images:
rsync -avzP $(REMOTE_HOST):./vocab/images/ ./images/
remote-provision: remote-sync
ssh $(REMOTE_HOST) 'cd vocab && bash provision.sh install'
gpu:
watch -n 1 nvidia-smi
cpu:
gotop
jupyter:
jupyter lab --port=7860 --allow-root