Skip to content

Conversation

hisham-hchowdhu
Copy link
Contributor

Several fixes for running via DirectML
Fix empty image generation issue with Flux1
add CPU fallback for unsupported path. Verified the model works on AMD GPUs

Fix DirectML empty image generation issue with Flux1. add CPU fallback for unsupported path. Verified the model works on AMD GPUs
@Kosinkadink Kosinkadink added the AMD Issue related to AMD driver support. label Jan 27, 2025
causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(-torch.finfo(x.dtype).max).triu_(1)
if comfy.model_management.is_directml_enabled():
causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).triu_(1)
else:
Copy link
Owner

Choose a reason for hiding this comment

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

Is this change still needed on the latest code?

Copy link
Contributor Author

@hisham-hchowdhu hisham-hchowdhu Feb 8, 2025

Choose a reason for hiding this comment

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

yes, without this change image generated is blank

Copy link
Owner

Choose a reason for hiding this comment

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

This isn't setting the causal mask correctly.

Does doing this work?

torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this seem to work....do you want me to make this change under directml path or make it default?

@comfyanonymous comfyanonymous merged commit b124256 into comfyanonymous:master Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AMD Issue related to AMD driver support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants