learner

class xuance.torch.learners.learner.Learner(config: Namespace, policy: torch.nn.Module, callback)[source]

Bases: ABC

estimate_total_iterations()[source]

Estimated total number of training iterations

load_model(path, model=None)[source]
load_snapshot(snapshot_path)[source]
save_model(model_path)[source]
save_snapshot()[source]
abstractmethod update(*args)[source]
class xuance.torch.learners.learner.LearnerMAS(config: Namespace, model_keys: List[str], agent_keys: List[str], policy: torch.nn.Module, callback)[source]

Bases: Learner

build_training_data(sample: dict | None, use_parameter_sharing: bool | None = False, use_actions_mask: bool | None = False, use_global_state: bool | None = False)[source]

Prepare the training data.

Parameters:
  • sample (dict) – The raw sampled data.

  • use_parameter_sharing (bool) – Whether to use parameter sharing for individual agent models.

  • use_actions_mask (bool) – Whether to use actions mask for unavailable actions.

  • use_global_state (bool) – Whether to use global state.

Returns:

The formatted sampled data.

Return type:

sample_Tensor (dict)

estimate_total_iterations()[source]

Estimated total number of training iterations

get_joint_input(input_tensor, output_shape=None)[source]
load_model(path, model=None)[source]
save_model(model_path)[source]
abstractmethod update(*args)[source]
update_rnn(*args)[source]