Running LDC example from modulus sym in Jupyter notebook

Hi,
I’m trying to reproduce the LDC example from Modulus sym step by step on a jupyter notebook.

I attempted the following in order to load the config into my Jupyter notebook:

import omegaconf
cfg = omegaconf.OmegaConf.load("conf/config.yaml”)

This works for some attributes such as cfg.batch_size, but throws an error when I try to use it here:


flow_net = instantiate_arch(
       input_keys=[Key("x"), Key("y")],
       output_keys=[Key("u"), Key("v"), Key("p")],
       cfg=cfg.arch.fully_connected,
      )

In particular it says:

ConfigAttributeError: Missing key arch
   full_key: arch
   object_type=dict

What’s the correct way to load the cfg into a Jupyter notebook? (i.e. is there a way around using the python decorator that’s used in the scripts?)

Hi,

although I haven’t tried it myself in a Jupyter notebook, you could try to use the FullyConnectedArch class directly instead of using the hydra instantiate_arch method like:

from modulus.sym.models.fully_connected import FullyConnectedArch

input_keys = [Key("x"), Key("y")]
output_keys = [Key("u"), Key("v"), Key("p")],

flow_net = FullyConnectedArch(input_keys=input_keys, output_keys=output_keys)

This is also described here: FPGA Heat Sink with Laminar Flow - NVIDIA Docs

Thanks for the suggestion, I found the following alternative which worked for me in the notebook:

from modulus.sym.hydra.utils import compose
cfg = compose(config_path="conf", config_name="config")

It’s described here: Jupyter Notebook workflow - NVIDIA docs

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.