Madhukar Mohanraju
Madhukar Mohanraju

Reputation: 2863

TypeError: Value passed to parameter 'input' has DataType string not in list of allowed values: int32, int64, complex64, float32, float64, bool, int8

I was trying to use tensorflow. The input attributes are similar to census example except that the LABEL Column is a continuous value. I executed the below command:

test-server#:~/aaaml-samples/arbitrator$ gcloud ml-engine local train --module-name trainer.task --package-path trainer/ -- --train-files $TRAIN_DATA --eval-files $EVAL_DATA --train-steps 1000 --job-dir $MODEL_DIR

Filename:  ['/home/madhukar_mhraju/aaaml-samples/arbitrator/data/aaa.data.csv']
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Filename:  ['/home/madhukar_mhraju/aaaml-samples/arbitrator/data/aaa.test.csv']
Filename:  ['/home/madhukar_mhraju/aaaml-samples/arbitrator/data/aaa.test.csv']

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/madhukar_mhraju/aaaml-samples/arbitrator/trainer/task.py", line 193, in <module>
    learn_runner.run(generate_experiment_fn(**arguments), job_dir)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 106, in run
    return task()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 465, in train_and_evaluate
    export_results = self._maybe_export(eval_result)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 484, in _maybe_export
    compat.as_bytes(strategy.name))))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/export_strategy.py", line 32, in export
    return self.export_fn(estimator, export_path)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py", line 283, in export_fn
    exports_to_keep=exports_to_keep)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/framework/experimental.py", line 64, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1264, in export_savedmodel
    model_fn_lib.ModeKeys.INFER)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1133, in _call_model_fn
    model_fn_results = self._model_fn(features, labels, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 268, in _dnn_linear_combined_model_fn
    scope=scope)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 531, in weighted_sum_from_feature_columns
    transformed_tensor = transformer.transform(column)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 879, in transform
    feature_column.insert_transformed_feature(self._columns_to_tensors)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 528, in insert_transformed_feature
    sparse_values = string_ops.as_string(input_tensor.values)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_string_ops.py", line 51, in as_string
    width=width, fill=fill, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 585, in apply_op
    param_name=input_name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 61, in _SatisfiesTypeConstraint
    ", ".join(dtypes.as_dtype(x).name for x in allowed_list)))

TypeError: Value passed to parameter 'input' has DataType string not in list of allowed values: int32, int64, complex64, float32, float64, bool, int8

Am new to tensorflow. I understand that this issue is occurring while processing the evaluation file(aaa.test.csv). The evaluation file data and format is correctly defined. And also the column data type have been mapped correctly as well.But i am not sure why the error is occurring.

Upvotes: 0

Views: 2253

Answers (1)

Madhukar Mohanraju
Madhukar Mohanraju

Reputation: 2863

1) The training data csv had column headings in them. When I generated the data, i was reordering them randomly, which resulted in the column headings being moved to somewhere in the middle. Hence the type error. It was difficult to find out as the training data was huge.

Upvotes: 1

Related Questions