Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ from huggingface_hub import hf_hub_download
|
|
9 |
|
10 |
# DEFINE MODEL NAME
|
11 |
model_name = "DinoVdeau-large-2024_04_03-with_data_aug_batch-size32_epochs150_freeze"
|
12 |
-
checkpoint_name = "lombardata/" + model_name
|
13 |
|
14 |
# IMPORT CLASSIFICATION MODEL
|
15 |
def create_head(num_features , number_classes ,dropout_prob=0.5 ,activation_func =nn.ReLU):
|
@@ -28,12 +27,10 @@ class NewheadDinov2ForImageClassification(Dinov2ForImageClassification):
|
|
28 |
def __init__(self, config: Dinov2Config) -> None:
|
29 |
super().__init__(config)
|
30 |
|
31 |
-
self.num_labels = config.num_labels
|
32 |
-
self.dinov2 = Dinov2Model(config)
|
33 |
-
|
34 |
# Classifier head
|
35 |
self.classifier = create_head(config.hidden_size * 2, config.num_labels)
|
36 |
-
|
|
|
37 |
model = NewheadDinov2ForImageClassification.from_pretrained(checkpoint_name)
|
38 |
|
39 |
# IMPORT MODEL CONFIG PARAMETERS
|
|
|
9 |
|
10 |
# DEFINE MODEL NAME
|
11 |
model_name = "DinoVdeau-large-2024_04_03-with_data_aug_batch-size32_epochs150_freeze"
|
|
|
12 |
|
13 |
# IMPORT CLASSIFICATION MODEL
|
14 |
def create_head(num_features , number_classes ,dropout_prob=0.5 ,activation_func =nn.ReLU):
|
|
|
27 |
def __init__(self, config: Dinov2Config) -> None:
|
28 |
super().__init__(config)
|
29 |
|
|
|
|
|
|
|
30 |
# Classifier head
|
31 |
self.classifier = create_head(config.hidden_size * 2, config.num_labels)
|
32 |
+
|
33 |
+
checkpoint_name = "lombardata/" + model_name
|
34 |
model = NewheadDinov2ForImageClassification.from_pretrained(checkpoint_name)
|
35 |
|
36 |
# IMPORT MODEL CONFIG PARAMETERS
|