rezaakb / pinns-tf2 Goto Github PK
View Code? Open in Web Editor NEWPINNs-TF2, Physics-informed Neural Networks (PINNs) implemented in TensorFlow V2.
License: BSD 3-Clause "New" or "Revised" License
PINNs-TF2, Physics-informed Neural Networks (PINNs) implemented in TensorFlow V2.
License: BSD 3-Clause "New" or "Revised" License
Hi,
I got the following error when trying the train.py in navier-stokes example. The tensorflow version is 2.12.0, and hydra-core is 1.3.2. Would you please help? Thank you.
Traceback (most recent call last):
File "train.py", line 8, in
import pinnstf2
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/site-packages/pinnstf2/init.py", line 1, in
from pinnstf2.train import train
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/site-packages/pinnstf2/train.py", line 16, in
from pinnstf2.models import PINNModule
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/site-packages/pinnstf2/models/init.py", line 2, in
from .pinn_module import PINNModule
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/site-packages/pinnstf2/models/pinn_module.py", line 14, in
class PINNModule:
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/site-packages/pinnstf2/models/pinn_module.py", line 18, in PINNModule
pde_fn: Callable[[Any, ...], tf.Tensor],
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/typing.py", line 816, in getitem
return self.getitem_inner(params)
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/typing.py", line 261, in inner
return func(*args, **kwds)
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/typing.py", line 839, in getitem_inner
args = tuple(_type_check(arg, msg) for arg in args)
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/typing.py", line 839, in
args = tuple(_type_check(arg, msg) for arg in args)
File "/opt/anaconda3/envs/PINNTF2/lib/python3.8/typing.py", line 149, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
I tried to predict velocity fields from pasive scalar concentaration.
However it didn't work. Same velocity magnitude values were obtained in every node.
Is this library able to applied to very slow flow (Re<1) ?
If you have ant solutions, could you give the tips ?
I want to know if we can do only "t" in the input layer. If we can please write a few lines on how to do it thanks.
For example, I want to solve Lorenz system using pinns.
Hi, to implement the app in the google colab I used
from hydra import initialize, compose
if __name__ == "__main__":
with initialize(version_base=None, config_path="configs"):
cfg = compose(config_name="config.yaml")
main(cfg)
but the following error is raised.
---------------------------------------------------------------------------
InterpolationResolutionError Traceback (most recent call last)
[<ipython-input-28-7740892df83b>](https://localhost:8080/#) in <cell line: 2>()
3 with initialize(version_base=None, config_path="configs"):
4 cfg = compose(config_name="config.yaml")
----> 5 main(cfg)
28 frames
[<ipython-input-2-39423ea7b27c>](https://localhost:8080/#) in main(cfg)
75 # apply extra utilities
76 # (e.g. ask for tags if none are provided in cfg, print cfg tree, etc.)
---> 77 pinnstf2.utils.extras(cfg)
78
79 # train the model
[/usr/local/lib/python3.10/dist-packages/pinnstf2/utils/utils.py](https://localhost:8080/#) in extras(cfg)
36 if cfg.extras.get("enforce_tags"):
37 log.info("Enforcing tags! <cfg.extras.enforce_tags=True>")
---> 38 rich_utils.enforce_tags(cfg, save_to_file=True)
39
40 # pretty print config tree using Rich library
[/usr/local/lib/python3.10/dist-packages/pinnstf2/utils/rich_utils.py](https://localhost:8080/#) in enforce_tags(cfg, save_to_file)
93
94 if save_to_file:
---> 95 with open(Path(cfg.paths.output_dir, "tags.log"), "w") as file:
96 rich.print(cfg.tags, file=file)
[/usr/local/lib/python3.10/dist-packages/omegaconf/dictconfig.py](https://localhost:8080/#) in __getattr__(self, key)
357 )
358 except Exception as e:
--> 359 self._format_and_raise(key=key, value=None, cause=e)
360
361 def __getitem__(self, key: DictKeyType) -> Any:
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in _format_and_raise(self, key, value, cause, msg, type_override)
229 type_override: Any = None,
230 ) -> None:
--> 231 format_and_raise(
232 node=self,
233 key=key,
[/usr/local/lib/python3.10/dist-packages/omegaconf/_utils.py](https://localhost:8080/#) in format_and_raise(node, key, value, msg, cause, type_override)
897 ex.ref_type_str = ref_type_str
898
--> 899 _raise(ex, cause)
900
901
[/usr/local/lib/python3.10/dist-packages/omegaconf/_utils.py](https://localhost:8080/#) in _raise(ex, cause)
795 else:
796 ex.__cause__ = None
--> 797 raise ex.with_traceback(sys.exc_info()[2]) # set env var OC_CAUSE=1 for full trace
798
799
[/usr/local/lib/python3.10/dist-packages/omegaconf/dictconfig.py](https://localhost:8080/#) in __getattr__(self, key)
349
350 try:
--> 351 return self._get_impl(
352 key=key, default_value=_DEFAULT_MARKER_, validate_key=False
353 )
[/usr/local/lib/python3.10/dist-packages/omegaconf/dictconfig.py](https://localhost:8080/#) in _get_impl(self, key, default_value, validate_key)
449 raise
450 assert isinstance(node, Node)
--> 451 return self._resolve_with_default(
452 key=key, value=node, default_value=default_value
453 )
[/usr/local/lib/python3.10/dist-packages/omegaconf/basecontainer.py](https://localhost:8080/#) in _resolve_with_default(self, key, value, default_value)
96 raise MissingMandatoryValue("Missing mandatory value: $FULL_KEY")
97
---> 98 resolved_node = self._maybe_resolve_interpolation(
99 parent=self,
100 key=key,
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in _maybe_resolve_interpolation(self, parent, key, value, throw_on_resolution_failure, memo)
717
718 parse_tree = parse(_get_value(value))
--> 719 return self._resolve_interpolation_from_parse_tree(
720 parent=parent,
721 value=value,
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in _resolve_interpolation_from_parse_tree(self, parent, value, key, parse_tree, throw_on_resolution_failure, memo)
582
583 try:
--> 584 resolved = self.resolve_parse_tree(
585 parse_tree=parse_tree, node=value, key=key, memo=memo
586 )
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in resolve_parse_tree(self, parse_tree, node, memo, key)
767 except Exception as exc:
768 # Other kinds of exceptions are wrapped in an `InterpolationResolutionError`.
--> 769 raise InterpolationResolutionError(
770 f"{type(exc).__name__} raised while resolving interpolation: {exc}"
771 ).with_traceback(sys.exc_info()[2])
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in resolve_parse_tree(self, parse_tree, node, memo, key)
762 )
763 try:
--> 764 return visitor.visit(parse_tree)
765 except InterpolationResolutionError:
766 raise
[/usr/local/lib/python3.10/dist-packages/antlr4/tree/Tree.py](https://localhost:8080/#) in visit(self, tree)
32 class ParseTreeVisitor(object):
33 def visit(self, tree):
---> 34 return tree.accept(self)
35
36 def visitChildren(self, node):
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar/gen/OmegaConfGrammarParser.py](https://localhost:8080/#) in accept(self, visitor)
204 def accept(self, visitor:ParseTreeVisitor):
205 if hasattr( visitor, "visitConfigValue" ):
--> 206 return visitor.visitConfigValue(self)
207 else:
208 return visitor.visitChildren(self)
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar_visitor.py](https://localhost:8080/#) in visitConfigValue(self, ctx)
99 # text EOF
100 assert ctx.getChildCount() == 2
--> 101 return self.visit(ctx.getChild(0))
102
103 def visitDictKey(self, ctx: OmegaConfGrammarParser.DictKeyContext) -> Any:
[/usr/local/lib/python3.10/dist-packages/antlr4/tree/Tree.py](https://localhost:8080/#) in visit(self, tree)
32 class ParseTreeVisitor(object):
33 def visit(self, tree):
---> 34 return tree.accept(self)
35
36 def visitChildren(self, node):
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar/gen/OmegaConfGrammarParser.py](https://localhost:8080/#) in accept(self, visitor)
340 def accept(self, visitor:ParseTreeVisitor):
341 if hasattr( visitor, "visitText" ):
--> 342 return visitor.visitText(self)
343 else:
344 return visitor.visitChildren(self)
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar_visitor.py](https://localhost:8080/#) in visitText(self, ctx)
296 c = ctx.getChild(0)
297 if isinstance(c, OmegaConfGrammarParser.InterpolationContext):
--> 298 return self.visitInterpolation(c)
299
300 # Otherwise, concatenate string representations together.
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar_visitor.py](https://localhost:8080/#) in visitInterpolation(self, ctx)
123 ) -> Any:
124 assert ctx.getChildCount() == 1 # interpolationNode | interpolationResolver
--> 125 return self.visit(ctx.getChild(0))
126
127 def visitInterpolationNode(
[/usr/local/lib/python3.10/dist-packages/antlr4/tree/Tree.py](https://localhost:8080/#) in visit(self, tree)
32 class ParseTreeVisitor(object):
33 def visit(self, tree):
---> 34 return tree.accept(self)
35
36 def visitChildren(self, node):
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar/gen/OmegaConfGrammarParser.py](https://localhost:8080/#) in accept(self, visitor)
1039 def accept(self, visitor:ParseTreeVisitor):
1040 if hasattr( visitor, "visitInterpolationResolver" ):
-> 1041 return visitor.visitInterpolationResolver(self)
1042 else:
1043 return visitor.visitChildren(self)
[/usr/local/lib/python3.10/dist-packages/omegaconf/grammar_visitor.py](https://localhost:8080/#) in visitInterpolationResolver(self, ctx)
177 args_str.append(txt)
178
--> 179 return self.resolver_interpolation_callback(
180 name=resolver_name,
181 args=tuple(args),
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in resolver_interpolation_callback(name, args, args_str)
748 name: str, args: Tuple[Any, ...], args_str: Tuple[str, ...]
749 ) -> Any:
--> 750 return self._evaluate_custom_resolver(
751 key=key,
752 node=node,
[/usr/local/lib/python3.10/dist-packages/omegaconf/base.py](https://localhost:8080/#) in _evaluate_custom_resolver(self, key, node, inter_type, inter_args, inter_args_str)
692 if resolver is not None:
693 root_node = self._get_root()
--> 694 return resolver(
695 root_node,
696 self,
[/usr/local/lib/python3.10/dist-packages/omegaconf/omegaconf.py](https://localhost:8080/#) in resolver_wrapper(config, parent, node, args, args_str)
443 kwargs["_root_"] = config
444
--> 445 ret = resolver(*args, **kwargs)
446
447 if use_cache:
[/usr/local/lib/python3.10/dist-packages/hydra/core/utils.py](https://localhost:8080/#) in <lambda>(path)
218 OmegaConf.register_new_resolver(
219 "hydra",
--> 220 lambda path: OmegaConf.select(cast(DictConfig, HydraConfig.get()), path),
221 replace=True,
222 )
[/usr/local/lib/python3.10/dist-packages/hydra/core/hydra_config.py](https://localhost:8080/#) in get()
29 instance = HydraConfig.instance()
30 if instance.cfg is None:
---> 31 raise ValueError("HydraConfig was not set")
32 return instance.cfg.hydra # type: ignore
33
InterpolationResolutionError: ValueError raised while resolving interpolation: HydraConfig was not set
full_key: paths.output_dir
object_type=dict
I'm not sure what's going wrong with hydra setup that raises this problem, and I'd very much appreciate any help on this. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.