tensorflow / tensorflow/datasets

Support for mirroring datasets for use without an internet connection

Open
#3,125 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.

For compliance and security reasons training and experimentation may be done in environments without access to the internet. While datasets provides a local cache it's not clear or documented how you would utilize an internal mirror or proxy for many distributed clients.

An internal mirror also helps prevent against transient network issues, improves performance and reduces network load on external services when using stateless machines that will have an empty cache on startup.

Describe the solution you'd like

I'd like to be able to export an environment variable like TFDS_MIRROR=s3://some-bucket/some-prefix/ and have tfds use that to fetch all files and make no network requests. A separate process can populate the mirror from a trusted environment with internet access. A simple key structure including the sha256 hash of the URL mapping to the data would be sufficient:

def download(url):
    mirror_prefix = os.environ['TFDS_MIRROR']
    url_hash = sha256(url)
    try:
        return download_from(f'{mirror_prefix}/{url_hash}')
    except NotFound:
        print(f'URL {url} not reachable')

Describe alternatives you've considered

You could mount a shared distributed filesystem on $TFDS_CACHE_DIR, but tfds will still try and make network requests. Other machines might write to this location during runtime and the performance would not be optimal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing TFDS's download and local-cache behavior, using the proposed TFDS_MIRROR and existing TFDS_CACHE_DIR as the entry points; the issue does not identify source files or tests. Define the mirror key and no-network behavior, then verify that distributed clients can fetch required files from the mirror and report missing objects clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
data, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.