Skip to content

Commit

Permalink
fix from_config
Browse files Browse the repository at this point in the history
  • Loading branch information
king-menin committed Jan 19, 2019
1 parent 60a5bf7 commit 040c9f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/data/bert_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ def __init__(self, train_path, valid_path, vocab_file, data_type,
self.is_cls = True
self.id2cls = sorted(cls2idx.keys(), key=lambda x: cls2idx[x])

# TODO: write docs
@classmethod
def from_config(cls, config):
def from_config(cls, config, for_train=True):
if config["data_type"] == "bert_cased":
do_lower_case = False
fn = get_bert_data_loaders
Expand All @@ -348,7 +349,7 @@ def from_config(cls, config):
fn = get_bert_data_loaders
else:
raise NotImplementedError("No requested mode :(.")
if config["train_path"] and config["valid_path"]:
if config["train_path"] and config["valid_path"] and for_train:
fn_res = fn(config["train_path"], config["valid_path"], config["vocab_file"], config["batch_size"],
config["cuda"], config["is_cls"], do_lower_case, config["max_seq_len"], config["is_meta"],
label2idx=config["label2idx"], cls2idx=config["cls2idx"])
Expand Down

0 comments on commit 040c9f2

Please sign in to comment.