diff --git a/images/gpu/ollama/bench/Dockerfile b/images/gpu/ollama/bench/Dockerfile index fffa251eb..e9461a7dc 100644 --- a/images/gpu/ollama/bench/Dockerfile +++ b/images/gpu/ollama/bench/Dockerfile @@ -5,24 +5,20 @@ ENV PATH=$PATH:/usr/local/nvidia/bin:/bin/nvidia/bin ENV OLLAMA_ORIGINS=* ENV OLLAMA_HOST=0.0.0.0:11434 +COPY pull.sh /tmp + # Pre-install models useful for benchmarking. # These are huge (total ~120 GiB), but necessary to benchmark # models of various sizes. They are in their own image file to # keep the test-only image lighter by comparison. -RUN bash -c ' \ - ( ollama serve ) & serverpid="$!"; \ - sleep 5; \ - ollama pull codellama:7b-instruct && \ - ollama pull codellama:34b-instruct && \ - ollama pull llama2-chinese:7b-chat && \ - ollama pull llama2:13b-chat && \ - ollama pull llama2:70b-chat && \ - ollama pull mistral:7b-instruct && \ - ollama pull mixtral:instruct && \ - ollama pull gemma:2b-instruct && \ - ollama pull gemma:7b-instruct && \ - ollama pull llava:7b-v1.6 && \ - ollama pull llava:34b-v1.6 && \ - kill "$serverpid" && \ - wait "$serverpid" \ -' +RUN /tmp/pull.sh codellama:7b-instruct +RUN /tmp/pull.sh codellama:34b-instruct +RUN /tmp/pull.sh llama2-chinese:7b-chat +RUN /tmp/pull.sh llama2:13b-chat +RUN /tmp/pull.sh llama2:70b-chat +RUN /tmp/pull.sh mistral:7b-instruct +RUN /tmp/pull.sh mixtral:instruct +RUN /tmp/pull.sh gemma:2b-instruct +RUN /tmp/pull.sh gemma:7b-instruct +RUN /tmp/pull.sh llava:7b-v1.6 +RUN /tmp/pull.sh llava:34b-v1.6 diff --git a/images/gpu/ollama/bench/pull.sh b/images/gpu/ollama/bench/pull.sh new file mode 100755 index 000000000..d70630ed6 --- /dev/null +++ b/images/gpu/ollama/bench/pull.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright 2024 The gVisor Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -xe + +ollama serve & +serverpid="$!" +sleep 5 +ollama pull "$1" +kill "${serverpid}" +wait "${serverpid}"