teoroo-cmc / pinn Goto Github PK
View Code? Open in Web Editor NEWA Python library for building atomic neural networks
Home Page: https://teoroo-cmc.github.io/PiNN
License: BSD 3-Clause "New" or "Revised" License
A Python library for building atomic neural networks
Home Page: https://teoroo-cmc.github.io/PiNN
License: BSD 3-Clause "New" or "Revised" License
lj.zip
I tried to run the attached LJ example (tensorflow 2.9.1, python 3.8.12) but received the following error
WARNING:tensorflow:From /home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/training_util.py:396: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.
WARNING:tensorflow:From /home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/training_util.py:396: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.
2022-11-16 16:21:11.919525: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
WARNING:tensorflow:From /home/hellstrom/software/PiNN/pinn/io/numpy.py:33: calling DatasetV2.from_generator (from tensorflow.python.data.ops.dataset_ops) with output_types is deprecated and will be removed in a future version.
Instructions for updating:
Use output_signature instead
WARNING:tensorflow:From /home/hellstrom/software/PiNN/pinn/io/numpy.py:33: calling DatasetV2.from_generator (from tensorflow.python.data.ops.dataset_ops) with output_types is deprecated and will be removed in a future version.
Instructions for updating:
Use output_signature instead
WARNING:tensorflow:From /home/hellstrom/software/PiNN/pinn/io/numpy.py:33: calling DatasetV2.from_generator (from tensorflow.python.data.ops.dataset_ops) with output_shapes is deprecated and will be removed in a future version.
Instructions for updating:
Use output_signature instead
WARNING:tensorflow:From /home/hellstrom/software/PiNN/pinn/io/numpy.py:33: calling DatasetV2.from_generator (from tensorflow.python.data.ops.dataset_ops) with output_shapes is deprecated and will be removed in a future version.
Instructions for updating:
Use output_signature instead
3144 trainable vaiabless, training with float32 precision.
Traceback (most recent call last):
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1377, in _do_call
return fn(*args)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1360, in _run_fn
return self._call_tf_sessionrun(options, feed_dict, fetch_list,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1453, in _call_tf_sessionrun
return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [300,8] vs. [299,8]
[[{{node TRAIN_OP/gradients/pi_net/res_update/add_grad/BroadcastGradientArgs}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Learn_LJ_potential.py", line 139, in <module>
tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 504, in train_and_evaluate
return executor.run()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 645, in run
return self.run_local()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 742, in run_local
self._estimator.train(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 360, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1186, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1217, in _train_model_default
return self._train_with_estimator_spec(estimator_spec, worker_hooks,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1533, in _train_with_estimator_spec
_, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 782, in run
return self._sess.run(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 1311, in run
return self._sess.run(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 1416, in run
raise six.reraise(*original_exc_info)
File "/home/hellstrom/adfhome/bin.gnu/python3.8/lib/python3.8/site-packages/six.py", line 719, in reraise
raise value
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 1401, in run
return self._sess.run(*args, **kwargs)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 1469, in run
outputs = _WrappedSession.run(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/training/monitored_session.py", line 1232, in run
return self._sess.run(*args, **kwargs)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 967, in run
result = self._run(None, fetches, feed_dict, options_ptr,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1190, in _run
results = self._do_run(handle, final_targets, final_fetches,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1370, in _do_run
return self._do_call(_run_fn, feeds, fetches, targets, options,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1396, in _do_call
raise type(e)(node_def, op, message) # pylint: disable=no-value-for-parameter
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:
Detected at node 'TRAIN_OP/gradients/pi_net/res_update/add_grad/BroadcastGradientArgs' defined at (most recent call last):
File "Learn_LJ_potential.py", line 139, in <module>
tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 504, in train_and_evaluate
return executor.run()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 645, in run
return self.run_local()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 742, in run_local
self._estimator.train(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 360, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1186, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1214, in _train_model_default
estimator_spec = self._call_model_fn(features, labels, ModeKeys.TRAIN,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1174, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/models/potential.py", line 67, in potential_model
train_op = get_train_op(params['optimizer'], metrics, tvars,
File "/home/hellstrom/software/PiNN/pinn/utils.py", line 136, in named_layer
return func(*args, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/models/base.py", line 101, in get_train_op
grads = tf.gradients(loss, tvars)
Node: 'TRAIN_OP/gradients/pi_net/res_update/add_grad/BroadcastGradientArgs'
Incompatible shapes: [300,8] vs. [299,8]
[[{{node TRAIN_OP/gradients/pi_net/res_update/add_grad/BroadcastGradientArgs}}]]
Original stack trace for 'TRAIN_OP/gradients/pi_net/res_update/add_grad/BroadcastGradientArgs':
File "Learn_LJ_potential.py", line 139, in <module>
tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 504, in train_and_evaluate
return executor.run()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 645, in run
return self.run_local()
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/training.py", line 742, in run_local
self._estimator.train(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 360, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1186, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1214, in _train_model_default
estimator_spec = self._call_model_fn(features, labels, ModeKeys.TRAIN,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1174, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/models/potential.py", line 67, in potential_model
train_op = get_train_op(params['optimizer'], metrics, tvars,
File "/home/hellstrom/software/PiNN/pinn/utils.py", line 136, in named_layer
return func(*args, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/models/base.py", line 101, in get_train_op
grads = tf.gradients(loss, tvars)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/gradients_impl.py", line 311, in gradients_v2
return gradients_util._GradientsHelper(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/gradients_util.py", line 695, in _GradientsHelper
in_grads = _MaybeCompile(grad_scope, op, func_call,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/gradients_util.py", line 328, in _MaybeCompile
return grad_fn() # Exit early
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/gradients_util.py", line 696, in <lambda>
lambda: grad_fn(op, *out_grads))
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/math_grad.py", line 1302, in _AddGrad
SmartBroadcastGradientArgs(x, y, grad))
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/math_grad.py", line 106, in SmartBroadcastGradientArgs
rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/gen_array_ops.py", line 771, in broadcast_gradient_args
_, _, _op, _outputs = _op_def_library._apply_op_helper(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/framework/op_def_library.py", line 797, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 3754, in _create_op_internal
ret = Operation(
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 2133, in __init__
self._traceback = tf_stack.extract_stack_for_node(self._c_op)
...which was originally created as op 'pi_net/res_update/add', defined at:
File "Learn_LJ_potential.py", line 139, in <module>
tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
[elided 6 identical lines from previous traceback]
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1174, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/models/potential.py", line 58, in potential_model
pred = network(features)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 64, in error_handler
return fn(*args, **kwargs)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/keras/engine/training.py", line 490, in __call__
return super().__call__(*args, **kwargs)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/keras/engine/base_layer_v1.py", line 763, in __call__
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/networks/pinet.py", line 196, in call
for i in range(self.depth):
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/autograph/operators/control_flow.py", line 449, in for_stmt
_py_for_stmt(iter_, extra_test, body, None, None)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/autograph/operators/control_flow.py", line 498, in _py_for_stmt
body(target)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/autograph/operators/control_flow.py", line 464, in protected_body
original_body(protected_iter)
File "/home/hellstrom/software/PiNN/pinn/networks/pinet.py", line 199, in call
tensors['prop'] = self.res_update[i]([tensors['prop'], prop])
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/keras/engine/base_layer_v1.py", line 763, in __call__
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/home/hellstrom/software/PiNN/pinn/networks/pinet.py", line 128, in call
return self.transform(old) + new
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 150, in error_handler
return fn(*args, **kwargs)
File "/home/hellstrom/.scm/python/AMS2022.2.venv/lib/python3.8/site-packages/tensorflow/python/ops/math_ops.py", line 1406, in binary_op_wrapper
return func(x, y, name=name)
Trying to go though the examples in the documentation, I ran into this error with Loading data.
when I run the command:
datalist = [Atoms(elem) for elem in ['Cu', 'Ag', 'Au']]
dataset = load_ase_list(datalist)['train']
"d = dataset.make_one_shot_iterator().get_next()"
error:
AttributeError: 'FlatMapDataset' object has no attribute 'make_one_shot_iterator'
Can someone help me understand this error and how to fix it?
Had the same issue, I had to change the /github/workflow/ with /github/actions/workflow/ and add the explicit .yml extension of my action to get it working.
I wish to use bpnn for nonperiodic (molecule) system.
The following error is returned by the model=potential_model(params) line:
File "E:\anaconda3\envs\p37env\lib\site-packages\yaml\representer.py", line 317, in represent_object
reduce = data.reduce_ex(2)
TypeError: can't pickle SwigPyObject objects
Thank you in advance for a comment in this issue.
Recent TensorFlow versions seem to break some important parts of PiNN.
I still need some time to pinpoint the problem, but according to this preliminary test:
The 2.10 version seem to break the jacobian calculation used in BPNN;
and the 2.11 version breaks basic derivative calcualtions used for potential models.
For now, I'll just mark those as incompatible in README, will update when I know more.
Dear developers,
It's generally favorable to migrate to TF2, I'm aware of the following advantages
After some further fixes (mostly cleaning of naming) and upgrading
the current code base to TF1.15 (last 1.X) version, I'll try migrating
the code to TF2.
I'll not likely start immediately, but welcome comments and suggestions.
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.