liupei101 / TFDeepSurv

COX Proportional risk model and survival analysis implemented by tensorflow.
MIT License
101 stars 27 forks source link

Cannot restore variables (weights and bias) #8

Closed XiaomeiLi1 closed 4 years ago

XiaomeiLi1 commented 4 years ago

Hi Liupei, Thanks for your awsome work TFDeepSurv. But I have problems to restore variables from the saved checkpoint file. saver = tf.train.import_meta_graph(load_model+'final.ckpt.meta') saver.restore(self.sess, load_model+'final.ckpt') all_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES) print(all_vars) for v in allvars: v = sess.run(v) print(v_) It appears errors. Could you have ideas to fix this? Thanks a lot! Traceback (most recent call last): File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call return fn(*args) File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn target_list, run_metadata) File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value encoder_layer1/biases [[{{node encoder_layer1/biases/read}}]]

During handling of the above exception, another exception occurred:

liupei101 commented 4 years ago

The error messages have provided that your program is attempting to use uninitialized values. Please check if you call function like 'global_variables_initializer' at first, and then come to restore your saved model.

Hope it helpful to you.

XiaomeiLi1 commented 4 years ago

Thank you so much, I got the idea.