Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
a6e0d5a2
Unverified
Commit
a6e0d5a2
authored
Nov 06, 2023
by
Iker García-Ferrero
Committed by
GitHub
Nov 06, 2023
Browse files
Fix VideoMAEforPretrained dtype error (#27296)
* Fix dtype error * Fix mean and std dtype * make style
parent
e9dbd392
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/transformers/models/videomae/modeling_videomae.py
src/transformers/models/videomae/modeling_videomae.py
+3
-2
No files found.
src/transformers/models/videomae/modeling_videomae.py
View file @
a6e0d5a2
...
...
@@ -848,8 +848,9 @@ class VideoMAEForPreTraining(VideoMAEPreTrainedModel):
else
:
# first, unnormalize the frames
device
=
pixel_values
.
device
mean
=
torch
.
as_tensor
(
IMAGENET_DEFAULT_MEAN
).
to
(
device
)[
None
,
None
,
:,
None
,
None
]
std
=
torch
.
as_tensor
(
IMAGENET_DEFAULT_STD
).
to
(
device
)[
None
,
None
,
:,
None
,
None
]
dtype
=
pixel_values
.
dtype
mean
=
torch
.
as_tensor
(
IMAGENET_DEFAULT_MEAN
).
to
(
device
=
device
,
dtype
=
dtype
)[
None
,
None
,
:,
None
,
None
]
std
=
torch
.
as_tensor
(
IMAGENET_DEFAULT_STD
).
to
(
device
=
device
,
dtype
=
dtype
)[
None
,
None
,
:,
None
,
None
]
frames
=
pixel_values
*
std
+
mean
# in [0, 1]
batch_size
,
time
,
num_channels
,
height
,
width
=
frames
.
shape
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment