chore: add sd Dockerfile

pull/38/head
leejet 2023-08-22 22:06:43 +08:00
parent a393bebec8
commit 721cb324af
3 changed files with 42 additions and 1 deletions

6
.dockerignore 100644
View File

@ -0,0 +1,6 @@
build*/
test/
.cache/
*.swp
models/

17
Dockerfile 100644
View File

@ -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" ]

View File

@ -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.
<img src="./assets/img2img_output.png" width="256x">
</p>
### 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 |