-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
164 lines (145 loc) · 3.44 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
152
153
154
155
156
157
158
159
160
161
162
163
164
.PHONY: dist cli install
dist:
python setup.py sdist bdist_wheel && twine upload --skip-existing dist/*
rm -rf build dist *.egg-info
install:
pip install -e .
mkdir -p ~/.libem && touch ~/.libem/config.yaml
uninstall:
pip uninstall libem -y && rm -r libem.egg-info || true
# match examples
.PHONY: run match browse chat all
run: match
match:
python examples/match.py
browse:
python examples/tool/browse.py
chat:
python examples/tool/chat.py
all: match browse chat
# tool output examples
.PHONY: confidence likelihood
confidence:
python examples/tool/confidence.py
likelihood:
python examples/tool/likelihood.py
# tool examples
.PHONY: block extract
block:
python examples/tool/block.py
extract:
python examples/tool/extract.py
# utility examples
.PHONY: calibrate trace
calibrate:
python examples/tool/calibrate.py
trace:
python examples/tool/trace.py
# tuning examples
.PHONY: rules shots tune
rules:
python examples/tune/rules.py
shots:
python examples/tune/shots.py
tune: rule
# optimize examples
.PHONY: profile prompt_batch async_request async_batch batch
profile:
python examples/optimize/profile.py
prompt_batch:
python examples/optimize/prompt_batch.py
async_request:
python examples/optimize/async_request.py
async_batch:
python examples/optimize/async_batch.py
batch: async_batch
# claude model example
.PHONY: claude
claude:
python examples/model/claude.py
# opensource model examples
.PHONY: mlx_lm llama_cpp llama_ex local
mlx_lm:
pip install mlx_lm
llama_cpp:
pip install llama-cpp-python
llama_ex:
python examples/model/llama.py
local: llama_ex
# benchmarks
.PHONY: benchmark analyze plot archive
benchmark:
python -m benchmark.run
analyze:
python -m benchmark.analyze -m
plot:
python -m benchmark.plot
RESULT_DIRS = benchmark/_output/results \
benchmark/_output/figures \
benchmark/_output/tables \
benchmark/_output/analysis
archive:
@zip -r "$$(date +%Y-%m-%d_%H-%M-%S)_benchmarks.zip" $(RESULT_DIRS) \
&& rm -rf $(RESULT_DIRS) || true
.PHONY: block-suite batch-suite
block-suite:
python -m benchmark.run -s block
batch-suite:
python -m benchmark.run -s batch
.PHONY: gpt-4o gpt-4o-mini gpt-4 gpt-4-turbo gpt-3.5-turbo
gpt-4o:
python -m benchmark.run -s gpt-4o
gpt-4o-mini:
python -m benchmark.run -s gpt-4o-mini
gpt-4:
python -m benchmark.run -s gpt-4
gpt-4-turbo:
python -m benchmark.run -s gpt-4-turbo
gpt-3.5-turbo:
python -m benchmark.run -s gpt-3.5-turbo
.PHONY: llama3
llama3:
python -m benchmark.run -s llama3
# tests clean
.PHONY: test clean time_pkg_load time_mod_load
test:
pytest -v test/*
clean:
rm -r _logs > /dev/null 2>&1 || true
time_pkg_load:
python script/time_pkg_load.py
time_mod_load:
python script/time_mod_load.py
# refresh price
.PHONY: price
price:
python -c "from libem import optimize; optimize.refresh_price_cache()"
# download sample data
.PHONY: data
data:
git clone https://github.com/abcsys/libem-sample-data.git ../libem-sample-data
# libem serve
.PHONY: serve build
serve:
python serve/serve/run.py
build:
ifndef tag
docker build -f serve/serve/Dockerfile .
else
docker build -t $(tag) -f serve/serve/Dockerfile .
docker push $(tag)
endif
# libem apps
.PHONY: cluster dedupe link
cluster:
python examples/apps/cluster.py
dedupe:
python examples/apps/dedupe.py
link:
python examples/apps/link.py
# libem integrations
.PHONY: duckdb mongodb
duckdb:
python examples/apps/integration/duckdb_cluster.py
mongodb:
python examples/apps/integration/mongodb_cluster.py