Fill keys in CSVLogger before stop_training is checked
Fixes
@@ -965,13 +965,14 @@ class CSVLogger(Callback):
else:
return k
+ if self.keys is None:
+ self.keys = sorted(logs.keys())
+
if self.model.stop_training:
# We set NA so that csv parsers do not fail for this last epoch.
logs = dict([(k, logs[k]) if k in logs else (k, 'NA') for k in self.keys])
if not self.writer:
- self.keys = sorted(logs.keys())
-
class CustomDialect(csv.excel):
delimiter = self.sep
