Spaces:
Build error
Build error
Trang Dang
commited on
Commit
•
83cc330
1
Parent(s):
78054c9
add config
Browse files
run.py
CHANGED
@@ -8,11 +8,11 @@ import os
|
|
8 |
def pred(src):
|
9 |
# os.environ['HUGGINGFACE_HUB_HOME'] = './.cache'
|
10 |
# Load the model configuration
|
11 |
-
|
12 |
-
|
13 |
|
14 |
# Create an instance of the model architecture with the loaded configuration
|
15 |
-
my_sam_model = SamModel()
|
16 |
#Update the model by loading the weights from saved file.
|
17 |
my_sam_model.load_state_dict(torch.load("sam_model.pth", map_location=torch.device('cpu')))
|
18 |
|
|
|
8 |
def pred(src):
|
9 |
# os.environ['HUGGINGFACE_HUB_HOME'] = './.cache'
|
10 |
# Load the model configuration
|
11 |
+
model_config = SamConfig.from_pretrained("facebook/sam-vit-base")
|
12 |
+
processor = SamProcessor.from_pretrained("facebook/sam-vit-base")
|
13 |
|
14 |
# Create an instance of the model architecture with the loaded configuration
|
15 |
+
my_sam_model = SamModel(config=model_config)
|
16 |
#Update the model by loading the weights from saved file.
|
17 |
my_sam_model.load_state_dict(torch.load("sam_model.pth", map_location=torch.device('cpu')))
|
18 |
|