"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "162643a4b17edc24426980e4eddcdcfd7c3f7970"
Unverified Commit ad8ff962 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Docs` / `SAM` ] Reflect correct changes to run inference without OOM (#27268)

Update sam.md
parent f13f544a
...@@ -57,7 +57,8 @@ raw_image = Image.open(requests.get(img_url, stream=True).raw).convert("RGB") ...@@ -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 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) 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( masks = processor.image_processor.post_process_masks(
outputs.pred_masks.cpu(), inputs["original_sizes"].cpu(), inputs["reshaped_input_sizes"].cpu() outputs.pred_masks.cpu(), inputs["original_sizes"].cpu(), inputs["reshaped_input_sizes"].cpu()
...@@ -108,4 +109,4 @@ Resources: ...@@ -108,4 +109,4 @@ Resources:
## TFSamModel ## TFSamModel
[[autodoc]] TFSamModel [[autodoc]] TFSamModel
- call - call
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment