Obtendo previsões de lote para TFrecords via CloudML
eu seguieste ótimo tutorial e treinou com sucesso um modelo (no CloudML). Meu código também faz previsões offline, mas agora estou tentando usar o Cloud ML para fazer previsões e ter alguns problemas.
Para implantar meu modelo, seguieste tutorial. Agora eu tenho um código que geraTFRecords
através daapache_beam.io.WriteToTFRecord
e eu quero fazer previsões para aquelesTFRecords
. Para fazer isso, eu estou seguindoEste artigo, meu comando fica assim:
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
Mas eu recebo apenas erros:'Exception during running the graph: Expected serialized to be a scalar, got shape: [64]
Parece que espera dados em um formato diferente. Encontrei as especificações de formato para JSONaqui, mas não conseguiu encontrar como fazê-lo com o TFrecords.
UPDATE: aqui está a saída 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