Skip to content

Fix UnboundLocalError in UNet2DModel when wrapped in DataParallel#13990

Open
Whning0513 wants to merge 1 commit into
huggingface:mainfrom
Whning0513:fix-issue-13789
Open

Fix UnboundLocalError in UNet2DModel when wrapped in DataParallel#13990
Whning0513 wants to merge 1 commit into
huggingface:mainfrom
Whning0513:fix-issue-13789

Conversation

@Whning0513

@Whning0513 Whning0513 commented Jun 19, 2026

Copy link
Copy Markdown

When UNet2DModel is wrapped in DataParallel, accessing self.dtype in forward raises UnboundLocalError. This avoids the problematic access path.

@github-actions github-actions Bot added size/S PR with diff < 50 LOC fixes-issue labels Jun 19, 2026
@Whning0513 Whning0513 changed the title Fix #13789: UNet2DModel dtype 属性在 nn.DataParallel 下报 UnboundLocalError Fix UnboundLocalError in UNet2DModel when wrapped in DataParallel Jun 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @Whning0513, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-issue size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant