Created
March 28, 2021 07:46
-
-
Save danyaljj/1a123d3b45cf745eccd88851e7262d3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import t5 | |
import tensorflow as tf | |
import functools | |
ds = tf.data.TextLineDataset("data-path/train.tsv") | |
ds = ds.map(functools.partial(tf.io.decode_csv, | |
record_defaults=["", ""], # expects two columsn | |
field_delim="\t", use_quote_delim=False), | |
num_parallel_calls=tf.data.experimental.AUTOTUNE) | |
iterator = ds.make_one_shot_iterator() | |
next_element = iterator.get_next() | |
with tf.Session() as sess: | |
for i in range(1000000): | |
print((i, x)) | |
x = sess.run(next_element) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment