Skip to content

Conversation

@ydshieh
Copy link
Contributor

@ydshieh ydshieh commented Sep 16, 2022

Fix FirUpsample2D._upsample_2d is not working, it copies the syntax from TensorFlow 😆

FirUpsample2D is never used with use_conv=True, that's why we don't catch it.

# Transpose weights.
weight = torch.reshape(weight, (num_groups, -1, inC, convH, convW))
weight = weight[..., ::-1, ::-1].permute(0, 2, 1, 3, 4)
weight = torch.flip(weight, dims=[3, 4]).permute(0, 2, 1, 3, 4)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the fix, we got

ValueError: step must be greater than zero

The syntax ::-1 is for TF tensors, not for torch tensors.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 16, 2022

The documentation is not available anymore as the PR was closed or merged.


stride = (factor, factor)
# Determine data dimensions.
stride = [1, 1, factor, factor]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

F.conv_transpose2d should have a single int or a tuple of 2 integers for stride, not 4 integers.

@ydshieh ydshieh marked this pull request as ready for review September 16, 2022 16:23
Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Thank you!

@ydshieh ydshieh merged commit b17d49f into main Sep 19, 2022
@kashif kashif deleted the fix_resnet branch September 22, 2022 15:06
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* Fix _upsample_2d

Co-authored-by: ydshieh <[email protected]>
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