Skip to content

Commit

Permalink
rm autocast
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqing-feng committed Nov 5, 2024
1 parent 6380cfc commit 7ab91c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions optimum/exporters/ipex/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def _falcon_model_forward(
attentions=all_self_attentions,
)


def _gpt2_model_forward(
self,
input_ids: Optional[torch.LongTensor] = None,
Expand Down
6 changes: 1 addition & 5 deletions optimum/intel/ipex/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,7 @@ def can_generate(self):
return isinstance(self, GenerationMixin)

def _call_model(self, *args, **kwargs):
try:
with torch.autocast(self.device.type, self.dtype), torch.no_grad():
out = self.model(*args, **kwargs)
except RuntimeError:
out = self.model(*args, **kwargs)
out = self.model(*args, **kwargs)
return out

def _init_warmup(self):
Expand Down

0 comments on commit 7ab91c5

Please sign in to comment.