-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (40 loc) · 1.11 KB
/
main.py
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
40
41
42
43
44
45
46
47
48
49
from loss import AnswerSpaceLoss
from model import MetaModel
from loader import *
from train import train
if __name__ == "__main__":
data_dir = "./data/AIFB/processed/"
embed_dim = 128
num_epochs = 6
eval_freq = 2
model = MetaModel(
data_dir,
embed_dim,
gcn_layers=3
)
loss_fn = AnswerSpaceLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-5)
train_queries, train_info = get_queries(data_dir, split='train')
val_queries, val_info = get_queries(data_dir, split='val')
train_dataloader = get_dataloader(
train_queries,
batch_size = 50,
shuffle=True,
num_workers=1
)
val_dataloader = get_dataloader(
train_queries,
batch_size = 50,
shuffle=False,
num_workers=1
)
training_report = train(
model=model,
train_dataloader=train_dataloader,
val_dataloader=val_dataloader,
loss_fn=loss_fn,
optimizer=optimizer,
num_epochs=num_epochs,
eval_freq=eval_freq
)
print(training_report)