Registry / data / tfrecord-lite

tfrecord-lite

JSON →
library0.0.8pypypi✓ verified 88d ago

A lightweight tfrecord parser that reads TensorFlow TFRecord files without requiring TensorFlow. Version 0.0.8 supports Python >=3.6 and provides both low-level reading and higher-level dataset creation.

pip install tfrecord-lite
INSTALL
IMPORT
SIG · TFRECORD-LITE
T
tfrecord-lite
datapythonv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TFRecordLoader
✓ from tfrecord_lite import decode_example
TFRecordWriter
✓ from tfrecord_lite import TFRecordWriter
✗ from tfrecord import TFRecordWriter
Common mistake: package is tfrecord-lite, not tfrecord
TFRecordIterator
✓ from tfrecord_lite import tf_record_iterator
✗ from tfrecord_lite.iterator import tf_record_iterator
The iterator is a top-level function, not a submodule

Basic read/write operations using tfrecord-lite.

import tfrecord_lite # Write a TFRecord file writer = tfrecord_lite.TFRecordWriter('example.tfrecord') writer.write(b'Hello, world!') writer.close() # Read back with iterator for record in tfrecord_lite.tf_record_iterator('example.tfrecord'): print(record) # b'Hello, world!' # Decode TFRecord with TensorFlow proto (requires numpy) from tfrecord_lite import decode_example # Assuming you have an Example proto bytes # example_bytes = ... # result = decode_example(example_bytes) # returns dict of numpy arrays
Debug
Known issues
gotchaTFRecordWriter.write expects bytes, not str. If you pass a string, it will fail with TypeError.
fix
Encode strings to bytes: writer.write('text'.encode())
affects: all
gotchatf_record_iterator yields raw bytes records. It does NOT decode TensorFlow Example protos automatically.
fix
Use decode_example from tfrecord_lite to parse Example protos.
affects: all
deprecatedThere is no deprecated API in current version. However, note that TFRecordLoader is no longer present in recent versions; it was renamed to decode_example.
fix
Use decode_example instead of TFRecordLoader.
affects: >=0.0.7
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tensorflow'
You are trying to import tfrecord_lite.data.TFRecordDataset which requires TensorFlow.
fix
Install TensorFlow: pip install tensorflow, or avoid using TFRecordDataset and use tf_record_iterator instead.
TypeError: a bytes-like object is required, not 'str'
You passed a string to TFRecordWriter.write() instead of bytes.
fix
Encode string: writer.write('data'.encode())
Upgrade
Version history
0.0.8latest on PyPI · released Jun 3, 2023
Audit
Dependencies
numpyrequiredRequired for decoding TensorFlow protos (e.g., Int64List, FloatList)
tensorflowoptionalOptional, only if you want to use tfrecord_lite.data.TFRecordDataset (uses tf.data)
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
tfrecord-lite — pip install tfrecord-lite · libregistry