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

Saving model #31

Open
RomanFoell opened this issue Oct 29, 2018 · 1 comment
Open

Saving model #31

RomanFoell opened this issue Oct 29, 2018 · 1 comment

Comments

@RomanFoell
Copy link

RomanFoell commented Oct 29, 2018

Hello,
is there an easy way to save the model after training?
When I want to save 'm' in 'demo_regression_UCI.ipynb' with pickle, I get the error:

ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.framework.ops.Tensor'>):
<tf.Tensor 'White-23799c2b-23/variance/IsVariableInitialized:0' shape=() dtype=bool>
If you want to mark it as used call its "mark_used()" method.
It was originally created here:
  File "demo_regression_UCI.py", line 162, in <module>
    pickle.dump(m, file_handle, pickle.HIGHEST_PROTOCOL)  File "demo_regression_UCI.py", line 110, in make_dgp_models
    return models, names  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/compilable.py", line 91, in __init__
    self.initialize(force=True)  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/node.py", line 156, in build
    self._build()  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/params/parameterized.py", line 302, in _build
    self._prior_tensor = self._build_prior(priors)  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/node.py", line 156, in build
    self._build()  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/params/parameter.py", line 370, in _build
    self._prior_tensor = prior  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 189, in wrapped
    return _add_should_use_warning(fn(*args, **kwargs))
==================================
ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.framework.ops.Tensor'>):
<tf.Tensor 'White-23799c2b-23/variance/IsVariableInitialized:0' shape=() dtype=bool>
If you want to mark it as used call its "mark_used()" method.
It was originally created here:
  File "demo_regression_UCI.py", line 162, in <module>
    pickle.dump(m, file_handle, pickle.HIGHEST_PROTOCOL)  File "demo_regression_UCI.py", line 110, in make_dgp_models
    return models, names  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/compilable.py", line 91, in __init__
    self.initialize(force=True)  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/node.py", line 156, in build
    self._build()  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/params/parameterized.py", line 302, in _build
    self._prior_tensor = self._build_prior(priors)  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/core/node.py", line 156, in build
    self._build()  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gpflow-1.2.0-py3.6.egg/gpflow/params/parameter.py", line 370, in _build
    self._prior_tensor = prior  File "/usr/local/storage/foellrn/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 189, in wrapped
    return _add_should_use_warning(fn(*args, **kwargs))
==================================



@hughsalimbeni
Copy link
Collaborator

Yes it is possible. See GPflow/GPflow#852. I'd start by saving/restoring a vanilla gpflow model (trained with adam for at least step, as it's important to save the adam variables too), and if that works the same code should work in the deep case

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