Skip to content

fix: allow pass cpu generator for helios#13228

Merged
yiyixuxu merged 7 commits intohuggingface:mainfrom
xlite-dev:fix-helios-generator
Mar 9, 2026
Merged

fix: allow pass cpu generator for helios#13228
yiyixuxu merged 7 commits intohuggingface:mainfrom
xlite-dev:fix-helios-generator

Conversation

@DefTruth
Copy link
Copy Markdown
Contributor

@DefTruth DefTruth commented Mar 9, 2026

Allow pass cpu generator for helios. w/o this fix, helios distilled pipeline will raise an device mismatch error if we use cpu generator. we should use the device from generator for torch.randn.

  File "/workspace/deftruth/dev/miniconda3/envs/py312-c/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/deftruth/dev/diffusers/src/diffusers/pipelines/helios/pipeline_helios_pyramid.py", line 931, in __call__
    noise = self.sample_block_noise(
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/deftruth/dev/diffusers/src/diffusers/pipelines/helios/pipeline_helios_pyramid.py", line 473, in sample_block_noise
    z = torch.randn(block_number, block_size, device=device, generator=generator)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected a 'cuda' device type for generator but found 'cpu'

cc @SHYuanBest, @yiyixuxu

@SHYuanBest SHYuanBest mentioned this pull request Mar 9, 2026
@SHYuanBest
Copy link
Copy Markdown
Contributor

@DefTruth It seems that you need fix batch test like this PR.

https://github.com/huggingface/diffusers/pull/13216/changes/d1828e4273834286a08edea69ec8c90bbd26df48..6ed93db6b172c17d2336b876209fcc3daf73ad70

@DefTruth
Copy link
Copy Markdown
Contributor Author

DefTruth commented Mar 9, 2026

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

@yiyixuxu yiyixuxu merged commit 94bcb89 into huggingface:main Mar 9, 2026
10 of 11 checks passed
@DefTruth DefTruth deleted the fix-helios-generator branch March 10, 2026 02:46
SHYuanBest added a commit to PKU-YuanGroup/Helios that referenced this pull request Mar 10, 2026
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.

4 participants