Exemplo n.º 1
0
 def load_tfrecord(cls, tfrecord_file, batch_size=128, index=None, shard=None):
     from qiznlp.common.tfrecord_utils import tfrecord2dataset
     if not os.path.exists(tfrecord_file):
         return None, None
     feat_dct = {
         's1': tf.VarLenFeature(tf.int64),
         'target': tf.FixedLenFeature([], tf.int64),
     }
     dataset, count = tfrecord2dataset(tfrecord_file, feat_dct, batch_size=batch_size, auto_pad=True, index=index, shard=shard)
     return dataset, count
Exemplo n.º 2
0
 def load_tfrecord(cls, tfrecord_file, batch_size=128, index=None, shard=None):
     from qiznlp.common.tfrecord_utils import tfrecord2dataset
     if not os.path.exists(tfrecord_file):
         return None, None
     feat_dct = {
         'multi_s1': tf.VarLenFeature(tf.int64),
         's2': tf.VarLenFeature(tf.int64),
     }
     shape_dct = {
         'multi_s1': [conf.max_turn, -1],
     }
     dataset, count = tfrecord2dataset(tfrecord_file, feat_dct, shape_dct=shape_dct, batch_size=batch_size, auto_pad=True, index=index, shard=shard)
     return dataset, count