Skip to content

Commit

Permalink
Update optimum/neuron/modeling_diffusion.py
Browse files Browse the repository at this point in the history
Co-authored-by: Wenchen Li <[email protected]>
  • Loading branch information
JingyaHuang and neo authored Apr 30, 2024
1 parent ac0cb97 commit a782368
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions optimum/neuron/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,15 @@ def __init__(
def forward(
self,
input_ids: torch.Tensor,
*args,
**kwargs,
output_attentions: Optional[bool] = None,
output_hidden_states: Optional[bool] = None,
return_dict: Optional[bool] = None,
):
if attention_mask is not None:
assert torch.equal(torch.ones_like(attention_mask), attention_mask), "attention_mask is expected to be only all ones"
if output_hidden_states is not None:
assert bool(self.text_encoder.config.output_hidden_states) == bool(output_hidden_states), "output_hidden_states is expected to be consistent with how it was compiled"

input_ids = input_ids.to(torch.long) # dummy generator uses long int for tracing

inputs = (input_ids,)
Expand Down

0 comments on commit a782368

Please sign in to comment.