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
c31473ed
Unverified
Commit
c31473ed
authored
May 28, 2024
by
Pavel Iakubovskii
Committed by
GitHub
May 28, 2024
Browse files
Remove float64 cast for OwlVit and OwlV2 to support MPS device (#31071)
Remove float64
parent
936ab7ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
2 deletions
+0
-2
src/transformers/models/owlv2/modeling_owlv2.py
src/transformers/models/owlv2/modeling_owlv2.py
+0
-1
src/transformers/models/owlvit/modeling_owlvit.py
src/transformers/models/owlvit/modeling_owlvit.py
+0
-1
No files found.
src/transformers/models/owlv2/modeling_owlv2.py
View file @
c31473ed
...
...
@@ -1276,7 +1276,6 @@ class Owlv2ClassPredictionHead(nn.Module):
if
query_mask
.
ndim
>
1
:
query_mask
=
torch
.
unsqueeze
(
query_mask
,
dim
=-
2
)
pred_logits
=
pred_logits
.
to
(
torch
.
float64
)
pred_logits
=
torch
.
where
(
query_mask
==
0
,
-
1e6
,
pred_logits
)
pred_logits
=
pred_logits
.
to
(
torch
.
float32
)
...
...
src/transformers/models/owlvit/modeling_owlvit.py
View file @
c31473ed
...
...
@@ -1257,7 +1257,6 @@ class OwlViTClassPredictionHead(nn.Module):
if
query_mask
.
ndim
>
1
:
query_mask
=
torch
.
unsqueeze
(
query_mask
,
dim
=-
2
)
pred_logits
=
pred_logits
.
to
(
torch
.
float64
)
pred_logits
=
torch
.
where
(
query_mask
==
0
,
-
1e6
,
pred_logits
)
pred_logits
=
pred_logits
.
to
(
torch
.
float32
)
...
...
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