Spaces:
Runtime error
Runtime error
MelikeDulkadir
commited on
Commit
•
426e741
1
Parent(s):
f4731d9
Update app.py
Browse files
app.py
CHANGED
@@ -22,4 +22,24 @@ from transformers import DataCollatorWithPadding
|
|
22 |
data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
|
23 |
|
24 |
from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer
|
25 |
-
model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased", num_labels=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
|
23 |
|
24 |
from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer
|
25 |
+
model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased", num_labels=2)
|
26 |
+
|
27 |
+
training_args = TrainingArguments(
|
28 |
+
output_dir="./results",
|
29 |
+
learning_rate=2e-5,
|
30 |
+
per_device_train_batch_size=16,
|
31 |
+
per_device_eval_batch_size=16,
|
32 |
+
num_train_epochs=5,
|
33 |
+
weight_decay=0.01,
|
34 |
+
)
|
35 |
+
|
36 |
+
trainer = Trainer(
|
37 |
+
model=model,
|
38 |
+
args=training_args,
|
39 |
+
train_dataset=tokenized_imdb["train"],
|
40 |
+
eval_dataset=tokenized_imdb["test"],
|
41 |
+
tokenizer=tokenizer,
|
42 |
+
data_collator=data_collator,
|
43 |
+
)
|
44 |
+
|
45 |
+
trainer.train()
|