gpt4 book ai didi

tensorflow - 未找到张量板

转载 作者:行者123 更新时间:2023-12-04 10:07:03 24 4
gpt4 key购买 nike

我正在尝试使用 tensorboard 仪表板来检查模型性能。下面是我使用的代码:

from keras.callbacks import TensorBoard
%load_ext tensorboard

log_dir = "logs/fit/" + datetime.now().strftime("%Y%m%d-%H%M%S")

tensorboard_callback = TensorBoard(log_dir=log_dir, histogram_freq=1)

checkpoint_name = 'Weights-{epoch:03d}--{val_loss:.5f}.hdf5'

checkpoint = ModelCheckpoint(checkpoint_name, monitor='val_loss', verbose = 1, save_best_only = True, mode ='auto')

es = EarlyStopping(monitor='val_loss', verbose=1, patience=10)

callbacks_list = [checkpoint ,es,tensorboard_callback]

NN_model.fit(train, target, epochs=100, batch_size=32, validation_split = 0.2, callbacks=callbacks_list)

但是在模型训练后,我无法显示仪表板:
%tensorboard --logdir logs
这是我得到的错误:
ERROR: Could not find `tensorboard`. Please ensure that your PATH
contains an executable `tensorboard` program, or explicitly specify
the path to a TensorBoard binary by setting the `TENSORBOARD_BINARY`
environment variable.

最佳答案

这可能是因为笔记本和虚拟环境之间存在一些冲突。
这里一个简单的解决方案就是指定 TENSORBOARD_BINARY变量就在你的笔记本中,所以它不会干扰全局变量,然后像这样调用 tensorboard:

os.environ['TENSORBOARD_BINARY'] = '/path/to/envs/my_env/bin/tensorboard'
一个长期的解决方案是像提议的那样为虚拟环境设置一个变量 here .

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

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