Skip to content

Commit

Permalink
Fix missing keywords, device errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmohdyusof committed Oct 4, 2023
1 parent 8853346 commit 8b17fd3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Pilot3/P3B6/p3b6.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
{"name": "weight_decay", "action": "store", "type": float},
{"name": "grad_clip", "action": "store", "type": int},
{"name": "unrolled", "action": "store", "type": candle.str2bool},
{"name": "device", "action": "store", "type": str},
{"name": "num_train_samples", "action": "store", "type": int},
{"name": "num_valid_samples", "action": "store", "type": int},
{"name": "num_test_samples", "action": "store", "type": int},
{"name": "num_classes", "action": "store", "type": int},
{"name": "eps", "action": "store", "type": float},

]

required = [
Expand Down
8 changes: 8 additions & 0 deletions Pilot3/P3B7/p3b7.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
{"name": "grad_clip", "action": "store", "type": int},
{"name": "unrolled", "action": "store", "type": candle.str2bool},
{"name": "use_synthetic_data", "action": "store", "type": candle.str2bool},
{"name": "eps", "action": "store", "type": float},
{"name": "device", "action": "store", "type": str},
{"name": "embed_dim", "action": "store", "type": int},
{"name": "n_filters", "action": "store", "type": int},
{"name": "kernel1", "action": "store", "type": int},
{"name": "kernel2", "action": "store", "type": int},
{"name": "kernel3", "action": "store", "type": int},

]

required = [
Expand Down
2 changes: 1 addition & 1 deletion Pilot3/P3B8/default_model.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ learning_rate = 2e-5
eps = 1e-8
weight_decay = 0.0
batch_size = 10
num_epochs = 10
epochs = 10
rng_seed = 13
num_train_samples = 10000
num_valid_samples = 10000
Expand Down
8 changes: 7 additions & 1 deletion Pilot3/P3B8/p3b8.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
{"name": "weight_decay", "action": "store", "type": float},
{"name": "grad_clip", "action": "store", "type": int},
{"name": "unrolled", "action": "store", "type": candle.str2bool},
{"name": "device", "action": "store", "type": str},
{"name": "num_train_samples", "action": "store", "type": int},
{"name": "num_valid_samples", "action": "store", "type": int},
{"name": "num_test_samples", "action": "store", "type": int},
{"name": "num_classes", "action": "store", "type": int},
{"name": "eps", "action": "store", "type": float},
]

required = [
"learning_rate",
"weight_decay",
"rng_seed",
"batch_size",
"num_epochs",
"epochs",
]


Expand Down
4 changes: 2 additions & 2 deletions Pilot3/P3B8/p3b8_baseline_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def validate(dataloader, model, args, device, epoch):
for idx, batch in enumerate(dataloader):

input_ids = batch["tokens"].to(device)
labels = batch["label"].to(args.device)
labels = batch["label"].to(device)

output = model(input_ids, labels=labels)

Expand Down Expand Up @@ -137,7 +137,7 @@ def run(args):
optimizer = torch.optim.Adam(params, lr=args.learning_rate, eps=args.eps)
criterion = nn.BCEWithLogitsLoss()

for epoch in range(args.num_epochs):
for epoch in range(args.epochs):
train(train_loader, model, optimizer, criterion, args, epoch)
validate(valid_loader, model, args, args.device, epoch)

Expand Down

0 comments on commit 8b17fd3

Please sign in to comment.