Skip to content

Commit bc9ba07

Browse files
committed
fix: Add fallback for json.loads in ServerClient
Handle cases where global_config_dict_yaml from head server is valid YAML but not valid JSON by falling back to direct OmegaConf.create(). Signed-off-by: Wedu <wedu@nvidia.com>
1 parent f250e0c commit bc9ba07

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nemo_gym/server_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ def load_from_global_config(cls, head_server_config: Optional[BaseServerConfig]
218218
) from e
219219

220220
global_config_dict_yaml = response.content.decode()
221-
global_config_dict = OmegaConf.create(json.loads(global_config_dict_yaml))
221+
try:
222+
global_config_dict = OmegaConf.create(json.loads(global_config_dict_yaml))
223+
except (json.JSONDecodeError, ValueError):
224+
global_config_dict = OmegaConf.create(global_config_dict_yaml)
222225

223226
return cls(head_server_config=head_server_config, global_config_dict=global_config_dict)
224227

0 commit comments

Comments
 (0)