Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

loading from checkpoint #51

Open
AdrianLsk opened this issue Mar 16, 2017 · 0 comments
Open

loading from checkpoint #51

AdrianLsk opened this issue Mar 16, 2017 · 0 comments

Comments

@AdrianLsk
Copy link

Hi, can you please clarify how to use the saved model files if I want to load the model from a checkpoint?

Here is my code:

# mock input
mock_input = np.ones(input_shape)

# build model
accuracy, cost, inference_input, label_tensor, inferences, train_op = \
    build_network(input_shape, learning_rate, specs, pt.Phase.test)

# set gpu and config options
gpu_options = \
    tf.GPUOptions(allow_growth=True, per_process_gpu_memory_fraction=.9)
config = \
    tf.ConfigProto(allow_soft_placement=True, gpu_options=gpu_options,
                   log_device_placement=True)

# load from checkpoint
model_ckpt = './models/first/-3036.data-00000-of-00001'
runner = pt.train.Runner(initial_checkpoint=model_ckpt)

with tf.Session(config=config), tf.device('/gpu:2'):
        predictions = runner.run_model(
            op_list=[inferences], num_steps=1,
            feed_vars=(inference_input,), print_every=0,
            feed_data=[(mock_input,)])

The inspection of the three saved files:

  • the checkpoint is neither in file.data-00000-of-00001 nor in file.meta since both yield DataLoss error
  • so file.index must be the correct one but it gives NotFoundError: Tensor name "conv3d_1/bias/Adam_1" not found in checkpoint files ...

I thought that all variables are saved during training. what am I doing wrong?

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

No branches or pull requests

1 participant