VTK writer bug

Hello, the VTK writer has some issues when running any example with Modulus 22.09 (bare metal installation). This is the error:

2022-10-14 06:01:21.471160: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
Error executing job with overrides:
Traceback (most recent call last):
File “helmholtz.py”, line 92, in run
slv.solve()
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/solver/solver.py”, line 159, in solve
self._train_loop(sigterm_handler)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/trainer.py”, line 593, in _train_loop
self._record_constraints()
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/trainer.py”, line 275, in _record_constraints
self.record_constraints()
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/solver/solver.py”, line 116, in record_constraints
self.domain.rec_constraints(self.network_dir)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/domain/domain.py”, line 45, in rec_constraints
constraint.save_batch(constraint_data_dir + key)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/domain/constraint/continuous.py”, line 77, in save_batch
var_to_polyvtk(save_var, filename)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/utils/io/vtk.py”, line 959, in var_to_polyvtk
vtk_obj.var_to_vtk(data_vars=var_dict)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/utils/io/vtk.py”, line 144, in var_to_vtk
self.save_vtk(file_name, file_dir)
File “/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/utils/io/vtk.py”, line 165, in save_vtk
self.writer.SetFileName(file_path)
TypeError: SetFileName argument 1: string or None required

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.


Code for this is here: https://gitlab.com/nvidia/modulus/modulus/-/blob/release_22.09/modulus/utils/io/vtk.py#L165

…and what I did to make this work is to manually edit it to be:

self.writer.SetFileName(str(file_path))

Is it possible to change this in Modulus source? This problem has persisted since 22.07.

I have used 22.07 with bare metal. It works just fine. How did you install the dependencies?

@michaltakac

Thanks for the report.

Is there a chance you can print out what type of object file_path is when this is causing this error? Curious to know what it is other than a string. Have not seen this occur before.

My only guess would be that somehow your constraint name is not a valid string somehow, but I am not sure how thats occurring (the filename is based on the name of the constraint you give when adding it to the domain).

But not sure how thats possible here.