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
84a6570e
Unverified
Commit
84a6570e
authored
Apr 18, 2023
by
Youssef Adarrab
Committed by
GitHub
Apr 18, 2023
Browse files
Make ClipSeg compatible with model parallelism (#22844)
parent
5bb4ec62
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/transformers/models/clipseg/modeling_clipseg.py
src/transformers/models/clipseg/modeling_clipseg.py
+2
-0
No files found.
src/transformers/models/clipseg/modeling_clipseg.py
View file @
84a6570e
...
@@ -1480,6 +1480,8 @@ class CLIPSegForImageSegmentation(CLIPSegPreTrainedModel):
...
@@ -1480,6 +1480,8 @@ class CLIPSegForImageSegmentation(CLIPSegPreTrainedModel):
loss
=
None
loss
=
None
if
labels
is
not
None
:
if
labels
is
not
None
:
# move labels to the correct device to enable PP
labels
=
labels
.
to
(
logits
.
device
)
loss_fn
=
nn
.
BCEWithLogitsLoss
()
loss_fn
=
nn
.
BCEWithLogitsLoss
()
loss
=
loss_fn
(
logits
,
labels
)
loss
=
loss_fn
(
logits
,
labels
)
...
...
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