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

Tensor slice is too large to serialize #4291

Closed
jinhou opened this issue Sep 9, 2016 · 6 comments
Closed

Tensor slice is too large to serialize #4291

jinhou opened this issue Sep 9, 2016 · 6 comments
Labels
stat:awaiting response Status - Awaiting response from author

Comments

@jinhou
Copy link

jinhou commented Sep 9, 2016

Hi,
I met a issue said that "Tensor slice is too large to serialize (conservative estimate: 2268204567 bytes)". And i am wondered that why there is a limitation to prevents the TensorSliceWriter from attempting to serialize variables that are larger than 2GB. How can I to skip this limitation if I want to use a variable large than 2GB?

Thanks
Jinlong

@aselle
Copy link
Contributor

aselle commented Sep 9, 2016

There is a hard limit of 2GB for serializing individual tensors because of the 32bit signed size in protobuf.

See #3766, #2648, etc.
http://stackoverflow.com/questions/34128872/google-protobuf-maximum-size

You need to find a way to break things up into smaller tensors/variables.

@aselle aselle added the stat:awaiting response Status - Awaiting response from author label Sep 9, 2016
@jinhou
Copy link
Author

jinhou commented Sep 10, 2016

@aselle Thanks for your quick response. Are you planning to provide some operations to break big tensors/variables into smaller ones, since it is very easy to exceed 2 GB limitation for some big models.

@aselle
Copy link
Contributor

aselle commented Sep 12, 2016

@concretevitamin can comment further if need be, but the plan is to make tensors be checkpointed in a format that does not use protobufs, sidestepping this limitation.

@aselle aselle closed this as completed Sep 12, 2016
@concretevitamin
Copy link
Contributor

Agreed with @aselle. @jinhou, a quick workaround is to use, for variables, tf.get_variable(..., partitioner=..), and for non-ref tensors, tf.split().

@formidable255
Copy link

@concretevitamin Are you able to provide an example on how to use tf.split(). Currently my code is something like:
dataset = tf.data.Dataset.from_tensor_slices((x,y)).map(parse)
dataset = dataset.shuffle(buffer_size).repeat().batch(batch_size)
return dataset.make_one_shot_iterator().get_next()

@paulzhangh
Copy link

finally, how to solve that problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author
Projects
None yet
Development

No branches or pull requests

5 participants