ashpy
ashpy copied to clipboard
[BUG/PERFORMANCE] - Handling of logdir: conflict between metrics and trainer
The logdir can be defined in trainers and in metrics.
The actual behaviour is to override the metric's logdir using the trainer's logdir.
However, the logdir parameter in trainer is optional and it has a default value (cwd + "log"
).
logdir = "mylogdir"
precision = ClassifierMetric(
metric=tf.keras.metrics.Precision(),
model_selection_operator=operator.gt,
logdir=logdir,
)
trainer = ClassifierTrainer(
model=self.model,
optimizer=optimizer,
loss=loss,
epochs=epochs,
metrics=[precision],
callbacks=callbacks,
)
trainer(
self.train_dataset.batch(batch_size).prefetch(1),
self.validation_dataset.batch(batch_size).prefetch(1),
)
Ashpy logs in the directory "log" instead of the directory "mylogdir"
.
Possible solution: remove logdir
from the metric's __init__
and set the logdir
from the trainer.
[Optional] remove logdir
default values.