Update lm_finetuning.py
Browse files- lm_finetuning.py +3 -3
lm_finetuning.py
CHANGED
@@ -118,7 +118,7 @@ def main():
|
|
118 |
eval_dataset=tokenized_datasets[opt.split_validation],
|
119 |
compute_metrics=compute_metric_search,
|
120 |
model_init=lambda x: AutoModelForSequenceClassification.from_pretrained(
|
121 |
-
opt.model, return_dict=True, num_labels=len(
|
122 |
)
|
123 |
# parameter search
|
124 |
if PARALLEL:
|
@@ -153,7 +153,7 @@ def main():
|
|
153 |
# evaluation
|
154 |
model = AutoModelForSequenceClassification.from_pretrained(
|
155 |
best_model_path,
|
156 |
-
num_labels=len(
|
157 |
local_files_only=not network)
|
158 |
trainer = Trainer(
|
159 |
model=model,
|
@@ -166,7 +166,7 @@ def main():
|
|
166 |
eval_dataset=tokenized_datasets[opt.split_test],
|
167 |
compute_metrics=compute_metric_all,
|
168 |
model_init=lambda x: AutoModelForSequenceClassification.from_pretrained(
|
169 |
-
opt.model, return_dict=True, num_labels=len(
|
170 |
)
|
171 |
summary_file = pj(opt.output_dir, opt.summary_file)
|
172 |
if not opt.skip_eval:
|
|
|
118 |
eval_dataset=tokenized_datasets[opt.split_validation],
|
119 |
compute_metrics=compute_metric_search,
|
120 |
model_init=lambda x: AutoModelForSequenceClassification.from_pretrained(
|
121 |
+
opt.model, return_dict=True, num_labels=len(dataset[opt.split_train]['label'][0]))
|
122 |
)
|
123 |
# parameter search
|
124 |
if PARALLEL:
|
|
|
153 |
# evaluation
|
154 |
model = AutoModelForSequenceClassification.from_pretrained(
|
155 |
best_model_path,
|
156 |
+
num_labels=len(dataset[opt.split_train]['label'][0]),
|
157 |
local_files_only=not network)
|
158 |
trainer = Trainer(
|
159 |
model=model,
|
|
|
166 |
eval_dataset=tokenized_datasets[opt.split_test],
|
167 |
compute_metrics=compute_metric_all,
|
168 |
model_init=lambda x: AutoModelForSequenceClassification.from_pretrained(
|
169 |
+
opt.model, return_dict=True, num_labels=len(dataset[opt.split_train]['label'][0]))
|
170 |
)
|
171 |
summary_file = pj(opt.output_dir, opt.summary_file)
|
172 |
if not opt.skip_eval:
|