Obtener predicciones por lotes para TFrecords a través de CloudML
Seguíeste gran tutorial y entrenó con éxito un modelo (en CloudML). Mi código también hace predicciones fuera de línea, pero ahora estoy tratando de usar Cloud ML para hacer predicciones y tengo algunos problemas.
Para desplegar mi modelo, seguíeste tutorial. Ahora tengo un código que generaTFRecords
viaapache_beam.io.WriteToTFRecord
y quiero hacer predicciones para esosTFRecords
. Para hacerlo estoy siguiendoEste artícul, mi comando se ve así:
gcloud ml-engine jobs submit prediction $JOB_ID --model $MODEL --input-paths gs://"$FILE_INPUT".gz --output-path gs://"$OUTPUT"/predictions --region us-west1 --data-format TF_RECORD_GZIP
Pero solo obtengo errores:'Exception during running the graph: Expected serialized to be a scalar, got shape: [64]
Parece que espera datos en un formato diferente. Encontré las especificaciones de formato para JSONaqu, pero no pude encontrar cómo hacerlo con TFrecords.
UPDATE: aquí está la salida desaved_model_cli show --all --dir
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
signature_def['prediction']:
The given SavedModel SignatureDef contains the following input(s):
inputs['example_proto'] tensor_info:
dtype: DT_STRING
shape: unknown_rank
name: input:0
The given SavedModel SignatureDef contains the following output(s):
outputs['probability'] tensor_info:
dtype: DT_FLOAT
shape: (1, 1)
name: probability:0
Method name is: tensorflow/serving/predict
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['example_proto'] tensor_info:
dtype: DT_STRING
shape: unknown_rank
name: input:0
The given SavedModel SignatureDef contains the following output(s):
outputs['probability'] tensor_info:
dtype: DT_FLOAT
shape: (1, 1)
name: probability:0
Method name is: tensorflow/serving/predict