From 8b17fd37fda4da205bd563e2f00508ce04c0be97 Mon Sep 17 00:00:00 2001 From: Jamal Date: Wed, 4 Oct 2023 10:00:19 -0600 Subject: [PATCH] Fix missing keywords, device errors. --- Pilot3/P3B6/p3b6.py | 7 +++++++ Pilot3/P3B7/p3b7.py | 8 ++++++++ Pilot3/P3B8/default_model.txt | 2 +- Pilot3/P3B8/p3b8.py | 8 +++++++- Pilot3/P3B8/p3b8_baseline_pytorch.py | 4 ++-- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Pilot3/P3B6/p3b6.py b/Pilot3/P3B6/p3b6.py index 4bc52c6c..c9bda47f 100644 --- a/Pilot3/P3B6/p3b6.py +++ b/Pilot3/P3B6/p3b6.py @@ -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 = [ diff --git a/Pilot3/P3B7/p3b7.py b/Pilot3/P3B7/p3b7.py index f0658d77..51dd7dad 100644 --- a/Pilot3/P3B7/p3b7.py +++ b/Pilot3/P3B7/p3b7.py @@ -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 = [ diff --git a/Pilot3/P3B8/default_model.txt b/Pilot3/P3B8/default_model.txt index b96f696b..0470bb50 100644 --- a/Pilot3/P3B8/default_model.txt +++ b/Pilot3/P3B8/default_model.txt @@ -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 diff --git a/Pilot3/P3B8/p3b8.py b/Pilot3/P3B8/p3b8.py index 2faebcd7..d2472104 100644 --- a/Pilot3/P3B8/p3b8.py +++ b/Pilot3/P3B8/p3b8.py @@ -10,6 +10,12 @@ {"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 = [ @@ -17,7 +23,7 @@ "weight_decay", "rng_seed", "batch_size", - "num_epochs", + "epochs", ] diff --git a/Pilot3/P3B8/p3b8_baseline_pytorch.py b/Pilot3/P3B8/p3b8_baseline_pytorch.py index 45f24bd5..647b3e42 100644 --- a/Pilot3/P3B8/p3b8_baseline_pytorch.py +++ b/Pilot3/P3B8/p3b8_baseline_pytorch.py @@ -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) @@ -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)