-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Please fill out the form below.
System Information
- Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): TensorFlow
- Framework Version: 1.6.0 (not sure)
- Python Version: 3.6
- CPU or GPU: ...
- Python SDK Version: 1.2.3
- Are you using a custom image: No
Describe the problem
I am trying to use SageMaker end-to-end.
Training:
from sagemaker.tensorflow import TensorFlow
job_name = ****
estimator = TensorFlow(
entry_point='sagemaker-script.py',
source_dir=****,
role=role,
training_steps=1000,
evaluation_steps=100,
hyperparameters={
'learning_rate': 1e-04,
'input_layer': 'inputs',
'input_layer_full_name': 'inputs_input',
'max_len': 42
},
train_instance_count=1,
train_instance_type='ml.p3.2xlarge',
checkpoint_path=****)
estimator.fit(****, job_name=job_name)
predictor = estimator.deploy(initial_instance_count=1, instance_type='ml.m4.xlarge')
predict_data = ****
predictor.predict(predict_data.X)Where sagemaker-script.py is:
from __future__ import print_function, unicode_literals
import os
import pandas as pd
import numpy as np
import tensorflow as tf
import yaml
...
def create_corpus(path):
****
return text
def keras_model_fn(hyperparameters):
log.info('Calling keras_model_fn')
****
return model
def train_input_fn(training_dir=None, hyperparameters=None):
X, y = _input_fn(training_dir, hyperparameters)
return tf.estimator.inputs.numpy_input_fn(
x={hyperparameters['input_layer_full_name']: X},
y=y,
num_epochs=None,
shuffle=True)()
def _input_fn(training_dir, hyperparameters):
****
train_data_gen = ****
return train_data_gen.X, train_data_gen.y
def eval_input_fn(training_dir=None, hyperparameters=None):
log.info("Calling eval_input_fn")
X, y = _eval_fn(training_dir, hyperparameters)
log.info("SIGNATURE: {}".format(hyperparameters['input_layer_full_name']))
log.info("eval_input_fn DONE")
return tf.estimator.inputs.numpy_input_fn(
x={hyperparameters['input_layer_full_name']: X},
y=y,
num_epochs=None,
shuffle=True)()
def _eval_fn(training_dir, hyperparameters):
****
val_data_gen = ****
return val_data_gen.X, val_data_gen.y
def serving_input_fn(hyperparameters):
char_indices = ****
# defines the input placeholder
tensor = tf.placeholder(tf.int8, shape=[None, hyperparameters['max_len'], len(char_indices)])
serving_input_receiver = tf.estimator.export.build_raw_serving_input_receiver_fn(
{hyperparameters['input_layer_full_name']: tensor})()
# returns the ServingInputReceiver object.
return serving_input_receiverMinimal repo / logs
The prediction command results in the following:
AbortionError: AbortionError(code=StatusCode.INVALID_ARGUMENT, details="input tensor alias not found in signature: inputs. Inputs expected to be in the set {inputs_input}.")
[2018-04-26 13:42:32,944] ERROR in serving: AbortionError(code=StatusCode.INVALID_ARGUMENT, details="input tensor alias not found in signature: inputs. Inputs expected to be in the set {inputs_input}.")
Can you help me?
Thank you.