You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 28, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 28, 2025. It is now read-only.
I am not 100% sure how reading compressed input is implemented in TensorFlow, but supporting outputting compressed TFRecord files would be amazing, as TFRecord is a rather inefficient format in terms of space.
Here are a few references to reading GZIP'd TF Records in the TensorFlow docs:
I have similar needs . saving the spark data frame output compressed files in TFR format . I tried using df.write.format("tensorflow").option("codec","org.apache.hadoop.io.compress.GzipCodec"), but looks like this is being ignored as of now.
Reacted by Erik @ MileIQ, nrothGIT, Zhuo Tao, Kevin Baumgarten, DecKen, null, Zohar Komarovsky, Alex Egg, alionkun and Wangzhe
@unitive-jim im intrigued to see tensorflow using gzip for ftrecords i wonder if using CStringIO for flask files is nesary or does tensorflow servbles handle file uploads like this? in memory compreshion this post came to mind when I decided to prep for many large file uploads to a server with 16gb ram and a i7700
Activity
unitive-jim commentedon Jan 4, 2018
Compression is working fine. Here are some snippets that might help anyone looking for examples:
To create a record writer using GZIP compression:
To create a TFRecordDataset to read the compressed files:
aht commentedon Jan 30, 2018
Thanks @unitive-jim, the example you gave I believe is local writes only. Is there an example of writing compressed TFRecords output via Spark?
rkbansal83 commentedon Feb 6, 2018
I have similar needs . saving the spark data frame output compressed files in TFR format . I tried using
df.write.format("tensorflow").option("codec","org.apache.hadoop.io.compress.GzipCodec"), but looks like this is being ignored as of now.fenderrex commentedon Aug 24, 2018
@unitive-jim im intrigued to see tensorflow using gzip for ftrecords i wonder if using CStringIO for flask files is nesary or does tensorflow servbles handle file uploads like this?
in memory compreshion this post came to mind when I decided to prep for many large file uploads to a server with 16gb ram and a i7700
fenderrex commentedon Aug 24, 2018
so flask to bitIO to Gzip seems feasible?
Flask request file to bitIO
bitIO to Gzip
then
tf.python_io.TFRecordReader()but what I want to know is how to pass a bitIO or gzip object to a tfrecord directly so I don't put wear on my SSD or raid.
bigbear2017 commentedon Nov 30, 2018
this has been fixed in this PR:
#108
fhoering commentedon Mar 14, 2019
I tested PR #108. I works with minor changes.
It would be cool to merge it.
As it is closed I can also create a new PR request if needed.
jeisinge commentedon Mar 25, 2019
Does PR #108 support Spark's
.option()API?fhoering commentedon Mar 26, 2019
From reading the code you need to provide those options to the spark context.
So they will apply to the whole spark job.
If it is possible (not sure it is) it would be another commit inside spark tf connector to pass the option to TFRecordFileOutputFormat
vgod-dbx commentedon May 9, 2019
FYI. This's fixed as I added a codec option in the Spark-Tensorflow connector. See 12d65f2
bravecharge commentedon Jun 30, 2020
use option("codec", "org.apache.hadoop.io.compress.GzipCodec") instead option("compression", "gzip") with spark-tensorflow-connector 1.15 version