Issues with Hydra Configuration file in Google Collab

I’m using Modulus on Google Colab and was able to run the hydra example. Now, when trying to implement my own problem, it seems that I am having an issue with the configuration file.

When I run the traceback I get this:

I’m pretty sure the issue has to do with the configuration file as when I removed the wrapper @modulus.main(config_path="conf", config_name="conf_flow") the code works until I get to flow_slv = Solver(cfg, flow_domain) which needs a cfg to run.

I was wondering whether there were any workarounds to using a config file as its not working at all for me right now.

I’m just learning Modulus myself, but perhaps this will help.

The first error is saying that you passed -f into the command line and -f isn’t a command line parameter that it can recognize. You may be running it differently from how I do it, but removing -f should get rid of the first error. I assume you were doing -f mathieusalz1s_config.yaml, but I don’t believe this is necessary.

I was able to use my own config file by creating a new file in the conf folder. E.g. conf/my_config.yaml and specify that in the wrapper. For example my altered aneurism sample might be:

@modulus.main(config_path="conf", config_name="my_config")
def run(cfg: ModulusConfig) -> None:
1 Like

Hi @mathieusalz1

First confirm that theres no additional flag getting added when running. I’m not sure what that -f is.

Also, Hydra is known cause some head aches in Jupyter (an maybe Collab I suppose) notebooks. However, we provide a hydra compose function that should allow you to generate the config without the decorator. Give something like this a try:

from modulus.sym import compose
from omegaconf import OmegaConf

cfg = compose(config_name="config")
print(OmegaConf.to_yaml(cfg))

Some official Hydra docs on the compose function exists, but keep in mind that Modulus has its own implementation. I also found this sample collab notebook that may help.