Skip to content

Commit

Permalink
ollama pipecleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Apr 5, 2024
1 parent 542a064 commit 413d5af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
42 changes: 21 additions & 21 deletions packages/llm/ollama/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
# config: config.py
# depends: [build-essential, cuda]
# requires: '>=34.1.0'
# test: test.sh
# docs: docs.md
#---
ARG BASE_IMAGE
ARG CMAKE_CUDA_ARCHITECTURES
ARG JETPACK_VERSION
ARG OLLAMA_REPO
ARG OLLAMA_BRANCH
ARG GOLANG_VERSION
ARG CMAKE_VERSION
ARG BASE_IMAGE \
CMAKE_CUDA_ARCHITECTURES \
JETPACK_VERSION \
OLLAMA_REPO \
OLLAMA_BRANCH \
GOLANG_VERSION \
CMAKE_VERSION

FROM ${BASE_IMAGE} AS ollama-l4t-build

ARG OLLAMA_REPO
ARG OLLAMA_BRANCH
ARG GOLANG_VERSION
ARG CMAKE_VERSION
ARG CMAKE_CUDA_ARCHITECTURES
ARG OLLAMA_REPO \
OLLAMA_BRANCH \
GOLANG_VERSION \
CMAKE_VERSION \
CMAKE_CUDA_ARCHITECTURES

WORKDIR /opt

Expand All @@ -32,8 +33,8 @@ RUN CMAKE_VERSION=${CMAKE_VERSION} GOLANG_VERSION=${GOLANG_VERSION} sh /opt/olla

# generate llama.cpp backend to bundle with Ollama
WORKDIR ollama/llm/generate
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/nvidia/compat
ENV CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/nvidia/compat:${LD_LIBRARY_PATH} \
CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}
RUN bash gen_linux.sh

WORKDIR /opt/ollama
Expand All @@ -46,16 +47,15 @@ COPY --from=ollama-l4t-build /opt/ollama/ollama /bin/ollama
ARG JETPACK_VERSION

EXPOSE 11434
ENV OLLAMA_HOST 0.0.0.0
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/include
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV JETSON_JETPACK=${JETPACK_VERSION}
ENV OLLAMA_HOST=0.0.0.0 \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/include:${LD_LIBRARY_PATH} \
JETSON_JETPACK=${JETPACK_VERSION}

COPY test.sh /test.sh
COPY benchmark.py /benchmark.py
COPY benchmark.sh /benchmark.sh

ENTRYPOINT ["/bin/bash", "-c"]
RUN ln -s /data/models/ollama /root/.ollama

CMD ["/bin/ollama serve"]
CMD ["/bin/ollama", "serve"]
12 changes: 3 additions & 9 deletions packages/llm/ollama/config.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@

import copy
from jetson_containers import CUDA_ARCHITECTURES, JETPACK_VERSION

ollama = copy.deepcopy(package)
ollama['name'] = 'ollama'
ollama['alias'] = 'ollama'
ollama['build_args'] = {
'CMAKE_CUDA_ARCHITECTURES': ';'.join([str(x) for x in CUDA_ARCHITECTURES]),
'JETPACK_VERSION': str(JETPACK_VERSION),
package['build_args'] = {
'OLLAMA_REPO': 'ollama/ollama',
'OLLAMA_BRANCH': 'main',
'GOLANG_VERSION': '1.22.1',
'CMAKE_VERSION': '3.22.1',
'JETPACK_VERSION': str(JETPACK_VERSION),
'CMAKE_CUDA_ARCHITECTURES': ';'.join([str(x) for x in CUDA_ARCHITECTURES]),
}

package = [ollama]
4 changes: 2 additions & 2 deletions packages/llm/ollama/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
echo "testing ollama"

-set ex
file /bin/ollama
ollama --help

0 comments on commit 413d5af

Please sign in to comment.