在本地机器上加载张量流模型

时间:2020-05-16 18:25:18

标签: tensorflow tensorflow2.0

我已经在Google colab中训练了TensorFlow模型,并以.h5格式导出了它。在google colab中,我可以毫无问题地加载模型,但是在我的本地计算机上,会抛出错误和警告。

加载模型

import tensorflow as tf
rnn = tf.keras.models.load_model('my_model.h5')

错误

2020-05-16 20:17:10.802390: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU     
supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

2020-05-16 20:17:10.835907: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU 
Frequency: 2400000000 Hz

2020-05-16 20:17:10.836269: I tensorflow/compiler/xla/service/service.cc:168] XLA service 
0x4443f90 executing computations on platform Host. Devices:

2020-05-16 20:17:10.836308: I tensorflow/compiler/xla/service/service.cc:175]   
StreamExecutor device (0): <undefined>, <undefined>

2020-05-16 20:17:10.862236: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] 
(One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--
tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use 
experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass 
--vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or 
set the envvar XLA_FLAGS=--xla_hlo_profile.

我在带有GPU的google collab中训练了模型。

1 个答案:

答案 0 :(得分:1)

它们只是信息和警告消息,因为它们以I为前缀,以W为警告,否则,如果是错误消息,则以E为前缀

例如-在下面的错误跟踪中,有一些信息消息以I开头,错误消息以E开头。

2020-01-14 21:30:27.591905: I tensorflow/core/profiler/lib/profiler_session.cc:225] Profiler session started.
2020-01-14 21:30:27.594743: I tensorflow/core/profiler/internal/gpu/cupti_tracer.cc:1259] Profiler found 1 GPUs
2020-01-14 21:30:27.599172: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cupti64_101.dll
2020-01-14 21:30:27.704083: E tensorflow/core/profiler/internal/gpu/cupti_tracer.cc:1307] function cupti_interface_->Subscribe( &subscriber_, (CUpti_CallbackFunc)ApiCallback, this)failed with error CUPTI_ERROR_INSUFFICIENT_PRIVILEGES
2020-01-14 21:30:27.716790: E tensorflow/core/profiler/internal/gpu/cupti_tracer.cc:1346] function cupti_interface_->ActivityRegisterCallbacks( AllocCuptiActivityBuffer, FreeCuptiActivityBuffer)failed with error CUPTI_ERROR_INSUFFICIENT_PRIVILEGES
Epoch 1/5
2020-01-14 21:30:28.370429: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-01-14 21:30:28.651767: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-01-14 21:30:29.662864: E tensorflow/core/profiler/internal/gpu/cupti_tracer.cc:1329] function cupti_interface_->EnableCallback( 0 , subscriber_, CUPTI_CB_DOMAIN_DRIVER_API, cbid)failed with error CUPTI_ERROR_INVALID_PARAMETER
2020-01-14 21:30:29.670282: I tensorflow/core/profiler/internal/gpu/device_tracer.cc:88] GpuTracer has collected 0 callback api events and 0 activity events.

请告知我们您是否无法使用加载的模型并遇到其他错误。希望这能回答您的问题。