-
Notifications
You must be signed in to change notification settings - Fork 251
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
🐛[BUG]: OmegaConf's ListConfig
and DictConfig
are not JSON serializable
#133
Comments
Hi @mnabian Can you elaborate on what your running in this case? I'm imaging that the JSON saved in the model checkpoints is written by the checkpoint util, then read by the same util. Thus so long as the checkpoint functions can parse the JSON file in isolation, its fine. How does this JSON get processed by hydra? |
@NickGeneva this error occurs when saving the checkpoint and input arguments of a model instantiated using Hydra configs for the input arguments. In this case, the model arguments might contain some of OmegaConf's data types that aren't JSON-serializable. As a result, it gives an error when attempting to save the arguments in a JSON file |
@mnabian Which model is accepting direct hydra configs into its constructor? And is that a strict constraint? I'm assuming it is something like this? @hydra.main(...)
def main(cfg: DictConfig):
model = MyModel(cfg.model_params) |
@akshaysubr currently only the models in the unified recipe for weather prediction accept direct hydra configs. But I would also like to change other examples and have them all using hydra configs as a unified approach for handling configs in Modulus-Launch: NVIDIA/modulus-launch#91 |
This will be fixed at the call site. See the discussions here: #134 |
Version
0.3.0
On which installation method(s) does this occur?
No response
Describe the issue
With the recent checkpoint refactor, there is a constraint that the model arguments should be JSON serializable. The dominant approach for handling configs in Modulus is hydra configs, which relies on OmegaConf. Some of OmegaConf's data types are not serializable, including
ListConfig
andDictConfig
, which limits the use of the new checkpointing feature with hydra configs. We need to custom JSON encoder to handle these types.Minimum reproducible example
No response
Relevant log output
Environment details
No response
The text was updated successfully, but these errors were encountered: