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

2024-04-11

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

装载模型

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

error

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.

我在 google colab 中使用 GPU 训练了模型。


它们只是信息和警告消息,因为它们的前缀为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.

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在本地机器上加载张量流模型 的相关文章

随机推荐