For model long-t5-tglobal-x, fix 'float' object cannot be interpreted as an integer #17777
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On line 180,
torch.tensor(-1.0, dtype=global_block_ids.dtype)
gives the error TypeError: 'float' object cannot be interpreted as an integer . This is because the dtype here isint64
. Fordtype=int64
, this needs to simply be-1
.This impacts the
long-t5-tglogbal-x
model. It does not impact thelong-t5-local-x
version which does not appear to call this line in the code.The torch version where I see this is 1.11.0+cu113. I'm not certain if older, or non-gpu versions of torch allowed this but 1.11.0+cu113 does not.
Note that torch does not complain when casting an int to a float so it should be safe to change this to
-1
even if there are occasions whereglobal_block_ids.dtype
is a float.What does this PR do?
Fixes # (no issue # created).
There is a simple error in the code where torch fails when trying to create a constant int64 tensor using
-1.0
instead of-1
.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
This model is new. I would suggest someone from the original upload team review this. Here are the first 3 in the file history..
@stancld, @PhungVanDuy, @sgugger