rustfrecord
The TFRecord format is a simple format for storing a sequence of binary records.
This package implements a high-performance reader for Example records stored in TFRecord files.
Examples are loaded into native PyTorch Tensors.
Installation
The wheel can be installed on any Linux system with Python 3.8 or higher:
pip3 install rustfrecord
Getting Started
The Reader class reads TFRecord files and yields Dict[str, Tensor] objects.
import torch
from torch import Tensor
from rustfrecord import Reader
filename = "data/002scattered.training_examples.tfrecord.gz"
r = Reader(filename, compressed=True)
for i, features in enumerate(r):
print(features.keys())
# ['variant_type', 'image/encoded', 'image/shape',
# 'variant/encoded', 'label', 'alt_allele_indices/encoded',
# 'locus', 'sequencing_type']
label: Tensor = features['label']
shape = torch.Size(tuple(features['image/shape']))
image: Tensor = features['image/encoded'][0].reshape(shape)
print(i, label, image.shape)
Development
To develop this package (not just use it), you need to install the Rust compiler and the Python development headers.
pip install uv
uv venv
source .venv/bin/activate
uv pip compile pyproject.toml -o requirements.txt
uv pip install -r requirements.txt
export LIBTORCH_USE_PYTORCH=1
CARGO_TARGET_DIR=target_maturin maturin develop
python main.py
Metadata
Release files for rustfrecord 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rustfrecord-0.1.7.tar.gz | 16.4 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
Total release size: 666.8 kB
Release files / rustfrecord-0.1.7.tar.gz
| Download URL | rustfrecord-0.1.7.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b4440a8af1f1c0996feca8dfb8b2d06f8030eba998a59de86f57641bcb35fb4
|
|
BLAKE2b-256 checksum How to use checksums |
64dcd1eb37cff911709b9d57da592a9631b3ef29fa32bcefe78ab5729d66179a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 338.8 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
497cc098c48844a09c9923be0df7faa5126bdce5c3bc2206b8173cf99ff4c634
|
|
BLAKE2b-256 checksum How to use checksums |
f008d4cc9f7f7c3737b9fcb4827c556cb62b0190a2ddb31b6cf8fc301583baa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | rustfrecord-0.1.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 311.5 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
14e9b5f3493045fcb6e82913f0e7a4033d1e38f37919ca0713c1147eca46f276
|
|
BLAKE2b-256 checksum How to use checksums |
cdd3cb2b0b760a3ab0fe347c7dcf8c26e5d540eb5f1df88a8570c6f610c14ae5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.5.1
|