-
Notifications
You must be signed in to change notification settings - Fork 74k
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
SummaryWriter writes constants with the graph definition #1444
Comments
I'd also like to point out that this makes it impossible to visualize the graph in tensorboard, since it just hangs parsing the constants in the graph def. |
Constants are part of the
to
Ug, actually that'll implicitly create a constant too. @petewarden: What's the right solution here? |
The same question came up on StackOverflow today: http://stackoverflow.com/a/35904439/3574081 (FWIW: |
To answer what I think is the original question, it's definitely possible to strip out Constant ops from a graph def. We do the opposite in the freeze_graph script, so we could create a 'strip_graph' script or similar to slim down files by replacing large constants with something smaller (though we'd have to do some resize tricks to do it properly). I think the bigger question is 'Why are there these big weights in my graph def file?'. We're working on answering that here by looking at different ways that we can save external weights, without using the Variable/Restore checkpoints since those are fairly specialized for training. We don't have a good design for that yet though. Does that help at all? |
@mrry: That solves the code shown, but I believe the original code loads a big numpy array from a file. |
@mrry's suggestion works perfectly as a work-around for my large numpy array (I'm responsible for the stackoverflow question as well) and I'm able to use Tensorboard's graph visualization again. @petewarden - FWIW, I never use the Saver to persist the entire session. I'm always cherrypicking variables so that I can deploy just the model to other machines for inference or train on a different dataset. So any help with managing training state vs. learned model state would be great. |
@vgatto I'd also like to point out that this makes it impossible to visualize the graph in tensorboard, since it just hangs parsing the constants in the graph def. Can you explain why and how can I display the graph? |
Closing this as intended behavior. @toma5692 and others: If you want to keep graphs small, use |
Switching Dockerfile.rocm to use python3.9
It looks like SummaryWriter includes the values of constants when writing the graph definition. I'm currently loading word embeddings using python and using the numpy array to initialize a variable. This results in the ~300M of embeddings to be dumped to disk during summarization. I understand why a constant would be part of the model graph if the goal was to save and restore the graph, but I don't believe this is the goal of the SummaryWriter. Is it possible to strip these out to save disk space?
Here's a trivial example. If the declaration of
random_b
is removed, the resulting summary is ~4.6K, but with it, it's about 7.6M.The text was updated successfully, but these errors were encountered: