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
ad8ff962
Unverified
Commit
ad8ff962
authored
Nov 03, 2023
by
Younes Belkada
Committed by
GitHub
Nov 03, 2023
Browse files
[`Docs` / `SAM` ] Reflect correct changes to run inference without OOM (#27268)
Update sam.md
parent
f13f544a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
docs/source/en/model_doc/sam.md
docs/source/en/model_doc/sam.md
+3
-2
No files found.
docs/source/en/model_doc/sam.md
View file @
ad8ff962
...
...
@@ -57,7 +57,8 @@ raw_image = Image.open(requests.get(img_url, stream=True).raw).convert("RGB")
input_points
=
[[[
450
,
600
]]]
# 2D location of a window in the image
inputs
=
processor
(
raw_image
,
input_points
=
input_points
,
return_tensors
=
"pt"
).
to
(
device
)
outputs
=
model
(
**
inputs
)
with
torch
.
no_grad
():
outputs
=
model
(
**
inputs
)
masks
=
processor
.
image_processor
.
post_process_masks
(
outputs
.
pred_masks
.
cpu
(),
inputs
[
"original_sizes"
].
cpu
(),
inputs
[
"reshaped_input_sizes"
].
cpu
()
...
...
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