Skip to content

Commit f8e172c

Browse files
[RLlib][fix] Fixed a small bug in type hints of the 'learner_connector'. (#57673)
<!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? The type hints for `learner_connector` in `AlgorithmConfig.training` was deprecated still using the `RLModule` as parameter. This PR adjust type hints to the actual expected form of the callable. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run pre-commit jobs to lint the changes in this PR. ([pre-commit setup](https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#lint-and-formatting)) - [x] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: simonsays1980 <[email protected]>
1 parent 993139e commit f8e172c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rllib/algorithms/algorithm_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,10 @@ def training(
23542354
# Moved to `learners()` method.
23552355
learner_class: Optional[Type["Learner"]] = NotProvided,
23562356
learner_connector: Optional[
2357-
Callable[["RLModule"], Union["ConnectorV2", List["ConnectorV2"]]]
2357+
Callable[
2358+
[gym.spaces.Space, gym.spaces.Space],
2359+
Union["ConnectorV2", List["ConnectorV2"]],
2360+
]
23582361
] = NotProvided,
23592362
add_default_connectors_to_learner_pipeline: Optional[bool] = NotProvided,
23602363
learner_config_dict: Optional[Dict[str, Any]] = NotProvided,

0 commit comments

Comments
 (0)