Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of all local possibilities to shuffle and prefetch #1

Open
LukasDrude opened this issue Mar 4, 2019 · 1 comment
Open

Comments

@LukasDrude
Copy link
Member

The current version is a bit opaque in the sense that I do not know how to use .shuffle() in combination with .prefetch() or .map(..., num_workers=10).

Please provide some documentation of best practices.

@boeddeker
Copy link
Member

In general prefer .prefetch() over .map(..., num_workers=10), because it executes the complete input processing in parallel and not only one mapping function.

Since #2 is now merged you can .shuffle() in the beginning and .prefetch() at the end.

Example

ds = lazy_dataset.new(examples)
ds = ds.shuffle(reshuffle=True)
ds = ds.map(mapping_function)
ds = ds.batch(batch_size=4)
ds = ds.map(collate_function)
ds = ds.prefetch(num_workers=4, buffer_size=8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants