Spaces:
Build error
Build error
Trang Dang
commited on
Commit
•
e952bfc
1
Parent(s):
4c3eda5
add run.py
Browse files- requirements.txt +24 -1
- run.py +11 -0
requirements.txt
CHANGED
@@ -1,4 +1,27 @@
|
|
1 |
shiny==0.9.0
|
2 |
shinyswatch==0.6.0
|
3 |
seaborn==0.12.2
|
4 |
-
matplotlib==3.7.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
shiny==0.9.0
|
2 |
shinyswatch==0.6.0
|
3 |
seaborn==0.12.2
|
4 |
+
matplotlib==3.7.1
|
5 |
+
certifi==2024.2.2
|
6 |
+
charset-normalizer==3.3.2
|
7 |
+
filelock==3.13.4
|
8 |
+
fsspec==2024.3.1
|
9 |
+
huggingface-hub==0.22.2
|
10 |
+
idna==3.7
|
11 |
+
Jinja2==3.1.3
|
12 |
+
MarkupSafe==2.1.5
|
13 |
+
mpmath==1.3.0
|
14 |
+
networkx==3.3
|
15 |
+
numpy==1.26.4
|
16 |
+
packaging==24.0
|
17 |
+
PyYAML==6.0.1
|
18 |
+
regex==2024.4.16
|
19 |
+
requests==2.31.0
|
20 |
+
safetensors==0.4.3
|
21 |
+
sympy==1.12
|
22 |
+
tokenizers==0.19.1
|
23 |
+
torch==2.3.0
|
24 |
+
tqdm==4.66.2
|
25 |
+
transformers==4.40.1
|
26 |
+
typing_extensions==4.11.0
|
27 |
+
urllib3==2.2.1
|
run.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import SamModel, SamConfig, SamProcessor
|
2 |
+
import torch
|
3 |
+
|
4 |
+
# Load the model configuration
|
5 |
+
model_config = SamConfig.from_pretrained("facebook/sam-vit-base")
|
6 |
+
processor = SamProcessor.from_pretrained("facebook/sam-vit-base")
|
7 |
+
|
8 |
+
# Create an instance of the model architecture with the loaded configuration
|
9 |
+
my_sam_model = SamModel(config=model_config)
|
10 |
+
#Update the model by loading the weights from saved file.
|
11 |
+
my_sam_model.load_state_dict(torch.load("sammodel2.pth", map_location=torch.device('cpu')))
|