コード例 #1
0
def write_as_tfrecord(train_data, test_data, vocab2id):
    '''convert the raw data to TFRecord format and write to disk
  '''
    util.write_as_tfrecord(train_data, vocab2id, FLAGS.semeval_train_record,
                           FLAGS.semeval_max_len, _build_sequence_example)
    util.write_as_tfrecord(test_data, vocab2id, FLAGS.semeval_test_record,
                           FLAGS.semeval_max_len, _build_sequence_example)

    util._shuf_and_write(FLAGS.semeval_train_record)
コード例 #2
0
ファイル: fudan.py プロジェクト: johndpope/advrelation
def write_as_tfrecord(train_data, test_data, vocab2id):
    '''convert the raw data to TFRecord format and write to disk
  '''
    train_record_file = os.path.join(OUT_DIR, 'fudan.train.tfrecord')
    test_record_file = os.path.join(OUT_DIR, 'fudan.test.tfrecord')

    util.write_as_tfrecord(train_data, vocab2id, train_record_file, MAX_LEN,
                           _build_sequence_example)
    util.write_as_tfrecord(test_data, vocab2id, test_record_file, MAX_LEN,
                           _build_sequence_example)

    util._shuf_and_write(train_record_file)
コード例 #3
0
def write_as_tfrecord(train_data, test_data, vocab2id):
  '''convert the raw data to TFRecord format and write to disk
  '''
  util.write_as_tfrecord(train_data, 
                         vocab2id, 
                         DBPEDIA_TRAIN_RECORD, 
                         _map_tokens_and_pad, 
                         _build_sequence_example)
  util.write_as_tfrecord(test_data, 
                         vocab2id, 
                         DBPEDIA_TEST_RECORD, 
                         _map_tokens_and_pad, 
                         _build_sequence_example)

  util.shuf_and_write(DBPEDIA_TRAIN_RECORD)
コード例 #4
0
def write_as_tfrecord(train_data, test_data, task_id, vocab2id):
    '''convert the raw data to TFRecord format and write to disk
    '''
    dataset = DATASETS[task_id]
    train_record_file = os.path.join(data_dir(), dataset + '.train.tfrecord')
    test_record_file = os.path.join(data_dir(), dataset + '.test.tfrecord')

    util.write_as_tfrecord(train_data,
                           vocab2id,
                           train_record_file,
                           MAX_LEN,
                           _build_sequence_example)
    util.write_as_tfrecord(test_data,
                           vocab2id,
                           test_record_file,
                           MAX_LEN,
                           _build_sequence_example)

    util._shuf_and_write(train_record_file)