callback

class xuance.common.callback.BaseCallback(*args, **kwargs)[源代码]

基类:ABC

Base class for callback hooks in reinforcement learning training and testing.

Users can inherit this class to implement custom logic during different stages of training and evaluation.

on_test_end(*args, **kwargs)[源代码]

Called at the end of the testing loop.

参数:
  • *args – Optional positional arguments.

  • **kwargs – Optional keyword arguments.

on_test_step(*args, **kwargs)[源代码]

Called during each step in the testing loop.

参数:
  • *args – Optional positional arguments.

  • **kwargs – Optional keyword arguments.

on_train_episode_info(**kwargs)[源代码]

Called at the termination or truncation of one episode for an environment.

on_train_epochs_end(current_step, **kwargs)[源代码]

Called after each training epoch (i.e., after collecting one transition). :param current_step: The current global training step. :type current_step: int :param **kwargs: Additional optional information.

on_train_step(current_step, **kwargs)[源代码]

Called after each training step (i.e., after collecting one transition).

参数:
  • current_step (int) – The current global training step.

  • **kwargs – Additional optional information.

on_train_step_end(current_step, **kwargs)[源代码]

Called after a training step is completed (includes update, logging, etc.).

参数:
  • current_step (int) – The current global training step.

  • envs_info – Environment information.

  • train_info – Training information.

on_update_end(iterations, **kwargs)[源代码]

Called after the policy update is completed.

参数:
  • iterations (int) – Number of update iterations that have performed.

  • **kwargs – Optional keyword arguments.

on_update_start(iterations, **kwargs)[源代码]

Called before the policy update begins.

参数:
  • iterations (int) – Number of update iterations that have performed.

  • **kwargs – Additional optional keyword arguments.

class xuance.common.callback.MultiAgentBaseCallback(*args, **kwargs)[源代码]

基类:BaseCallback

on_update_agent_wise(iterations, agent_key, **kwargs) dict[源代码]

Called when updating an agent’s policy.

参数:
  • iterations (int) – Number of update iterations that have performed.

  • agent_key (str) – The key of the agent to update.

  • **kwargs – Optional keyword arguments.