Spaces:
Sleeping
Sleeping
LorenzoBioinfo
commited on
Commit
·
40236fb
1
Parent(s):
665dbc3
Change monitoring
Browse files- src/monitoring.py +13 -2
src/monitoring.py
CHANGED
|
@@ -45,8 +45,19 @@ def retrain_on_youtube_sample():
|
|
| 45 |
|
| 46 |
def main():
|
| 47 |
print("Caricamento del modello")
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
model.eval()
|
| 51 |
|
| 52 |
tweet_ds = load_from_disk(TWEET_PATH)
|
|
|
|
| 45 |
|
| 46 |
def main():
|
| 47 |
print("Caricamento del modello")
|
| 48 |
+
|
| 49 |
+
if os.path.exists(MODEL_PATH):
|
| 50 |
+
model = AutoModelForSequenceClassification.from_pretrained(MODEL_PATH)
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
| 52 |
+
else:
|
| 53 |
+
print("⚠️ Modello locale non trovato. Uso modello pre-addestrato di default.")
|
| 54 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
| 55 |
+
"cardiffnlp/twitter-roberta-base-sentiment-latest"
|
| 56 |
+
)
|
| 57 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 58 |
+
"cardiffnlp/twitter-roberta-base-sentiment-latest"
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
model.eval()
|
| 62 |
|
| 63 |
tweet_ds = load_from_disk(TWEET_PATH)
|