-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
39 lines (31 loc) · 772 Bytes
/
example.py
File metadata and controls
39 lines (31 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from itrain import DatasetArguments, ModelArguments, RunArguments, Setup
# Create a new training setup
setup = Setup()
# Set up dataset
setup.dataset(DatasetArguments(
dataset_name="glue",
task_name="rte",
max_seq_length=290,
))
# Set up a model for adapter training
setup.model(ModelArguments(
model_name_or_path="roberta-base",
use_fast_tokenizer=True,
train_adapter=True,
adapter_config="pfeiffer",
))
# Set up training
setup.training(RunArguments(
learning_rate=1e-4,
batch_size=32,
num_train_epochs=15,
patience=4,
patience_metric="eval_accuracy"
))
# Run evaluation after training
setup.evaluation()
# Set up training notifications
setup.notify("telegram")
# Run the setup
results = setup.run()
print(results)