Skip to main content

Big data data processing for tar archives.

Project description

Test TestPip DeepSource

The Tarproc Utilities

Tarfiles are commonly used for storing large amounts of data in an efficient, sequential access, compressed file format, in particualr for deep learning applications. For processing and data transformation, people usually unpack them, operate over the files, and tar up the result again.

This library and set of utilities permits operating directly on tar files. This is faster than operating on files on file systems, and it is usually easier too.

  • tarcats -- concatenate tar files sequentially
  • tarsplit -- split a tar file by number of records or size
  • tarpcat -- concatenate tar files in parallel
  • tarproc -- map command line programs over tar files
  • tarshow -- show contents of tar files
  • tarsort -- sort tar files based on some key

The following are less commonly used utilities that are specifically useful for deep learning:

  • tarfirst -- extract the first file matching some criteria
  • targrep -- grep through files inside tar files (this will replace tarfirst)
  • tar2db, tar2lmdb, tar2tsv -- convert tar files to database files
  • tarmix -- mix tar files based on statistical sampling
  • tsv2tar -- build tar files based on a .tsv file plan

The utilities allow operating on stdin/stdout when necessary, allowing command line pipes to be constructed. For example:

    $ gsutil cat gs://bucket/file.tar | tarsort | tarsplit -o output

Python Interface

from tarproclib import reader, gopen
from itertools import islice

gopen.handlers["gs"] = "gsutil cat '{}'"

for sample in islice(reader.TarIterator("gs://lpr-imagenet/imagenet_train-0000.tgz"), 0, 10):
    print(sample.keys())
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])
dict_keys(['__key__', 'cls', 'jpg', 'json', '__source__'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tarproc-0.0.6.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tarproc-0.0.6-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file tarproc-0.0.6.tar.gz.

File metadata

  • Download URL: tarproc-0.0.6.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for tarproc-0.0.6.tar.gz
Algorithm Hash digest
SHA256 36b9f0c1a0c4fec6dfe390a59a2b829de115ddbd2691f1919527ea8f9a95cb16
MD5 ecb5e623e76f9735ee0d418beb0e775e
BLAKE2b-256 eff7975a3cdddce36492dd62f7b8793a816175678710258e396c038da7403acb

See more details on using hashes here.

File details

Details for the file tarproc-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: tarproc-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for tarproc-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f6999ec437cfcfb7d536c097b5b6efd42722dffa218bdf35d9b57a5115c4cbd4
MD5 cb5c7e14495cdd023edf2f31b043c3c2
BLAKE2b-256 b1c746318882d5b845c3e0be513447d9b708782619fbee2c0910e0b4fab201d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page