Skip to content

Commit bbe8d3a

Browse files
authored
Compile test fixes (huggingface#5235)
compile test fixes
1 parent 907fd91 commit bbe8d3a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

docker/diffusers-pytorch-compile-cuda/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,23 @@ RUN apt update && \
1414
libsndfile1-dev \
1515
libgl1 \
1616
python3.9 \
17+
python3.9-dev \
1718
python3-pip \
1819
python3.9-venv && \
1920
rm -rf /var/lib/apt/lists
2021

2122
# make sure to use venv
22-
RUN python3 -m venv /opt/venv
23+
RUN python3.9 -m venv /opt/venv
2324
ENV PATH="/opt/venv/bin:$PATH"
2425

2526
# pre-install the heavy dependencies (these can later be overridden by the deps from setup.py)
26-
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
27-
python3 -m pip install --no-cache-dir \
27+
RUN python3.9 -m pip install --no-cache-dir --upgrade pip && \
28+
python3.9 -m pip install --no-cache-dir \
2829
torch \
2930
torchvision \
3031
torchaudio \
3132
invisible_watermark && \
32-
python3 -m pip install --no-cache-dir \
33+
python3.9 -m pip install --no-cache-dir \
3334
accelerate \
3435
datasets \
3536
hf-doc-builder \

tests/pipelines/controlnet/test_controlnet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ def _test_stable_diffusion_compile(in_queue, out_queue, timeout):
8585
prompt = "bird"
8686
image = load_image(
8787
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny.png"
88-
)
88+
).resize((512, 512))
8989

90-
output = pipe(prompt, image, generator=generator, output_type="np")
90+
output = pipe(prompt, image, num_inference_steps=10, generator=generator, output_type="np")
9191
image = output.images[0]
9292

93-
assert image.shape == (768, 512, 3)
93+
assert image.shape == (512, 512, 3)
9494

9595
expected_image = load_numpy(
9696
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny_out_full.npy"
9797
)
98+
expected_image = np.resize(expected_image, (512, 512, 3))
9899

99100
assert np.abs(expected_image - image).max() < 1.0
100101

0 commit comments

Comments
 (0)