ray.rllib.algorithms.algorithm.Algorithm.remove_module#
- Algorithm.remove_module(module_id: str, *, new_agent_to_module_mapping_fn: Callable[[Any, SingleAgentEpisode | MultiAgentEpisode], str] | None = None, new_should_module_be_updated: Sequence[str] | Callable[[str, MultiAgentBatch | None], bool] | None = None, remove_from_learners: bool = True, remove_from_env_runners: bool = True, remove_from_eval_env_runners: bool = True) Policy | None [source]#
Removes a new (single-agent) RLModule from this Algorithm’s MARLModule.
- Parameters:
module_id – ID of the RLModule to remove from the MARLModule. IMPORTANT: Must not contain characters that are also not allowed in Unix/Win filesystems, such as:
<>:"/|?*
, or a dot, space or backslash at the end of the ID.new_agent_to_module_mapping_fn – An optional (updated) AgentID to ModuleID mapping function to use from here on. Note that already ongoing episodes will not change their mapping but will use the old mapping till the end of the episode.
new_should_module_be_updated – An optional sequence of ModuleIDs or a callable taking ModuleID and SampleBatchType and returning whether the ModuleID should be updated (trained). If None, will keep the existing setup in place. RLModules, whose IDs are not in the list (or for which the callable returns False) will not be updated.
remove_from_learners – Whether to remove the RLModule from the LearnerGroup (with its n Learners).
remove_from_env_runners – Whether to remove the RLModule from the EnvRunnerGroup (with its m EnvRunners plus the local one).
remove_from_eval_env_runners – Whether to remove the RLModule from the eval EnvRunnerGroup (with its o EnvRunners plus the local one).
- Returns:
The new MultiAgentRLModuleSpec (after the RLModule has been removed).