Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#51 from xyzhou-puck/master
Browse files Browse the repository at this point in the history
fix bugs
  • Loading branch information
xyzhou-puck authored Apr 21, 2020
2 parents 7dcbcc9 + 14c2d97 commit 4e92b27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/bert/bert_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def mnli_line_processor(line_id, line):
batch_size=config.batch_size,
line_processor=mnli_line_processor)

dev_dataloader = BertDataLoader(
test_dataloader = BertDataLoader(
"./data/glue_data/MNLI/dev_matched.tsv",
tokenizer, ["contradiction", "entailment", "neutral"],
max_seq_length=config.max_seq_len,
Expand Down
2 changes: 1 addition & 1 deletion examples/bert_leveldb/bert_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def mnli_line_processor(line_id, line):
mode="leveldb",
phase="train")

dev_dataloader = BertDataLoader(
test_dataloader = BertDataLoader(
"./data/glue_data/MNLI/dev_matched.tsv",
tokenizer, ["contradiction", "entailment", "neutral"],
max_seq_length=config.max_seq_len,
Expand Down
12 changes: 12 additions & 0 deletions hapi/text/bert/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ def exclude_from_weight_decay(self, name):
return True
return False

def state_dict(self):
return self.optimizer.state_dict()

def set_dict(self, state_dict):
return self.optimizer.set_dict(state_dict)

def get_opti_var_name_list(self):
return self.optimizer.get_opti_var_name_list()

def current_step_lr(self):
return self.optimizer.current_step_lr()

def minimize(self, loss, use_data_parallel=False, model=None):
param_list = dict()

Expand Down

0 comments on commit 4e92b27

Please sign in to comment.