Open ianfowler opened 5 years ago
I figured out why the prediction is wrong:
I1201 00:19:08.316953 140735978513280 estimator.py:612] Could not find trained model in model_dir: /Users/ian/exoplanet-ml/astronet, running initialization to predict.
I1201 00:19:08.334474 140735978513280 estimator.py:1145] Calling model_fn.
W1201 00:19:08.335051 140735978513280 deprecation_wrapper.py:119] From /Users/ian/exoplanet-ml/bazel-bin/astronet/predict.runfiles/__main__/astronet/astro_model/astro_model.py:303: The name tf.train.get_or_create_global_step is deprecated. Please use tf.compat.v1.train.get_or_create_global_step instead.
Going back a level in the directory didn't find the right files.
Now I'm sure that the correct files are indeed at the specified directory.
exoplanet-ml ian$ ls $MODEL_DIR
checkpoint eval_test events.out.tfevents.1575219078.bear-mbp model.ckpt-625.data-00000-of-00001 model.ckpt-625.meta
config.json eval_val graph.pbtxt model.ckpt-625.index
If so, why would there be problems restoring?
The original error isn't due to the model not being in the given model directory - as you said in your second post the model is in the right place and the model_dir argument is correct. The issue is a data type mismatch between tf.float32 and tf.float64.
In astronet/predict.py you just need to force the features to be floats instead of doubles (numpy floats).
115: global_view = preprocess.global_view(time, flux, FLAGS.period).astype(np.float32)
...
120: local_view = preprocess.local_view(time, flux, FLAGS.period, FLAGS.duration).astype(np.float32)
When following the instructions to use a trained Astronet model to generate predictions:
The following error occurs:
As the error suggests (buried in there), the directory given for the model isn't lining up to where things are stored. I solved it by changing the path:
This prediction for following the demo exactly is slightly different every time from the expected 0.9480018 (which I assume shouldn't be the case first in the sense that it's different every time and second in the sense that it's off by the demo's result by 45%) and gravitates around 50%. (Three trials: 0.5015401002407824, 0.49691700167065095, 0.49994740353818445). Is this an issue with my solution for the first problem (changing the path of the model), or is this an entirely different issue?