Skip to content

使用spark-scala调用tensorflow2.0训练好的模型,mac本地读取不了模型 #78

@chlyzzo

Description

@chlyzzo

用tensorflow训练了个lr模型,保存在mac本地,显示成功:
image

然后,用spark-scala进行读取模型,一直显示错误:
20/12/04 17:08:23 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
20/12/04 17:08:23 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, 172.18.20.248, 54070, None)
20/12/04 17:08:23 INFO BlockManagerMasterEndpoint: Registering block manager 172.18.20.248:54070 with 912.3 MB RAM, BlockManagerId(driver, 172.18.20.248, 54070, None)
20/12/04 17:08:23 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, 172.18.20.248, 54070, None)
20/12/04 17:08:23 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, 172.18.20.248, 54070, None)
2020-12-04 17:08:23.823963: I tensorflow/cc/saved_model/loader.cc:242] Loading SavedModel with tags: { serve }; from: /Users/huwenhao02/eclipse-workspace/pythonWorks/tensorflow-works/data/linear_model/1
2020-12-04 17:08:23.825520: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
2020-12-04 17:08:23.832894: I tensorflow/cc/saved_model/loader.cc:291] SavedModel load for tags { serve }; Status: fail. Took 8992 microseconds.
Exception in thread "main" org.tensorflow.TensorFlowException: Op type not registered 'StatefulPartitionedCall' in binary running on BDSHYF000120942. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) tf.contrib.resampler should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
at org.tensorflow.SavedModelBundle.load(Native Method)
at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:39)
at tensorflow.UserTfEaxmple$.main(UserTfEaxmple.scala:20)
at tensorflow.UserTfEaxmple.main(UserTfEaxmple.scala)
20/12/04 17:08:23 INFO SparkContext: Invoking stop() from shutdown hook
20/12/04 17:08:23 INFO SparkUI: Stopped Spark web UI at http://172.18.20.248:4040
20/12/04 17:08:23 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions