Skip to content

fix: allow pass cpu generator for helios#13228

Open
DefTruth wants to merge 7 commits intohuggingface:mainfrom
xlite-dev:fix-helios-generator
Open

fix: allow pass cpu generator for helios#13228
DefTruth wants to merge 7 commits intohuggingface:mainfrom
xlite-dev:fix-helios-generator

Conversation

@DefTruth
Copy link
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
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
Contributor Author

DefTruth commented Mar 9, 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.

2 participants