-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[rllib] Fix custom model-config mismatch between env-runner and learner #58739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,7 +130,19 @@ def set_state(self, state: StateDict) -> None: | |
| # these keys (strict=False). This is most likely due to `state` coming from | ||
| # an `inference_only=False` RLModule, while `self` is an `inference_only=True` | ||
| # RLModule. | ||
| self.load_state_dict(convert_to_torch_tensor(state), strict=False) | ||
| missing_keys, unexpected_keys = self.load_state_dict( | ||
| convert_to_torch_tensor(state), strict=False | ||
| ) | ||
|
|
||
| # For inference_only modules, missing_keys should always be empty. | ||
| # If there are missing keys, it means the target module expects parameters | ||
| # that don't exist in the source, indicating an architecture mismatch. | ||
| if self.inference_only and missing_keys: | ||
| raise ValueError( | ||
| "Architecture mismatch detected when loading state into inference_only module! " | ||
| f"Missing parameters (not found in source state): {list(missing_keys)} " | ||
| "This usually indicates the learner and env-runner have different architectures." | ||
|
||
| ) | ||
|
|
||
| @OverrideToImplementCustomLogic | ||
| @override(RLModule) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.