Tensorboard can not find folder already created #16693
Unanswered
javierrcyb
asked this question in
Questions and Answers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey! So I am trying to use Tensorboard to visualize my learning rate and other parameters. But for some reason I am constantly getting an error message that the folder does not exist, despite it does. I do not know if It's something in my code or what, please help me! (I have everything imported)
log_dir = "logs/fit/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
if os.path.isfile(log_dir): os.remove(log_dir) os.makedirs(log_dir, exist_ok=True)
def exponential_decay(lr0, s): def exponential_decay_fn(epoch): return lr0 * 0.1**(epoch / s) return exponential_decay_fn exponential_decay_fn = exponential_decay(lr0=0.01, s=20)
lr_scheduler = keras.callbacks.LearningRateScheduler(exponential_decay_fn)
tensorboard_cb = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)
early_stopping_cb = keras.callbacks.EarlyStopping(patience=10, restore_best_weights=True)
checkpoint_cb = keras.callbacks.ModelCheckpoint("my_keras_model.keras", save_best_only=True)
model = keras.models.Sequential([ keras.Input(shape=(32, 32, 3)), keras.layers.Flatten() ] + [ keras.layers.Dense(100, activation='elu', kernel_initializer='he_normal') for _ in range(20) ] + [ keras.layers.Dense(10, activation='softmax') ])
model.compile( optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'] )
history = model.fit( x_train, y_train, epochs=50, validation_data=(x_valid, y_valid), callbacks=[tensorboard_cb, early_stopping_cb, checkpoint_cb, lr_scheduler ] )
An this is the error message:
FailedPreconditionError: {{function_node __wrapped__CreateSummaryFileWriter_device_/job:localhost/replica:0/task:0/device:CPU:0}} logs/fit/20250602-134828 is not a directory [Op:CreateSummaryFileWriter] name:
Beta Was this translation helpful? Give feedback.
All reactions