gpt4 book ai didi

python - 张量板 - tensorflow.python.framework.errors_impl.NotFoundError :

转载 作者:太空宇宙 更新时间:2023-11-03 15:33:03 27 4
gpt4 key购买 nike

我刚刚安装了基于 tf.__version__ = 1.14 的新环境。

以下是我配置张量板的方式:

tensorboard = \
tf.keras.callbacks.TensorBoard(log_dir='./logs',
batch_size=TRAIN_BATCH_SIZE,
write_graph=True,
write_grads=True,
write_images=True)

请注意,我在运行代码的同一目录中有一个名为“logs”的文件夹。但是这个文件夹是空的。

下面是我如何从我的 fit 函数中调用它。

history = model.fit(x=train_x,
y=train_y,
batch_size=BATCH_SIZE,
epochs=5,
verbose=2,
callbacks=[tensorboard],
validation_data=(dev_x, dev_y),
shuffle=True,
class_weight=class_weight,
steps_per_epoch=None,
validation_steps=None)

当我运行代码时,出现以下错误:

2019-07-02 13:04:26.341623: E tensorflow/core/platform/default/device_tracer.cc:68] CUPTI error: CUPTI could not be loaded or symbol could not be found.
Traceback (most recent call last):
File "C:\Users\sinthes\Desktop\AI_Project\BigBang\src\train_fit.py", line 286, in <module>
validation_steps=None) #devset_steps_per_epoch)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 780, in fit
steps_name='steps_per_epoch')
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 374, in model_iteration
callbacks._call_batch_hook(mode, 'end', batch_index, batch_logs)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\callbacks.py", line 248, in _call_batch_hook
batch_hook(batch, logs)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\callbacks.py", line 531, in on_train_batch_end
self.on_batch_end(batch, logs=logs)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\callbacks_v1.py", line 362, in on_batch_end
profiler.save(self.log_dir, profiler.stop())
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\eager\profiler.py", line 144, in save
gfile.MakeDirs(plugin_dir)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 438, in recursive_create_dir
recursive_create_dir_v2(dirname)
File "C:\Users\sinthes\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 453, in recursive_create_dir_v2
pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(path))
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ./logs\plugins\profile\2019-07-02_13-04-26; No such file or directory
[Finished in 10.7s with exit code 1]
[shell_cmd: python -u "C:\Users\sinthes\Desktop\AI_Project\BigBang\src\train_fit.py"]
[dir: C:\Users\sinthes\Desktop\AI_Project\BigBang\src]
[path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\sinthes\AppData\Local\Programs\Python\Python37;C:\Users\sinthes\AppData\Local\Programs\Python\Python37\Scripts;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\sinthes\AppData\Local\Microsoft\WindowsApps;]

它在我以前的环境中工作,但在使用 tf 1.14 安装我的新环境后它不再工作了。

我只是不知道如何解决它。有什么想法吗?

最佳答案

终于解决了。

看起来这是 Tensorflow 中 Windows 特定的错误。如下定义日志目录正在解决问题..

import datetime
log_dir = os.path.join(
"logs",
"fit",
datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
)

有关详细信息,请参阅: https://github.com/tensorflow/tensorflow/issues/26021

关于python - 张量板 - tensorflow.python.framework.errors_impl.NotFoundError :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56851298/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com