Spaces:
Sleeping
Sleeping
LorenzoBioinfo
commited on
Commit
·
598af1c
1
Parent(s):
0a71c40
Test
Browse files- src/monitoring.py +3 -0
src/monitoring.py
CHANGED
|
@@ -5,6 +5,7 @@ import torch
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
from src.train_model import train_model
|
|
|
|
| 8 |
|
| 9 |
ACCURACY_THRESHOLD = 0.75
|
| 10 |
MODEL_PATH = "models/sentiment_model"
|
|
@@ -44,6 +45,8 @@ def retrain_on_youtube_sample():
|
|
| 44 |
youtube_sample = youtube_sample.remove_columns(
|
| 45 |
[col for col in youtube_sample.column_names if col not in ["text", "label"]]
|
| 46 |
)
|
|
|
|
|
|
|
| 47 |
|
| 48 |
train_model(additional_data=youtube_sample, output_dir=MODEL_PATH)
|
| 49 |
|
|
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
from src.train_model import train_model
|
| 8 |
+
from datasets import ClassLabel
|
| 9 |
|
| 10 |
ACCURACY_THRESHOLD = 0.75
|
| 11 |
MODEL_PATH = "models/sentiment_model"
|
|
|
|
| 45 |
youtube_sample = youtube_sample.remove_columns(
|
| 46 |
[col for col in youtube_sample.column_names if col not in ["text", "label"]]
|
| 47 |
)
|
| 48 |
+
label_class = ClassLabel(names=["negative", "neutral", "positive"])
|
| 49 |
+
youtube_sample = youtube_sample.cast_column("label", label_class)
|
| 50 |
|
| 51 |
train_model(additional_data=youtube_sample, output_dir=MODEL_PATH)
|
| 52 |
|