-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from coreweave/amercurio/sd-inference-fix
Stable Diffusion Inference Overhaul
- Loading branch information
Showing
19 changed files
with
287 additions
and
576 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...able-diffusion/01-optional-s3-secret.yaml → ...able-diffusion/00-optional-s3-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
online-inference/stable-diffusion/02-inference-service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
name: sd | ||
annotations: | ||
networking.knative.dev/ingress-class: kourier.ingress.networking.knative.dev | ||
labels: | ||
knative.coreweave.cloud/ingress: kourier.ingress.networking.knative.dev | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
autoscaling.knative.dev/minScale: "1" | ||
autoscaling.knative.dev/maxScale: "1" | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: gpu.nvidia.com/class | ||
operator: In | ||
values: | ||
- Quadro_RTX_5000 | ||
- key: topology.kubernetes.io/region | ||
operator: In | ||
values: | ||
- ORD1 | ||
containers: | ||
- name: kfserving-container | ||
image: ghcr.io/coreweave/ml-containers/sd-inference:amercurio-sd-overhaul-7d29c61 | ||
command: | ||
- "python3" | ||
- "/app/service.py" | ||
- "--model-uri=s3://tensorized/runwayml/stable-diffusion-v1-5" | ||
- "--precision=float16" | ||
- "--port=80" | ||
env: | ||
- name: AWS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: s3-access-key | ||
key: access_key | ||
optional: true | ||
- name: AWS_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: s3-secret-key | ||
key: secret_key | ||
optional: true | ||
- name: AWS_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: s3-host-url | ||
key: url | ||
optional: true | ||
ports: | ||
- protocol: TCP | ||
containerPort: 80 | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 80 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 30 | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 80 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 30 | ||
resources: | ||
requests: | ||
cpu: 4 | ||
memory: 16Gi | ||
nvidia.com/gpu: 1 | ||
limits: | ||
cpu: 4 | ||
memory: 16Gi | ||
nvidia.com/gpu: 1 |
49 changes: 0 additions & 49 deletions
49
online-inference/stable-diffusion/02-model-download-job.yaml
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
online-inference/stable-diffusion/02-optional-serialize-job.yaml
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
online-inference/stable-diffusion/03-inference-service.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
ARG CUDA_RELEASE=11.6.2-cudnn8-devel-ubuntu20.04 | ||
FROM nvidia/cuda:${CUDA_RELEASE} AS base | ||
FROM ghcr.io/coreweave/ml-containers/torch:afecfe9-base-cuda11.8.0-torch2.0.0-vision0.15.1 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt update && apt upgrade -y && \ | ||
apt update && apt install -y python3 python3-pip git curl && \ | ||
apt clean | ||
|
||
ADD service/ /app/ | ||
COPY serializer/serialize.py /app/serialize.py | ||
WORKDIR /app | ||
|
||
RUN pip3 install --no-cache-dir --upgrade pip && \ | ||
pip3 install --no-cache-dir -r requirements.txt | ||
|
||
CMD ["python3", "/app/service.py"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,2 @@ | ||
# Stable Diffusion | ||
Please refer to [CoreWeave Docs](https://docs.coreweave.com/machine-learning-and-ai/inference/examples/pytorch-jax/hugging-face/pytorch-hugging-face-diffusers-stable-diffusion-text-to-image) for a deployment tutorial. | ||
|
||
## Example: | ||
![stable diffusion, digital art, trending, HD](stable-diffusion.png) | ||
``` | ||
{"prompt": "stable diffusion, digital art, trending, HD", "parameters": {"seed": 42424242}} | ||
``` |
Oops, something went wrong.