-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
156 lines (111 loc) · 8.74 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
ARCH ?= amd64
KEY ?= ""
VERSION ?= $(shell git describe --abbrev=0 --tags)
LOCAL_VERSION ?= $(shell git rev-parse --short HEAD)
SDK_DEST ?= src/leapfrogai_sdk/build
######################################################################################
.PHONY: help
help: ## Display this help information
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean: ## Clean up all the things (packages, build dirs, compiled .whl files, python eggs)
-rm zarf-package-*.tar.zst
-rm packages/**/zarf-package-*.tar.zst
-rm -rf build/*
-rm -rf src/**/build/*
-rm -rf packages/**/build/*
find . -name '*.whl' -delete
find . -name '*.egg-info' -type d -exec rm -rf {} +
gen-python: ## Generate the protobufs for the OpenAI typing within the leapfrogai_api module
python3 -m grpc_tools.protoc -I src/leapfrogai_sdk/proto \
--pyi_out=src/. \
--python_out=src/. \
--grpc_python_out=src/. \
src/leapfrogai_sdk/proto/leapfrogai_sdk/**/*.proto
local-registry: ## Start up a local container registry. Errors in this target are ignored.
-docker run -d -p 5000:5000 --restart=always --name registry registry:2
sdk-wheel: ## build wheels for the leapfrogai_sdk package as a dependency for other lfai components
-rm ${SDK_DEST}/*.whl
python -m pip wheel src/leapfrogai_sdk -w ${SDK_DEST}
build-supabase:
## Build the Zarf package
uds zarf package create packages/supabase -o packages/supabase --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-api-deps: sdk-wheel ## Download the wheels for the leapfrogai_api dependencies
-rm packages/api/build/*.whl
python -m pip wheel src/leapfrogai_api -w packages/api/build --find-links=${SDK_DEST}
build-api: local-registry setup-api-deps ## Build the leapfrogai_api container and Zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${LOCAL_VERSION} packages/api
docker tag ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/leapfrogai-api:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/leapfrogai-api:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/api -o packages/api --registry-override=ghcr.io=localhost:5000 --insecure --set LEAPFROGAI_IMAGE_VERSION=${LOCAL_VERSION} --confirm
build-ui: local-registry ## Build the leapfrogai_ui container and Zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${LOCAL_VERSION} src/leapfrogai_ui
docker tag ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/leapfrogai-ui:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/leapfrogai-ui:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/ui -o packages/ui --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-llama-cpp-python-deps: sdk-wheel ## Download the wheels for the optional 'llama-cpp-python' dependencies
-rm packages/llama-cpp-python/build/*.whl
## The external link is needed to pull a pre-compiled cpu wheel for llama-cpp-python
python -m pip wheel packages/llama-cpp-python -w packages/llama-cpp-python/build --find-links=${SDK_DEST}
build-llama-cpp-python: local-registry setup-llama-cpp-python-deps ## Build the llama-cpp-python (cpu) container and Zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${LOCAL_VERSION} packages/llama-cpp-python
docker tag ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/llama-cpp-python:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/llama-cpp-python:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/llama-cpp-python -o packages/llama-cpp-python --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-vllm-deps: sdk-wheel ## Download the wheels for the optional 'vllm' dependencies
-rm packages/vllm/build/*.whl
python -m pip wheel packages/vllm -w packages/vllm/build --find-links=${SDK_DEST}
build-vllm: local-registry setup-vllm-deps ## Build the vllm container and Zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/vllm:${LOCAL_VERSION} packages/vllm
docker tag ghcr.io/defenseunicorns/leapfrogai/vllm:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/vllm:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/vllm:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/vllm -o packages/vllm --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-text-embeddings-deps: sdk-wheel ## Download the wheels for the optional 'text-embeddings' dependencies
-rm packages/text-embeddings/build/*.whl
python -m pip wheel packages/text-embeddings -w packages/text-embeddings/build --find-links=${SDK_DEST}
build-text-embeddings: local-registry setup-text-embeddings-deps ## Build the text-embeddings container and Zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${LOCAL_VERSION} packages/text-embeddings
docker tag ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/text-embeddings:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/text-embeddings:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/text-embeddings -o packages/text-embeddings --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-whisper-deps: sdk-wheel ## Download the wheels for the optional 'whisper' dependencies
-rm packages/whisper/build/*.whl
python -m pip wheel "packages/whisper[dev]" -w packages/whisper/build --find-links=${SDK_DEST}
build-whisper: local-registry setup-whisper-deps ## Build the whisper container and zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/whisper:${LOCAL_VERSION} packages/whisper
docker tag ghcr.io/defenseunicorns/leapfrogai/whisper:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/whisper:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/whisper:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/whisper -o packages/whisper --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
setup-repeater-deps: sdk-wheel ## Download the wheels for the optional 'repeater' dependencies
-rm packages/repeater/build/*.whl
python -m pip wheel packages/repeater -w packages/repeater/build --find-links=${SDK_DEST}
build-repeater: local-registry setup-repeater-deps ## Build the repeater container and zarf package
## Build the image (and tag it for the local registry)
docker build -t ghcr.io/defenseunicorns/leapfrogai/repeater:${LOCAL_VERSION} packages/repeater
docker tag ghcr.io/defenseunicorns/leapfrogai/repeater:${LOCAL_VERSION} localhost:5000/defenseunicorns/leapfrogai/repeater:${LOCAL_VERSION}
## Push the image to the local registry (Zarf is super slow if the image is only in the local daemon)
docker push localhost:5000/defenseunicorns/leapfrogai/repeater:${LOCAL_VERSION}
## Build the Zarf package
uds zarf package create packages/repeater -o packages/repeater --registry-override=ghcr.io=localhost:5000 --insecure --set IMAGE_VERSION=${LOCAL_VERSION} --confirm
build-cpu: build-api build-llama-cpp-python build-text-embeddings build-whisper ## Build all zarf packages for a cpu-enabled deployment of LFAI
build-gpu: build-api build-vllm build-text-embeddings build-whisper ## Build all zarf packages for a gpu-enabled deployment of LFAI
build-all: build-api build-llama-cpp-python build-vllm build-text-embeddings build-whisper build-repeater ## Build all of the LFAI packages