Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
g207004202
explainable-multimodal-classification
Commits
8baedd6a
Commit
8baedd6a
authored
May 11, 2021
by
Mao, Bojia
Browse files
recorrect onnx to device
parent
1b41bc63
Changes
1
Hide whitespace changes
Inline
Side-by-side
mmxai/onnx/onnxModel.py
View file @
8baedd6a
...
...
@@ -118,7 +118,7 @@ class ONNXInterface:
if
self
.
defaultmodel
==
None
:
self
.
defaultmodel
=
MMBT
.
from_pretrained
(
"mmbt.hateful_memes.images"
)
logits
=
self
.
defaultmodel
.
classify
(
image
_path
,
text_input
,
image_tensor
=
torch
.
squeeze
(
image_tensor
,
0
))
logits
=
self
.
defaultmodel
.
classify
(
image
,
text_input
,
image_tensor
=
torch
.
squeeze
(
image_tensor
.
to
(
"cuda"
)
,
0
))
print
(
"The output of model is invalid, here use default output instead"
)
scores
=
nn
.
functional
.
softmax
(
torch
.
tensor
(
logits
),
dim
=
1
)
...
...
Write
Preview
Supports
Markdown
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