Adds train_batch_size, eval_batch_size, and n_gpu to to_sanitized_dict output for logging. (#5331)

* Adds train_batch_size, eval_batch_size, and n_gpu to to_sanitized_dict() output

* Update wandb config logging to use to_sanitized_dict

* removed n_gpu from sanitized dict

* fix quality check errors
This commit is contained in:
Jay Mody
2020-08-03 09:00:39 -04:00
committed by GitHub
parent 9996f697e3
commit cedc547e7e
2 changed files with 4 additions and 1 deletions

View File

@@ -383,7 +383,7 @@ class Trainer:
logger.info( logger.info(
'Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"' 'Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"'
) )
wandb.init(project=os.getenv("WANDB_PROJECT", "huggingface"), config=vars(self.args)) wandb.init(project=os.getenv("WANDB_PROJECT", "huggingface"), config=self.args.to_sanitized_dict())
# keep track of model topology and gradients, unsupported on TPU # keep track of model topology and gradients, unsupported on TPU
if not is_torch_tpu_available() and os.getenv("WANDB_WATCH") != "false": if not is_torch_tpu_available() and os.getenv("WANDB_WATCH") != "false":
wandb.watch( wandb.watch(

View File

@@ -310,7 +310,10 @@ class TrainingArguments:
Sanitized serialization to use with TensorBoards hparams Sanitized serialization to use with TensorBoards hparams
""" """
d = dataclasses.asdict(self) d = dataclasses.asdict(self)
d = {**d, **{"train_batch_size": self.train_batch_size, "eval_batch_size": self.eval_batch_size}}
valid_types = [bool, int, float, str] valid_types = [bool, int, float, str]
if is_torch_available(): if is_torch_available():
valid_types.append(torch.Tensor) valid_types.append(torch.Tensor)
return {k: v if type(v) in valid_types else str(v) for k, v in d.items()} return {k: v if type(v) in valid_types else str(v) for k, v in d.items()}