Spaces:
Running on Zero
Running on Zero
SAM 3 needs transformers >= 5.0
Browse files- flashrefocus/README.md +1 -1
- flashrefocus/segment.py +2 -2
flashrefocus/README.md
CHANGED
|
@@ -86,7 +86,7 @@ a text prompt.
|
|
| 86 |
## Video spotlight
|
| 87 |
|
| 88 |
```python
|
| 89 |
-
from flashrefocus.segment import track_subject # SAM 3: transformers >=
|
| 90 |
from flashrefocus.rendering import depth_edits
|
| 91 |
|
| 92 |
refocuser = Refocuser.from_pretrained(deblurring=False, fused=True)
|
|
|
|
| 86 |
## Video spotlight
|
| 87 |
|
| 88 |
```python
|
| 89 |
+
from flashrefocus.segment import track_subject # SAM 3: transformers >= 5.0, access to facebook/sam3
|
| 90 |
from flashrefocus.rendering import depth_edits
|
| 91 |
|
| 92 |
refocuser = Refocuser.from_pretrained(deblurring=False, fused=True)
|
flashrefocus/segment.py
CHANGED
|
@@ -5,7 +5,7 @@ as the subject and the union of the others is returned too (for depth_edits.spot
|
|
| 5 |
subject mask into a neighbour). Long clips are processed in chunks; the subject is carried from one chunk to the next
|
| 6 |
by the overlap of its last mask with the tracks of the next chunk.
|
| 7 |
|
| 8 |
-
Needs transformers >=
|
| 9 |
pins an older transformers; the spotlight path (restoration off) does not use Stage I, so it can run in an
|
| 10 |
environment with a recent transformers.
|
| 11 |
|
|
@@ -22,7 +22,7 @@ def _load(device, dtype):
|
|
| 22 |
try:
|
| 23 |
from transformers import Sam3VideoModel, Sam3VideoProcessor
|
| 24 |
except ImportError as e: # pragma: no cover
|
| 25 |
-
raise ImportError("SAM 3 needs transformers >=
|
| 26 |
"facebook/sam3 on Hugging Face.") from e
|
| 27 |
key = (str(device), dtype)
|
| 28 |
if key not in _SAM3:
|
|
|
|
| 5 |
subject mask into a neighbour). Long clips are processed in chunks; the subject is carried from one chunk to the next
|
| 6 |
by the overlap of its last mask with the tracks of the next chunk.
|
| 7 |
|
| 8 |
+
Needs transformers >= 5.0 (Sam3VideoModel) and access to the gated checkpoint facebook/sam3 on Hugging Face. Stage I
|
| 9 |
pins an older transformers; the spotlight path (restoration off) does not use Stage I, so it can run in an
|
| 10 |
environment with a recent transformers.
|
| 11 |
|
|
|
|
| 22 |
try:
|
| 23 |
from transformers import Sam3VideoModel, Sam3VideoProcessor
|
| 24 |
except ImportError as e: # pragma: no cover
|
| 25 |
+
raise ImportError("SAM 3 needs transformers >= 5.0 (pip install -U transformers) and access to "
|
| 26 |
"facebook/sam3 on Hugging Face.") from e
|
| 27 |
key = (str(device), dtype)
|
| 28 |
if key not in _SAM3:
|