Skip to content

Commit

Permalink
Code for main test
Browse files Browse the repository at this point in the history
  • Loading branch information
StephAO committed Apr 23, 2020
1 parent a7aa67e commit 4f5637e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def add_training_args(parser):
'with larger models and sequences')
group.add_argument('--clip-grad', type=float, default=1.0,
help='gradient clipping')
group.add_argument('--epochs', type=int, default=10,
group.add_argument('--epochs', type=int, default=32,
help='upper epoch limit')
group.add_argument('--log-interval', type=int, default=1000000,
help='report interval')
Expand Down
2 changes: 1 addition & 1 deletion bert_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"fp32_embedding": true,
"fp32_tokentypes": false,
"fp16": false,
"num_tasks": 15
"num_tasks": 16
}
4 changes: 2 additions & 2 deletions data_utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def scale(self, vector):
if len(vector) == 0:
return vector
scale = 10
scaling = lambda x: ((scale - 1) * (x - _min) / (_max - _min + 1e-8)) + 1
scaling = lambda x: ((scale) * (x - _min) / (_max - _min + 1e-8))
_min = min(vector)
_max = max(vector)
return [scaling(w) for w in vector]
Expand All @@ -794,7 +794,7 @@ def get_word_labels(self, sent, doc):
if "tf" in self.modes:
labels["tf"] = self.scale(tf)
elif "tf_idf" in self.modes:
labels["tf_idf"] = tf_idf #self.scale(tf_idf)
labels["tf_idf"] = self.scale(tf_idf)

return labels

Expand Down
2 changes: 1 addition & 1 deletion pretrain_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def setup_model_and_optimizer(args, tokenizer):
optimizer = get_optimizer(model, args)
lr_scheduler = get_learning_rate_scheduler(optimizer, args)
criterion_cls = torch.nn.CrossEntropyLoss(reduce=False, ignore_index=-1)
criterion_reg = torch.nn.L1Loss(reduce=False)
criterion_reg = torch.nn.MSELoss(reduce=False)

criterion = (criterion_cls, criterion_reg)

Expand Down

0 comments on commit 4f5637e

Please sign in to comment.