Include entire sam3 package instead of just sam3 and sam3.model (#327)
Summary: there are several imports within the `sam3.model` package that reference other packages within `sam3` other than `sam3` and `sam3.model` (for example [here](https://github.com/facebookresearch/sam3/blob/main/sam3/model/sam3_tracker_base.py#L15)). This fixes the package structure so that you can `pip install` the package and `import sam3` Pull Request resolved: https://github.com/facebookresearch/sam3/pull/327 Reviewed By: haithamkhedr Differential Revision: D88950127 Pulled By: lematt1991 fbshipit-source-id: 3554512d304ccdf679a9af8606bbfe1f7f2a1cfb
This commit is contained in:
committed by
meta-codesync[bot]
parent
757bbb0206
commit
b26a5f330e
@@ -3,6 +3,8 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
import pkg_resources
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from huggingface_hub import hf_hub_download
|
||||
@@ -580,9 +582,10 @@ def build_sam3_image_model(
|
||||
A SAM3 image model
|
||||
"""
|
||||
if bpe_path is None:
|
||||
bpe_path = os.path.join(
|
||||
os.path.dirname(__file__), "..", "assets", "bpe_simple_vocab_16e6.txt.gz"
|
||||
bpe_path = pkg_resources.resource_filename(
|
||||
"sam3", "assets/bpe_simple_vocab_16e6.txt.gz"
|
||||
)
|
||||
|
||||
# Create visual components
|
||||
compile_mode = "default" if compile else None
|
||||
vision_encoder = _create_vision_backbone(
|
||||
@@ -668,8 +671,8 @@ def build_sam3_video_model(
|
||||
Sam3VideoInferenceWithInstanceInteractivity: The instantiated dense tracking model
|
||||
"""
|
||||
if bpe_path is None:
|
||||
bpe_path = os.path.join(
|
||||
os.path.dirname(__file__), "..", "assets", "bpe_simple_vocab_16e6.txt.gz"
|
||||
bpe_path = pkg_resources.resource_filename(
|
||||
"sam3", "assets/bpe_simple_vocab_16e6.txt.gz"
|
||||
)
|
||||
|
||||
# Build Tracker module
|
||||
|
||||
Reference in New Issue
Block a user