def log(self, row=None, commit=None, step=None, sync=True, *args, **kwargs): if sync == False: wandb._ensure_async_log_thread_started() return wandb._async_log_queue.put({ "row": row, "commit": commit, "step": step }) if row is None: row = {} for k in row: if isinstance(row[k], Visualize): self._add_viz(k, row[k].viz_id) row[k] = row[k].value if not isinstance(row, collections.Mapping): raise ValueError("wandb.log must be passed a dictionary") if any(not isinstance(key, six.string_types) for key in row.keys()): raise ValueError( "Key values passed to `wandb.log` must be strings.") if commit is not False or step is not None: self.history.add(row, *args, step=step, commit=commit, **kwargs) else: self.history.update(row, *args, **kwargs)
def log(self, row=None, commit=None, step=None, sync=True, *args, **kwargs): """ Logs a dict to the run's history. For more details see wandb.log() Args: row (dict, optional): A dict of serializable python objects i.e str: ints, floats, Tensors, dicts, or wandb.data_types commit (boolean, optional): Save the metrics dict to the wandb server and increment the step. If false wandb.log just updates the current metrics dict with the row argument and metrics won't be saved until wandb.log is called with commit=True. step (integer, optional): The global step in processing. This persists any non-committed earlier steps but defaults to not committing the specified step. sync (boolean, True): If set to False, process calls to log in a seperate thread. """ if sync == False: wandb._ensure_async_log_thread_started() return wandb._async_log_queue.put({ "row": row, "commit": commit, "step": step }) if row is None: row = {} for k in row: if isinstance(row[k], Visualize): self._add_viz(k, row[k].viz_id) row[k] = row[k].value if not isinstance(row, collections.Mapping): raise ValueError("wandb.log must be passed a dictionary") if any(not isinstance(key, six.string_types) for key in row.keys()): raise ValueError( "Key values passed to `wandb.log` must be strings.") if commit is not False or step is not None: self.history.add(row, *args, step=step, commit=commit, **kwargs) else: self.history.update(row, *args, **kwargs)