Using Multi-scale Fourier Neural networks

I previously had trouble implementing my code with multiscale_fourier networks.
after looking at Modulus Models - NVIDIA Docs by the advice in my previous post (Thanks!):
Could not unroll graph! - #11 by

I added frequencies and frequencies_param variables in my arch instantiation as such:

# make list of nodes to unroll graph on
    we = Wave2DEquation(u="u", c=1.0, s_func="s_func", dim=2, time=True)
    ob = OpenBoundary(u="u", c=1.0, dim=2, time=True)

    arch_cfg = cfg.arch.multiscale_fourier

    wave_net = instantiate_arch(
        input_keys=[Key("x"), Key("y"), Key("t")],
        frequencies = ("axis", [i for i in range(10)]),
        frequencies_param = ("axis", [i for i in range(10)]),
    source_net = instantiate_arch(
        input_keys=[Key("x"), Key("y"), Key("t")],
        frequencies = ("axis", [i for i in range(10)]),
        frequencies_param = ("axis", [i for i in range(10)]),

    #creating nodes
    nodes = (
        + ob.make_nodes()
        + [

I got this error;

Error executing job with overrides: []
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\modulus_env\lib\site-packages\modulus-22.9-py3.8.egg\modulus\hydra\", line 200, in instantiate_arch
    model, param = model_arch.from_config(model_cfg)
  File "C:\ProgramData\Anaconda3\envs\modulus_env\lib\site-packages\modulus-22.9-py3.8.egg\modulus\models\", line 533, in from_config
    model = cls(**params)
  File "C:\ProgramData\Anaconda3\envs\modulus_env\lib\site-packages\modulus-22.9-py3.8.egg\modulus\models\", line 114, in __init__
  File "C:\ProgramData\Anaconda3\envs\modulus_env\lib\site-packages\modulus-22.9-py3.8.egg\modulus\models\layers\", line 52, in __init__
    np_f = np.concatenate(np_f, axis=-2)
  File "<__array_function__ internals>", line 180, in concatenate
ValueError: need at least one array to concatenate

Any suggestions on how to use this type of PINNs correctly?


Seems theres two issues here:

  1. The keyword parameter is frequencies_params (with an s). So what you’re modifying in the instantiate_arch isn’t getting edited.
  2. Bug in the default type of this model / incorrect documentation on our end. For the MultiscaleFourierNetArch the frequencies and frequencies_params terms needs to be in an iterable (you can provide multiple apparently). E.g. for what you have something like this works:
MultiscaleFourierNetArch(input_keys=[Key("x"), Key("y"), Key("t")],
... output_keys=[Key("u")],
... frequencies = (("axis", [i for i in range(10)]),), # Note the additional tuple here
... frequencies_params = (("axis", [i for i in range(10)]),) # Note the additional tuple here

This is problem only for this model it seems, so other networks like Modified Fourier Net should work with out this fix. Thanks for reporting this.

1 Like

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