generated from maragudk/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (54 loc) · 1.99 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
.DEFAULT_GOAL := start
#model := Llama-3.2-1B-Instruct-Q4_K_M
model := Llama-3.2-1B-Instruct-Q5_K_M
#model := Llama-3.2-1B-Instruct-Q8_0
#model := Llama-3.2-3B-Instruct-Q4_K_M
#model := Llama-3.2-3B-Instruct-Q5_K_M
#model := Llama-3.2-3B-Instruct-Q8_0
#model := Meta-Llama-3.1-8B-Instruct-Q5_K_M
#model := Meta-Llama-3.1-70B-Instruct-Q5_K_M
#model := qwen2.5-0.5b-instruct-q5_k_m
#model := qwen2.5-7b-instruct-q5_k_m
#model := qwen2.5-14b-instruct-q5_k_m
#model := qwen2.5-32b-instruct-q5_k_m
#model := qwen2.5-72b-instruct-q5_k_m
#model := SmolLM2-135M-Instruct-Q8_0
#license := LICENSE-Llama-3.1
license := LICENSE-Llama-3.2
#license := LICENSE-qwen
#license := LICENSE-Smol-2
llamafile_version := 0.8.16
build/$(model).llamafile: llamafile/bin/llamafile models/$(model).gguf
mkdir -p build
cp llamafile/bin/llamafile build/$(model).llamafile
echo "-m\n$(model).gguf\n-c\n0\n..." >build/.args
./llamafile/bin/zipalign -j0 build/$(model).llamafile models/$(model).gguf build/.args $(license)
chmod a+x build/$(model).llamafile
.PHONY: build-docker
build-docker: build
docker build --platform linux/amd64,linux/arm64 --build-arg LICENSE=$(license) -t maragudk/`echo $(model) | tr A-Z a-z`:latest .
.PHONY: clean
clean:
rm -rf build
rm -f llama.log
.PHONY: clean-all
clean-all: clean
rm -rf llamafile
models/$(model).gguf:
mkdir -p models
cd models && curl -L -O -C - https://assets.maragu.dev/llm/$(model).gguf
llamafile/bin/llamafile:
curl -L -O -C - https://github.com/Mozilla-Ocho/llamafile/releases/latest/download/llamafile-$(llamafile_version).zip
unzip llamafile-$(llamafile_version).zip
rm -f llamafile-$(llamafile_version).zip
mv llamafile-$(llamafile_version) llamafile
.PHONY: start
start: build/$(model).llamafile
./build/$(model).llamafile
.PHONY: upload
upload:
AWS_PROFILE=r2 aws s3 cp models/$(model).gguf s3://maragudev/llm/
AWS_PROFILE=r2 aws s3 cp build/$(model).llamafile s3://maragudev/llm/
.PHONY: upload-docker
upload-docker:
docker push maragudk/`echo $(model) | tr A-Z a-z`:latest