Hello, I am trying to customize the filename of the history saved through CSVLogger but for some reasons it breaks when I pass the inizialized callback to the learner.
The code I am running is this:
# callbacks
CBS = [
SaveModelCallback(
monitor=cfg.monit_dict["score"],
min_delta=cfg.monit_dict["min_delta"],
fname="model",
# fname=f"model_{EXP_NAME}",
every_epoch=False,
at_end=False,
with_opt=True,
reset_on_fit=False,
),
# CSVLogger(fname=f"history_{EXP_NAME}.csv"), # for some reason it doesn't work
CSVLogger,
]
# learner
learn = Learner(
dls,
model=cresunet,
loss_func=cfg.loss_func,
metrics=[Dice(), JaccardCoeff(), foreground_acc],
cbs=CBS,
path=LOG_PATH,
model_dir=model_path,
)
When I call it with only CSVLogger
it works, but if I try to pass CSVLogger(fname=f"history_{EXP_NAME}.csv")` as a callback I get the following error:
. . .
File ".../fluocells/lib/python3.9/site-packages/fastai/callback/progress.py", line 118, in _write_line
self.old_logger(log)
File ".../fluocells/lib/python3.9/site-packages/fastai/callback/progress.py", line 118, in _write_line
self.old_logger(log)
[Previous line repeated 978 more times]
File ".../fluocells/lib/python3.9/site-packages/fastai/callback/progress.py", line 115, in _write_line
self.file.write(','.join([str(t) for t in log]) + '\n')
File ".../fluocells/lib/python3.9/site-packages/fastai/callback/progress.py", line 115, in <listcomp>
self.file.write(','.join([str(t) for t in log]) + '\n')
RecursionError: Exception occured in `Recorder` when calling event `after_epoch`:
maximum recursion depth exceeded while getting the str of an object
In particular, I see the output file is created with the correct name, but the same history line is repeated tones of times (982 specifically).
Any suggestion would be great!