Distributed gather crashes on PyTorch < 2.6
メンテナーはふだん 1 日以内に返信
@akshatvishu がすでに取り組んでいます。
2026年2月3日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
調査の方向性
src/diffusers/models/_modeling_parallel.py の gather_size_by_comm から始め、issue にある PyTorch 2.4 を使った最小限の分散再現を実行します。通信バックエンドが gather_device を決定する方法を追跡します。完了条件は、より新しいバージョンでの動作を維持しながら、サポート対象の PyTorch 2.1–2.5 で distributed gather が AttributeError を発生させなくなることです。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
AttributeError: module 'torch' has no attribute 'accelerator' when running distributed gather on PyTorch versions < 2.6.
This error happens because gather_size_by_comm in src/diffusers/models/_modeling_parallel.py uses torch.accelerator.current_accelerator(), which only exists in PyTorch 2.6+. Diffusers officially supports PyTorch 2.1+, so this causes a crash on versions 2.1–2.5 with AttributeError: module 'torch' has no attribute 'accelerator'.
Reproduction
Since this is a utility function; it can be triggered directly with a minimal distributed setup:
import torch.distributed as dist
from diffusers.models._modeling_parallel import gather_size_by_comm
dist.init_process_group(
backend="gloo",
init_method="file:///tmp/pg",
rank=0,
world_size=1,
)
gather_size_by_comm(1, dist.group.WORLD)
Logs
[rank0]: Traceback (most recent call last):
[rank0]: File "/home/aja/diffusers/test.py", line 11, in <module>
[rank0]: gather_size_by_comm(1, dist.group.WORLD)
[rank0]: File "/home/aja/diffusers/src/diffusers/models/_modeling_parallel.py", line 293, in gather_size_by_comm
[rank0]: gather_device = "cpu" if "cpu" in comm_backends else torch.accelerator.current_accelerator()
[rank0]: ^^^^^^^^^^^^^^^^^
[rank0]: File "/home/aja/diffusers/.venv/lib/python3.11/site-packages/torch/__init__.py", line 2216, in __getattr__
[rank0]: raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
[rank0]: AttributeError: module 'torch' has no attribute 'accelerator'
System Info
diffuser : 0.37.0.dev0
torch : 2.4.0
python : 3.11
system: Linux
Who can help?
@sayakpaul @DN6
- 主要言語
- Python
- スター
- 34.6k
- フォーク
- 7.4k
- 平均マージ
- 4日 15時間
- マージ済み PR(30日)
- 49
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/diffusers のほかの issue
-
bug models
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/diffusers#14952 ·
メンテナーはふだん 1 日以内に返信
-
UniPCMultistepScheduler fails in torch.linalg.solve under a float64 default dtype: the unit entry of rks takes the default dtype対応中かも @DawnofGenX が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
huggingface/diffusers#14888 ·
メンテナーはふだん 1 日以内に返信
-
WanAnimatePipeline.get_i2v_mask() defaults device to "cuda", which raises on non-CUDA accelerators (NPU/XPU/MPS)対応中かも @li-lizhe が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
huggingface/diffusers#14881 ·
メンテナーはふだん 1 日以内に返信
-
IndexError when preprocessing an empty image or video list対応中かも @MohammadHijjawi97 が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
huggingface/diffusers#14864 ·
メンテナーはふだん 1 日以内に返信
-
Windows: check_ai.py fails decoding UTF-8 guides with the default locale対応中かも @tanvir-ux が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
huggingface/diffusers#14837 ·
メンテナーはふだん 1 日以内に返信
huggingface/diffusers の issue をすべて見る
似ている issue
-
needs-human needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
gke-labs/kube-agents#2400 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reused対応中かも @sylvesterkaczmarek が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google-deepmind/bsuite#56 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
LearningCircuit/local-deep-research#7206 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chingu-voyages/V62-tier3-team-33#285 ·
メンテナーはふだん 1 日以内に返信