Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
sentiment-classification
Languages:
English
Size:
10K - 100K
ArXiv:
License:
Update lm_finetuning.py
Browse files- lm_finetuning.py +1 -9
lm_finetuning.py
CHANGED
@@ -173,7 +173,7 @@ def main():
|
|
173 |
|
174 |
# evaluation
|
175 |
model = AutoModelForSequenceClassification.from_pretrained(
|
176 |
-
|
177 |
num_labels=6,
|
178 |
local_files_only=not network,
|
179 |
id2label=ID2LABEL,
|
@@ -189,14 +189,6 @@ def main():
|
|
189 |
train_dataset=tokenized_datasets[opt.split_train],
|
190 |
eval_dataset=tokenized_datasets[opt.split_test],
|
191 |
compute_metrics=compute_metric_all,
|
192 |
-
model_init=lambda x: AutoModelForSequenceClassification.from_pretrained(
|
193 |
-
opt.model,
|
194 |
-
num_labels=6,
|
195 |
-
local_files_only=not network,
|
196 |
-
return_dict=True,
|
197 |
-
id2label=ID2LABEL,
|
198 |
-
label2id=LABEL2ID
|
199 |
-
)
|
200 |
)
|
201 |
summary_file = pj(opt.output_dir, opt.summary_file)
|
202 |
if not opt.skip_eval:
|
|
|
173 |
|
174 |
# evaluation
|
175 |
model = AutoModelForSequenceClassification.from_pretrained(
|
176 |
+
best_model_path,
|
177 |
num_labels=6,
|
178 |
local_files_only=not network,
|
179 |
id2label=ID2LABEL,
|
|
|
189 |
train_dataset=tokenized_datasets[opt.split_train],
|
190 |
eval_dataset=tokenized_datasets[opt.split_test],
|
191 |
compute_metrics=compute_metric_all,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
)
|
193 |
summary_file = pj(opt.output_dir, opt.summary_file)
|
194 |
if not opt.skip_eval:
|