Skip to content

enable pipeline test cases on xpu #11527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

yao-matrix
Copy link
Contributor

@yao-matrix yao-matrix commented May 9, 2025

incl.
stable_diffusion_k_diffusion
stable_diffusion_sag
stable_diffusion_ldm3d
text_to_video_synthesis
unclip
stable_unclip

@a-r-r-o-w @DN6 , pls help review, thx very much.

yao-matrix added 2 commits May 9, 2025 02:59
Signed-off-by: Yao Matrix <matrix.yao@intel.com>
Signed-off-by: Yao Matrix <matrix.yao@intel.com>
response = requests.get(url, timeout=DIFFUSERS_REQUEST_TIMEOUT)
response.raise_for_status()
arry = torch.load(BytesIO(response.content), map_location=map_location)
arry = torch.load(BytesIO(response.content), map_location=map_location, weights_only=False)
Copy link
Contributor Author

@yao-matrix yao-matrix May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. weights_only default value changed from False to True from PyTorch 2.6, so set explicitly to False here, otherwise tests/pipelines/text_to_video_synthesis/test_text_to_video_zero.py::TextToVideoZeroPipelineSlowTests::test_full_model will raise error
  2. set map_location default as None which aligns w. torch.load, otherwise tests/pipelines/text_to_video_synthesis/test_text_to_video_zero.py::TextToVideoZeroPipelineSlowTests::test_full_model will raise error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add weights_only=True as an arg to load_pt and pass in to torch load. In the test itself we can set it to false so that it's clear what's happening in the test. I would avoid doing this under the hood because it is a potential security hole.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DN6 , pls help review, thx.

pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
generator = torch.Generator(device="cuda").manual_seed(0)
generator = torch.Generator(device="cpu").manual_seed(0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRNG will behave different across accelerators, set back to "cpu" for cross-device reproducibility, as other cases in diffusers

@@ -220,7 +220,7 @@ def test_dict_tuple_outputs_equivalent(self, expected_max_difference=1e-4):
self.assertLess(max_diff, expected_max_difference)

@unittest.skipIf(torch_device not in ["cuda", "xpu"], reason="float16 requires CUDA or XPU")
@require_accelerator
@require_torch_accelerator
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it's torch case, use require_torch_accelerator to reflect fact

@a-r-r-o-w a-r-r-o-w requested a review from DN6 May 12, 2025 10:45
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@yao-matrix
Copy link
Contributor Author

@DN6, could you pls review and comment? Thx very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants