Someshfengde
commited on
Commit
•
bcf50c6
1
Parent(s):
a139ac6
Upload folder using huggingface_hub
Browse files
script.py
CHANGED
@@ -8,7 +8,7 @@ import torchvision.transforms as T
|
|
8 |
from PIL import Image
|
9 |
import torch
|
10 |
from transformers import AutoImageProcessor
|
11 |
-
from
|
12 |
#%%
|
13 |
# %%
|
14 |
|
@@ -28,8 +28,8 @@ class PytorchWorker:
|
|
28 |
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
29 |
print(f"Using devide: {self.device}")
|
30 |
|
31 |
-
image_processor = AutoImageProcessor.from_pretrained("./
|
32 |
-
model = HieraForImageClassification.from_pretrained("./
|
33 |
|
34 |
return model, image_processor
|
35 |
|
|
|
8 |
from PIL import Image
|
9 |
import torch
|
10 |
from transformers import AutoImageProcessor
|
11 |
+
from create_model import HieraForImageClassification
|
12 |
#%%
|
13 |
# %%
|
14 |
|
|
|
28 |
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
29 |
print(f"Using devide: {self.device}")
|
30 |
|
31 |
+
image_processor = AutoImageProcessor.from_pretrained("./hiera_model/")
|
32 |
+
model = HieraForImageClassification.from_pretrained("./hiera_model/", num_labels =1784 ).to(self.device).eval()
|
33 |
|
34 |
return model, image_processor
|
35 |
|