Dear All,
I am using Nvidia modulus 22.09
I am trying to change the activation function for the LDC problem.
But When I import the required library as shown in the tutorial:
from modulus.models.layers.layers import Activation
I get this error
No module named ‘modulus.models.layers.layers’
Thanks in advance
Hi @omarkhaledsallam
Please try from modulus.models.layers import Activation
Which tutorial are you referring to here? Please provide the link if you can and we will get it fixed. Thank you!
Thanks for you reply
I get this from the tutorial link below:
https://docs.nvidia.com/deeplearning/modulus/user_guide/features/configuration.html
In the (Changing Activation Functions) section
I changed the the import to
from modulus.models.layers import Activation
and it worked :)
Thanks
Hi @ngeneva
I wanted to change the activation function as well and I already changed the path.
However, I get following error:
Error executing job with overrides: []
Traceback (most recent call last):
File "/software/modulus/22.09/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/hydra/utils.py", line 200, in instantiate_arch
model, param = model_arch.from_config(model_cfg)
File "/software/modulus/22.09/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/models/arch.py", line 500, in from_config
cfg["activation_fn"] = Activation[cfg["activation_fn"]]
File "/software/modulus/22.09/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/models/layers/activation.py", line 16, in __getitem__
return super().__getitem__(name.upper())
AttributeError: 'Activation' object has no attribute 'upper'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "cylinder_2d.py", line 85, in run
flow_net = instantiate_arch(
File "/software/modulus/22.09/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/hydra/utils.py", line 210, in instantiate_arch
raise Exception(fail) from e
Exception: Failed to initialize architecture.
{'input_keys': [x, y], 'output_keys': [u, v, p], 'detach_keys': [???], 'scaling': None, 'layer_size': 512, 'nr_layers': 6, 'skip_connections': False, 'activation_fn': <Activation.SILU: 9>, 'adaptive_activations': False, 'weight_norm': True}
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 121742) of binary: /software/modulus/22.09/bin/python3.8
Traceback (most recent call last):
File "/software/modulus/22.09/bin/torchrun", line 8, in <module>
sys.exit(main())
File "/software/modulus/22.09/lib/python3.8/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
return f(*args, **kwargs)
File "/software/modulus/22.09/lib/python3.8/site-packages/torch/distributed/run.py", line 762, in main
run(args)
File "/software/modulus/22.09/lib/python3.8/site-packages/torch/distributed/run.py", line 753, in run
elastic_launch(
File "/software/modulus/22.09/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
return launch_agent(self._config, self._entrypoint, list(args))
File "/software/modulus/22.09/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
How can fix this issue?
Many thanks in advance.