adanet icon indicating copy to clipboard operation
adanet copied to clipboard

Saving model fails

Open DrewParallel opened this issue 6 years ago • 3 comments

Since the example code did not actually save the model, I added the code below to do so. However, it fails with "TypeError: Value passed to parameter 'dense_defaults' has DataType float64 not in list of allowed values: float32, int64, string". The available "allowed values" for x_in fail with various other issues. How does one actually save the model to SavedModel format?

x_in = tf.feature_column.numeric_column(FEATURES_KEY, dtype=tf.float64)
feature_columns = [x_in]
feature_spec = tf.feature_column.make_parse_example_spec(feature_columns)
export_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(feature_spec)

print("Exporting model")
estimator.export_saved_model(export_dir, export_input_fn)

DrewParallel avatar Nov 15 '18 21:11 DrewParallel

looks like the problem is your numeric_column has dtype tf.float64. Does it work if you change it to tf.float32?

cweill avatar Nov 15 '18 21:11 cweill

I tried all the listed types. Using tf.float32 gives the error: ValueError: Input 0 of node wrapped_x_4 was passed float from wrapped_x:0 incompatible with expected double.

DrewParallel avatar Nov 15 '18 21:11 DrewParallel

Try upgrading to adanet=0.5.0 and training from scratch with a new model_dir. Let me know if that works.

cweill avatar Dec 21 '18 02:12 cweill