learner

class xuance.tensorflow.learners.learner.Learner(config: Namespace, policy: tensorflow.keras.Model, callback)[source]

Bases: ABC

estimate_total_iterations()[source]

Estimated total number of training iterations

load_model(path, model=None)[source]
save_model(model_path)[source]
abstractmethod update(*args)[source]
class xuance.tensorflow.learners.learner.LearnerMAS(config: Namespace, model_keys: List[str], agent_keys: List[str], policy: tensorflow.keras.Model, callback)[source]

Bases: ABC

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)

load_model(path, seed=1)[source]
save_model(model_path)[source]
abstractmethod update(*args)[source]
update_rnn(*args)[source]