diff --git a/paddlehub/dataset/dataset.py b/paddlehub/dataset/dataset.py index aefd698ed891548bd0588f906bf83a185fc7931e..2b1577cfb406b9cd40c50ec539cbba8d942eac53 100644 --- a/paddlehub/dataset/dataset.py +++ b/paddlehub/dataset/dataset.py @@ -13,31 +13,6 @@ # limitations under the License. -class InputExample(object): - """ - Input data structure of BERT/ERNIE, can satisfy single sequence task like - text classification, sequence lableing; Sequence pair task like dialog - task. - """ - - def __init__(self, guid, text_a, text_b=None, label=None): - """Constructs a InputExample. - - Args: - guid: Unique id for the example. - text_a: string. The untokenized text of the first sequence. For single - sequence tasks, only this sequence must be specified. - text_b: (Optional) string. The untokenized text of the second sequence. - Only must be specified for sequence pair tasks. - label: (Optional) string. The label of the example. This should be - specified for train and dev examples, but not for test examples. - """ - self.guid = guid - self.text_a = text_a - self.text_b = text_b - self.label = label - - class HubDataset(object): def get_train_examples(self): raise NotImplementedError() diff --git a/paddlehub/finetune/task.py b/paddlehub/finetune/task.py index db2a4b32a2298fb24e4c7421129ce1693265fb08..a6dd964b25fa236fad2874a73bc96167eb628999 100644 --- a/paddlehub/finetune/task.py +++ b/paddlehub/finetune/task.py @@ -109,8 +109,15 @@ def create_img_classification_task(feature, num_classes, hidden_units=None): """ - Append a multi-layer perceptron classifier for binary classification base - on input feature + Create the transfer learning task for image classification. + Args: + feature: + + Return: + Task + + Raise: + None """ cls_feats = feature # append fully connected layer according to hidden_units diff --git a/paddlehub/reader/nlp_reader.py b/paddlehub/reader/nlp_reader.py index abed54c0bc70486e7c666ab70f09ef755cfa645f..1e0ae39f50132c36e572ff2d0771b453e6ff43fe 100644 --- a/paddlehub/reader/nlp_reader.py +++ b/paddlehub/reader/nlp_reader.py @@ -52,12 +52,6 @@ class BaseReader(object): self.current_epoch = 0 self.num_examples = 0 - # if label_map_config: - # with open(label_map_config) as f: - # self.label_map = json.load(f) - # else: - # self.label_map = None - self.num_examples = {'train': -1, 'dev': -1, 'test': -1} def get_train_examples(self): @@ -164,20 +158,6 @@ class BaseReader(object): else: label_id = example.label - # Record = namedtuple( - # 'Record', - # ['token_ids', 'text_type_ids', 'position_ids', 'label_id', 'qid']) - - # qid = None - # if "qid" in example._fields: - # qid = example.qid - - # record = Record( - # token_ids=token_ids, - # text_type_ids=text_type_ids, - # position_ids=position_ids, - # label_id=label_id, - # qid=qid) Record = namedtuple( 'Record', ['token_ids', 'text_type_ids', 'position_ids', 'label_id']) @@ -211,10 +191,6 @@ class BaseReader(object): if batch_records: yield self._pad_batch_records(batch_records) - # def get_num_examples(self, input_file): - # examples = self._read_tsv(input_file) - # return len(examples) - def get_num_examples(self, phase): """Get number of examples for train, dev or test.""" if phase not in ['train', 'val', 'dev', 'test']: