Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add deploy target for mac server bundle #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions 27 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ deploy.pypi:
deploy.gh-docs:
mkdocs build
mkdocs gh-deploy

COMMIT := $(shell git rev-parse --short HEAD)

deploy.docker:
# Make image with commit in name
docker build -t openblas_server_$(COMMIT) .

# Run image and immediately exit (just want to create the container)
docker run openblas_server_$(COMMIT) bash

# Get container ID, copy server tarball + libllama.so tarball, and delete
# temp container
CONTAINER_ID=$$(docker ps -lq --filter ancestor=openblas_server_$(COMMIT)) ; \
Expand All @@ -73,7 +73,25 @@ deploy.docker:

# More cleanup
yes | docker image prune


# Build standalone server, may want to do in fresh venv to avoid bloat
deploy.pyinstaller.mac:
# CPU must be aarch64 and OS is MacOS
@if [ `uname -m` != "arm64" ]; then echo "Must be on aarch64"; exit 1; fi
@if [ `uname` != "Darwin" ]; then echo "Must be on MacOS"; exit 1; fi
@echo "Building and installing with proper env vars for aarch64-specific ops"
CMAKE_ARGS="-DGGML_METAL=off -DGGML_LLAMAFILE=OFF -DGGML_BLAS=OFF -DCMAKE_BUILD_TYPE=Release" python3 -m pip install -v -e .[server,dev]
@server_path=$$(python -c 'import llama_cpp.server; print(llama_cpp.server.__file__)' | sed s/init/main/) ; \
echo "Server path: $$server_path" ; \
libllama_path=$$(python -c 'import llama_cpp.llama_cpp; print(llama_cpp.llama_cpp._load_shared_library("llama")._name)') ; \
libggml_path=$$(python -c 'import llama_cpp.llama_cpp; print(llama_cpp.llama_cpp._load_shared_library("ggml")._name)') ; \
echo "libllama path: $$libllama_path" ; \
echo "libggml path: $$libggml_path" ; \
pyinstaller -DF $$server_path \
--add-data $$libllama_path:llama_cpp/lib \
--add-data $$libggml_path:llama_cpp/lib \
-n llama-cpp-py-server

test:
python3 -m pytest

Expand Down Expand Up @@ -104,5 +122,6 @@ clean:
deploy.pypi \
deploy.gh-docs \
deploy.docker \
deploy.pyinstaller.mac \
docker \
clean
1 change: 1 addition & 0 deletions 1 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dev = [
"httpx>=0.24.1",
"pandas>=2.2.1",
"tqdm>=4.66.2",
"pyinstaller>=6.11.1",
]
all = ["llama_cpp_python[server,test,dev]"]

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.