Google cloud ml无法部署图表以进行预测api

时间:2017-02-06 09:01:21

标签: tensorflow google-cloud-platform google-cloud-ml

是否有人尝试过导出基于本地机器的tensorflow模型并使用google cloud ml预测API上传此模型?

我正在尝试使用我本地计算机上this博客中给出的略微修改版本的再培训示例来构建图表,并将导出的模型检查点直接上传到cloud ml进行预测。但是它会抛出错误说:

ERROR: (gcloud.beta.ml.predict) HTTP request failed. Response: {                                     
  "error": {                                                                                         
    "code": 503,                                                                                     
    "message": "Field: name Error: Online prediction service is unavailable for this version. Please 
try again in around 60 seconds.",                                                                    
    "status": "UNAVAILABLE",                                                                         
    "details": [                                                                                     
      {                                                                                              
        "@type": "type.googleapis.com/google.rpc.BadRequest",                                        
        "fieldViolations": [                                                                         
          {                                                                                          
            "field": "name",                                                                         
            "description": "Online prediction service is unavailable for this version. Please try aga
in in around 60 seconds."                                                                            
          }                                                                                          
        ]                                                                                            
      }                                                                                              
    ]                                                                                                
  }                                                                                                  
}      

当进行调试时,我尝试使用命令gcloud beta ml local predict在本地使用相同的图形和相同的示例进行预测,它会出错:

ERROR: (gcloud.beta.ml.local.predict) WARNING:root:Couldn't find python-snappy so the implementation 
of _TFRecordUtil._masked_crc32c is not as fast as it could be.                                       
Traceback (most recent call last):                                                                   
  File "lib/googlecloudsdk/command_lib/ml/local_predict.py", line 112, in <module>                   
    main()                                                                                           
  File "lib/googlecloudsdk/command_lib/ml/local_predict.py", line 107, in main                       
    instances=instances)                                                                             
  File "/root/.local/lib/python2.7/site-packages/google/cloud/ml/prediction/_prediction_lib.py", line
 731, in local_predict                                                                               
    client = SessionClient(*load_model(model_dir))                                                   
  File "/root/.local/lib/python2.7/site-packages/google/cloud/ml/prediction/_prediction_lib.py", line
 339, in load_model                                                                                  
    model_path)                                                                                      
  File "/root/.local/lib/python2.7/site-packages/google/cloud/ml/session_bundle/_session_bundle.py", 
line 153, in load_session_bundle_from_path                                                           
    saver = tf.train.import_meta_graph(meta_graph_def)                                               
  File "/root/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1708, in 
import_meta_graph                                                                                    
    return _import_meta_graph_def(meta_graph_or_file, clear_devices)                                 
  File "/root/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1598, in 
_import_meta_graph_def                                                                               
    input_graph_def, name="", producer_op_list=producer_op_list)                                     
  File "/root/.local/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 258, 
in import_graph_def                                                                                  
    op_def = op_dict[node.op]                                                                        
KeyError: u'TensorArrayV2' 

似乎无法从模型中导入所有图形元素。我已使用此命令导出模型:

saver.export_meta_graph(filename=os.path.join("/trainer/", 'export.meta'))
saver.save(sess, os.path.join("/trainer/", 'export'), write_meta_graph=False)

0 个答案:

没有答案