Spaces:
Running
Running
Update training_bert.py
Browse files- training_bert.py +4 -3
training_bert.py
CHANGED
@@ -6,6 +6,9 @@ import torch
|
|
6 |
from sklearn.model_selection import GroupShuffleSplit
|
7 |
from transformers import AutoTokenizer,AutoModelForSequenceClassification
|
8 |
from transformers import TrainingArguments
|
|
|
|
|
|
|
9 |
|
10 |
def remove_links(review):
|
11 |
pattern = r'\bhttps?://\S+'
|
@@ -67,9 +70,7 @@ def preprocess_function_regr(examples):
|
|
67 |
ds_train_regr_tok = ds_train_regr.map(preprocess_function_regr, remove_columns = ['Text'])
|
68 |
ds_val_regr_tok = ds_val_regr.map(preprocess_function_regr, remove_columns = ['Text'])
|
69 |
|
70 |
-
|
71 |
-
from sklearn.metrics import mean_squared_error
|
72 |
-
from sklearn.metrics import r2_score
|
73 |
|
74 |
def compute_metrics_for_regression(eval_pred):
|
75 |
logits, labels = eval_pred
|
|
|
6 |
from sklearn.model_selection import GroupShuffleSplit
|
7 |
from transformers import AutoTokenizer,AutoModelForSequenceClassification
|
8 |
from transformers import TrainingArguments
|
9 |
+
from sklearn.metrics import mean_absolute_error
|
10 |
+
from sklearn.metrics import mean_squared_error
|
11 |
+
from sklearn.metrics import r2_score
|
12 |
|
13 |
def remove_links(review):
|
14 |
pattern = r'\bhttps?://\S+'
|
|
|
70 |
ds_train_regr_tok = ds_train_regr.map(preprocess_function_regr, remove_columns = ['Text'])
|
71 |
ds_val_regr_tok = ds_val_regr.map(preprocess_function_regr, remove_columns = ['Text'])
|
72 |
|
73 |
+
|
|
|
|
|
74 |
|
75 |
def compute_metrics_for_regression(eval_pred):
|
76 |
logits, labels = eval_pred
|