Ejemplo n.º 1
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'input_ids':
         utils.get_placeholder(target, 'input_ids',
                               [None, self.max_seq_length], tf.int32),
         'input_mask':
         utils.get_placeholder(target, 'input_mask',
                               [None, self.max_seq_length], tf.int32),
         'segment_ids':
         utils.get_placeholder(target, 'segment_ids',
                               [None, self.max_seq_length], tf.int32),
         'label_ids':
         utils.get_placeholder(target, 'label_ids', [None], tf.int32),
     }
     if kwargs.get('is_training'):
         self.placeholders['aug_input_ids'] = utils.get_placeholder(
             target, 'aug_input_ids', [None, self.max_seq_length], tf.int32)
         self.placeholders['aug_input_mask'] = utils.get_placeholder(
             target, 'aug_input_mask', [None, self.max_seq_length],
             tf.int32)
         self.placeholders['aug_segment_ids'] = utils.get_placeholder(
             target, 'aug_segment_ids', [None, self.max_seq_length],
             tf.int32)
         self.placeholders['is_supervised'] = utils.get_placeholder(
             target, 'is_supervised', [None], tf.float32)
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 2
0
 def _set_placeholders(self, target, on_export=False):
     self.placeholders = {
         'input_ids':
         utils.get_placeholder(target, 'input_ids',
                               [None, self.max_seq_length], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 3
0
 def _set_placeholders(self, target, on_export=False):
     self.placeholders = {
         'input_ids':
         utils.get_placeholder(target, 'input_ids',
                               [None, self.max_seq_length], tf.int32),
         'input_mask':
         utils.get_placeholder(target, 'input_mask',
                               [None, self.max_seq_length], tf.int32),
         'segment_ids':
         utils.get_placeholder(target, 'segment_ids',
                               [None, self.max_seq_length], tf.int32),
         'masked_lm_positions':
         utils.get_placeholder(target, 'masked_lm_positions',
                               [None, self._max_predictions_per_seq],
                               tf.int32),
         'masked_lm_ids':
         utils.get_placeholder(target, 'masked_lm_ids',
                               [None, self._max_predictions_per_seq],
                               tf.int32),
         'masked_lm_weights':
         utils.get_placeholder(target, 'masked_lm_weights',
                               [None, self._max_predictions_per_seq],
                               tf.float32),
         'sentence_order_labels':
         utils.get_placeholder(target, 'sentence_order_labels', [None],
                               tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 4
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'dilated_ids':
         utils.get_placeholder(target, 'dilated_ids',
                               [None, self.max_seq_length * 2], tf.int32),
         'label_ids':
         utils.get_placeholder(target, 'label_ids',
                               [None, self.max_seq_length * 2], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 5
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'source_ids':
         utils.get_placeholder(target, 'source_ids',
                               [None, self.source_max_seq_length],
                               tf.int32),
         'target_ids':
         utils.get_placeholder(target, 'target_ids',
                               [None, self.target_max_seq_length],
                               tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 6
0
 def _set_placeholders(self, target, on_export=False):
     self.placeholders = {
         'input_ids': utils.get_placeholder(
             target, 'input_ids',
             [None, self.max_seq_length], tf.int32),
         'input_mask': utils.get_placeholder(
             target, 'input_mask',
             [None, self.max_seq_length], tf.int32),
         'query_mask': utils.get_placeholder(
             target, 'query_mask',
             [None, self.max_seq_length], tf.int32),
         'segment_ids': utils.get_placeholder(
             target, 'segment_ids',
             [None, self.max_seq_length], tf.int32),
         'label_ids': utils.get_placeholder(
             target, 'label_ids',
             [None, 2], tf.int32),
         'has_answer': utils.get_placeholder(
             target, 'has_answer',
             [None], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = utils.get_placeholder(
             target, 'sample_weight',
             [None], tf.float32)
Ejemplo n.º 7
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'input_ids': utils.get_placeholder(
             target, 'input_ids',
             [None, self.max_seq_length], tf.int32),
         'input_mask': utils.get_placeholder(
             target, 'input_mask',
             [None, self.max_seq_length], tf.int32),
         'segment_ids': utils.get_placeholder(
             target, 'segment_ids',
             [None, self.max_seq_length], tf.int32),
         'n_wide_features': utils.get_placeholder(
             target, 'n_wide_features',
             [None], tf.int32),
         'wide_features': utils.get_placeholder(
             target, 'wide_features',
             [None, len(self.wide_features)], tf.int32),
         'label_ids': utils.get_placeholder(
             target, 'label_ids', [None], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 8
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'input_values':
         utils.get_placeholder(
             target, 'input_values',
             [None, self.max_seq_length - 1, self.max_unit_length],
             tf.float32),
         'input_mask':
         utils.get_placeholder(target, 'input_mask',
                               [None, self.max_seq_length], tf.int32),
         'label_ids':
         utils.get_placeholder(target, 'label_ids', [None], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)
Ejemplo n.º 9
0
 def _set_placeholders(self, target, on_export=False, **kwargs):
     self.placeholders = {
         'input':
         utils.get_placeholder(target, 'input', [None, self.max_seq_length],
                               tf.int32),
         'target':
         utils.get_placeholder(target, 'target',
                               [None, self.max_seq_length], tf.int32),
         'seg_id':
         utils.get_placeholder(target, 'seg_id',
                               [None, self.max_seq_length], tf.int32),
         'label':
         utils.get_placeholder(target, 'label', [None], tf.int32),
         'is_masked':
         utils.get_placeholder(target, 'is_masked',
                               [None, self.max_seq_length], tf.int32),
     }
     if not on_export:
         self.placeholders['sample_weight'] = \
             utils.get_placeholder(
                 target, 'sample_weight',
                 [None], tf.float32)