SantoshGupta7
SantoshGupta7

Reputation: 6197

Most space/memory efficient way to save Tensorflow model for prediction only?

I have a huge Tensorflow model (the checkpoint file is 4-5 gbs). I was wondering if there's a different way to save Tensorflow models, besides the checkpoint way, that is space/memory efficient.

I know that a checkpoint file also saves all the optimizer gradients, so maybe those can be cut out too.

My model is very simple, just two matrices of embeddings, perhaps I can only save those matrices to .npy directly?

Upvotes: 1

Views: 341

Answers (1)

bappak
bappak

Reputation: 1044

What you want to do with the checkpoint is to freeze it. Check out this page from tensorflow's official documentation.

The freezing process strips off all extraneous information from the checkpoint that isn't used for forward inference. Tensorflow provides an easy to use script for it called freeze_graph.py.

Upvotes: 1

Related Questions