gflownet.utils.logger ===================== .. py:module:: gflownet.utils.logger Classes ------- .. autoapisummary:: gflownet.utils.logger.Logger Module Contents --------------- .. py:class:: Logger(config, do, project_name, logdir, lightweight, debug, run_name=None, run_name_date = True, run_name_job = True, run_id = None, tags = None, context = '0', notes = None, entity = None, progressbar = {'skip': False, 'n_iters_mean': 100}, is_resumed = False) Utils functions to compute and handle the statistics (saving them or send to wandb). It can be passed on to querier, gfn, proxy, ... to get the statistics of training of the generated data at real time :param run_name: Name of the run. By default it is None. If run_name is None and run_name_date and run_name_job are both False, then a random name will be assigned by wandb. :type run_name: str :param run_name_date: Whether the date (and time) should be included in the run name. True by default. :type run_name_date: bool :param run_name_job: Whether the job ID should be included in the run name. True by default. :type run_name_job: bool :param progressbar: A dictionary of configuration parameters related to the progress bar, namely: - skip : bool If True, the progress bar is not displayed during training. False by default. - n_iters_mean : int The number of past iterations to take into account to compute averages of a metric, for example the loss. 100 by default. :type progressbar: dict .. py:attribute:: config .. py:attribute:: do .. py:attribute:: context :value: '0' .. py:attribute:: progressbar .. py:attribute:: loss_memory :value: [] .. py:attribute:: lightweight .. py:attribute:: debug .. py:attribute:: is_resumed :value: False .. py:attribute:: ckpts_dir .. py:attribute:: datadir .. py:method:: write_url_file() .. py:method:: add_tags(tags) .. py:method:: set_context(context) .. py:method:: progressbar_update(pbar, loss, rewards, jsd, use_context=True, n_mean=100) .. py:method:: log_histogram(key, value, step, use_context=True) .. py:method:: log_plots(figs, step, use_context=True) .. py:method:: close_figs(figs) .. py:method:: log_rewards_and_scores(rewards, logrewards, scores, step, prefix, use_context = True) Logs the rewards, log-rewards and proxy scores passed as arguments. :param rewards: Rewards of a batch of states. :type rewards: tensor :param logrewards: Log-rewards of a batch of states. :type logrewards: tensor :param scores: Proxy scores of a batch of states. :type scores: tensor :param step: The training iteration number. :type step: int :param prefix: Prefix to be added to the metric names. :type prefix: str :param use_context: If True, prepend self.context + / to the key of the metric. :type use_context: bool .. py:method:: log_metrics(metrics, step, use_context = True) Logs metrics to wandb. :param metrics: A dictionary of metrics to be logged to wandb. :type metrics: dict :param step: The training iteration number. :type step: int :param use_context: If True, prepend self.context + / to the key of the metric. :type use_context: bool .. py:method:: log_summary(summary) .. py:method:: save_checkpoint(forward_policy, backward_policy, state_flow, logZ, optimizer, buffer, step, final = False) .. py:method:: log_time(times, use_context) .. py:method:: end()