Skip to content

Commit 89eed1f

Browse files
committed
update per comments
Signed-off-by: Matrix Yao <[email protected]>
1 parent 5dd97dc commit 89eed1f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/diffusers/utils/testing_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,10 @@ def load_numpy(arry: Union[str, np.ndarray], local_path: Optional[str] = None) -
635635
return arry
636636

637637

638-
def load_pt(url: str, map_location: Optional[str] = None):
638+
def load_pt(url: str, map_location: Optional[str] = None, weights_only: Optional[bool] = True):
639639
response = requests.get(url, timeout=DIFFUSERS_REQUEST_TIMEOUT)
640640
response.raise_for_status()
641-
arry = torch.load(BytesIO(response.content), map_location=map_location, weights_only=False)
641+
arry = torch.load(BytesIO(response.content), map_location=map_location, weights_only=weights_only)
642642
return arry
643643

644644

tests/pipelines/stable_cascade/test_stable_cascade_decoder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ def test_stable_cascade_decoder(self):
304304

305305
generator = torch.Generator(device="cpu").manual_seed(0)
306306
image_embedding = load_pt(
307-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_cascade/image_embedding.pt"
307+
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_cascade/image_embedding.pt",
308+
map_location=torch_device,
308309
)
309310

310311
image = pipe(
@@ -320,4 +321,4 @@ def test_stable_cascade_decoder(self):
320321
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_cascade/stable_cascade_decoder_image.npy"
321322
)
322323
max_diff = numpy_cosine_similarity_distance(image.flatten(), expected_image.flatten())
323-
assert max_diff < 1e-4
324+
assert max_diff < 2e-4

tests/pipelines/text_to_video_synthesis/test_text_to_video_zero.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def test_full_model(self):
5555
result = pipe(prompt=prompt, generator=generator).images
5656

5757
expected_result = load_pt(
58-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt"
58+
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt",
59+
weights_only=False,
5960
)
6061

6162
assert_mean_pixel_difference(result, expected_result)

0 commit comments

Comments
 (0)