Unverified Commit 5406f31a authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix TensorBoardCallback for older versions of PyTorch (#8239)

parent d1ad4bff
......@@ -282,6 +282,8 @@ class TensorBoardCallback(TrainerCallback):
if hasattr(model, "config") and model.config is not None:
model_config_json = model.config.to_json_string()
self.tb_writer.add_text("model_config", model_config_json)
# Version of TensorBoard coming from tensorboardX does not have this method.
if hasattr(self.tb_writer, "add_hparams"):
self.tb_writer.add_hparams(args.to_sanitized_dict(), metric_dict={})
def on_log(self, args, state, control, logs=None, **kwargs):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment