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

move to datasets API #65

Open
beckermr opened this issue Nov 5, 2017 · 12 comments
Open

move to datasets API #65

beckermr opened this issue Nov 5, 2017 · 12 comments
Assignees

Comments

@beckermr
Copy link
Contributor

beckermr commented Nov 5, 2017

The latest TF versions recommend feeding data via the Datasets API (https://www.tensorflow.org/programmers_guide/datasets) and claim it is more efficient. We should probs do some testing and switch if it is warranted.

@gdj0nes gdj0nes self-assigned this Dec 3, 2017
@gdj0nes
Copy link

gdj0nes commented Dec 3, 2017

I think we may need to change the place where self.input_targets_ is defined in order to use the dataset API

@beckermr
Copy link
Contributor Author

beckermr commented Dec 3, 2017

Mmmmk. Make a PR and we can work on it.

@beckermr
Copy link
Contributor Author

I finally did some benchmarking here. For smallish batches sizes, we will see ~20% percent performance improvements. At large batch sizes this API is actually slower from what I can tell.

@gdj0nes
Copy link

gdj0nes commented Dec 25, 2017 via email

@beckermr
Copy link
Contributor Author

Yep just a CPU.

I don’t follow your logic here. How does tensorflow deal with memory management and transfers from the cpu to the gpu using the datasets api?

Why would large batch sizes not compete for ram on a gpu? The data still has to be moved to the gpu before it can be used.

@beckermr
Copy link
Contributor Author

I did some reading. The dataset API currently runs only on the CPU. Apparently people use it to help stage data onto the gpu efficiently while the gpu is executing other operations.

I looked into one version of staging before and found minimal gains. Hopefully this API will do that better but I don’t have GPU access to test it out right now.

@gdj0nes
Copy link

gdj0nes commented Dec 25, 2017 via email

@beckermr
Copy link
Contributor Author

I just set the prefetched amount to 10x the batch size. Usually unless the code is doing a lot of memory allocation, competition for memory is not a problem on a cpu. If it did run out of memory, it would write to swap and the code would slow down by orders of magnitude, which is not what I saw.

@beckermr
Copy link
Contributor Author

I can check tensorboard at some point but TBH I am not sure it is worth it right now.

@beckermr
Copy link
Contributor Author

Also to clarify, this test was for data already in memory as opposed to commming off of disk.

@gdj0nes
Copy link

gdj0nes commented Jan 26, 2018

There seems to be an update an tf 1.5, soon to be released. However there appears to be a work around in 1.4. I'll experiment sometime in the next week with implementation.

@beckermr
Copy link
Contributor Author

Looks like tf 1.5 now supports sparse tensors in the dataset api. This could make implementing this easier.

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