Skip to content

[Flux] allow tests to run #9050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 2, 2024
Merged

[Flux] allow tests to run #9050

merged 13 commits into from
Aug 2, 2024

Conversation

sayakpaul
Copy link
Member

What does this PR do?

Some comments inline.

@sayakpaul sayakpaul requested a review from DN6 August 2, 2024 05:24
@@ -123,6 +122,7 @@ def forward(
)

hidden_states = torch.cat([attn_output, mlp_hidden_states], dim=2)
gate = gate.unsqueeze(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

Otherwise, will fail for multiple images.

Comment on lines +378 to +379
dtype = self.text_encoder.dtype if self.text_encoder is not None else self.transformer.dtype
text_ids = torch.zeros(batch_size, prompt_embeds.shape[1], 3).to(device=device, dtype=dtype)
Copy link
Member Author

Choose a reason for hiding this comment

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

The dtype change had to be made to allow tests that check prompt_embeds. This has an overlap with #9049. Can close #9049 to fix it here?

text_ids = torch.zeros(batch_size, prompt_embeds.shape[1], 3).to(device=device, dtype=self.text_encoder.dtype)
dtype = self.text_encoder.dtype if self.text_encoder is not None else self.transformer.dtype
text_ids = torch.zeros(batch_size, prompt_embeds.shape[1], 3).to(device=device, dtype=dtype)
text_ids = text_ids.repeat(num_images_per_prompt, 1, 1)
Copy link
Member Author

Choose a reason for hiding this comment

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

To allow num_images_per_prompt > 1.

**inputs,
).images[0]

max_diff = np.abs(output_with_prompt - output_with_embeds).max()
assert max_diff < 1e-4

def test_fused_qkv_projections(self):
Copy link
Member Author

Choose a reason for hiding this comment

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

It's not supported yet. Will add after @yiyixuxu performs the refactors.

@HuggingFaceDocBuilderDev

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.

Copy link
Collaborator

@DN6 DN6 left a comment

Choose a reason for hiding this comment

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

LGTM. I would remove OriginalModelMixin from the transformer as well. Since single file loading isn't supported yet

@sayakpaul sayakpaul merged commit 0e46067 into main Aug 2, 2024
18 checks passed
@sayakpaul sayakpaul deleted the fix-flux-tests branch August 2, 2024 06:20
sayakpaul added a commit that referenced this pull request Dec 23, 2024
* fix tests

* fix

* float64 skip

* remove sample_size.

* remove

* remove more

* default_sample_size.

* credit black forest for flux model.

* skip

* fix: tests

* remove OriginalModelMixin

* add transformer model test

* add: transformer model tests
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.

3 participants