Skip to content
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

Adds argument to set obs key to stable_baselines_export.py #212

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions godot_rl/wrappers/onnx/stable_baselines_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def forward(self, obs, state_ins):
return self.forward_ppo(obs, state_ins)


def export_model_as_onnx(model, onnx_model_path: str, use_obs_array: bool = False):
def export_model_as_onnx(model, onnx_model_path: str, use_obs_array: bool = False, obs_keys=None):
if obs_keys is None:
obs_keys = ["obs"]
policy = model.policy.to("cpu")
dummy_input = None
onnxable_model = None
Expand All @@ -55,7 +57,7 @@ def export_model_as_onnx(model, onnx_model_path: str, use_obs_array: bool = Fals

if isinstance(model, PPO):
onnxable_model = OnnxablePolicy(
["obs"],
obs_keys,
policy.features_extractor,
policy.mlp_extractor,
policy.action_net,
Expand Down
Loading