Spaces:
Runtime error
Runtime error
riorganizzazione progetto
Browse files- MLOps_project/CI/test_ci.py +1 -1
- MLOps_project/main.py +4 -0
- MLOps_project/modello.py +0 -25
- MLOps_project/src/__init__.py +0 -0
- MLOps_project/src/dataset.py +14 -0
- MLOps_project/src/modello.py +4 -0
MLOps_project/CI/test_ci.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import modello
|
| 2 |
|
| 3 |
class TestClass :
|
| 4 |
"""
|
|
|
|
| 1 |
+
from src import modello
|
| 2 |
|
| 3 |
class TestClass :
|
| 4 |
"""
|
MLOps_project/main.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Utilities
|
| 2 |
+
from src import modello, dataset
|
| 3 |
+
|
| 4 |
+
print("Hello TEST")
|
MLOps_project/modello.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
# Utilities
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
from datasets import load_dataset
|
| 4 |
-
import pandas as pd
|
| 5 |
-
|
| 6 |
-
# funzione che setta le impostazioni base del modello
|
| 7 |
-
def set_modello(self) :
|
| 8 |
-
# Import del modello da Hugging Face
|
| 9 |
-
sentiment_task = pipeline("sentiment-analysis", model="cardiffnlp/twitter-roberta-base-sentiment-latest", tokenizer="cardiffnlp/twitter-roberta-base-sentiment-latest")
|
| 10 |
-
return sentiment_task
|
| 11 |
-
|
| 12 |
-
def set_dataset(self) :
|
| 13 |
-
# Import di un dataset da Hugging Face
|
| 14 |
-
ds = load_dataset("SetFit/tweet_sentiment_extraction")
|
| 15 |
-
# Il dataset viene splittato autometicamente in train set e test set da load_dataset
|
| 16 |
-
# Per comodità trasformo i dataset in dataframe di pandas
|
| 17 |
-
df_train = ds['train'].to_pandas()
|
| 18 |
-
df_test = ds['test'].to_pandas()
|
| 19 |
-
|
| 20 |
-
X_train = df_train['text'].values
|
| 21 |
-
y_train = df_train['label_text'].values
|
| 22 |
-
X_test = df_test['text'].values
|
| 23 |
-
y_test = df_test['label_text'].values
|
| 24 |
-
|
| 25 |
-
return X_train,X_test,y_train,y_test
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MLOps_project/src/__init__.py
ADDED
|
File without changes
|
MLOps_project/src/dataset.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import load_dataset
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Import di un dataset da Hugging Face
|
| 5 |
+
ds = load_dataset("SetFit/tweet_sentiment_extraction")
|
| 6 |
+
# Il dataset viene splittato autometicamente in train set e test set da load_dataset
|
| 7 |
+
# Per comodità trasformo i dataset in dataframe di pandas
|
| 8 |
+
df_train = ds['train'].to_pandas()
|
| 9 |
+
df_test = ds['test'].to_pandas()
|
| 10 |
+
|
| 11 |
+
X_train = df_train['text'].values
|
| 12 |
+
y_train = df_train['label_text'].values
|
| 13 |
+
X_test = df_test['text'].values
|
| 14 |
+
y_test = df_test['label_text'].values
|
MLOps_project/src/modello.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
# Import del modello da Hugging Face
|
| 4 |
+
sentiment_task = pipeline("sentiment-analysis", model="cardiffnlp/twitter-roberta-base-sentiment-latest", tokenizer="cardiffnlp/twitter-roberta-base-sentiment-latest")
|