Move type check below null check
@@ -516,11 +516,12 @@ def log(row=None, commit=True, step=None, *args, **kwargs):
termwarn(
"wandb.log called without a step keyword argument. Pass the same step that tensorboard is using to avoid data loss see:\nhttps://docs.wandb.com/docs/integrations/tensorboard.html#custom-metrics", repeat=False)
+ if row is None:
+ row = {}
+
if any(not isinstance(key, str) for key in row.keys()):
raise ValueError("Key values passed to `wandb.log` must be strings.")
- if row is None:
- row = {}
if commit or step is not None:
run.history.add(row, *args, step=step, **kwargs)
else:
