diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..64a58a7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +build*/ +test/ + +.cache/ +*.swp +models/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bd9a378 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +ARG UBUNTU_VERSION=22.04 + +FROM ubuntu:$UBUNTU_VERSION as build + +RUN apt-get update && apt-get install -y build-essential git cmake + +WORKDIR /sd.cpp + +COPY . . + +RUN mkdir build && cd build && cmake .. && cmake --build . --config Release + +FROM ubuntu:$UBUNTU_VERSION as runtime + +COPY --from=build /sd.cpp/build/bin/sd /sd + +ENTRYPOINT [ "/sd" ] \ No newline at end of file diff --git a/README.md b/README.md index 314c279..9d665c7 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,8 @@ You can specify the output model format using the --out_type parameter ### Build +#### Build from scratch + ```shell mkdir build cd build @@ -93,7 +95,7 @@ cmake .. cmake --build . --config Release ``` -#### Using OpenBLAS +##### Using OpenBLAS ``` cmake .. -DGGML_OPENBLAS=ON @@ -151,6 +153,22 @@ Using formats of different precisions will yield results of varying quality.

+### Docker + +#### Building using Docker + +```shell +docker build -t sd . +``` + +#### Run + +```shell +docker run -v /path/to/models:/models -v /path/to/output/:/output sd [args...] +# For example +# docker run -v ./models:/models -v ./build:/output sd -m /models/sd-v1-4-ggml-model-f16.bin -p "a lovely cat" -v -o /output/output.png +``` + ## Memory/Disk Requirements | precision | f32 | f16 |q8_0 |q5_0 |q5_1 |q4_0 |q4_1 |