Skip to content

Bug: Error when loading a model with the se_a_mask descriptor #3928

@wanghan-iapcm

Description

@wanghan-iapcm

Discussed in #3924

Originally posted by lukasbaldauf June 28, 2024
Hi All,
I want to evaluate a trained model using the se_a_mask descriptor, but I'm encountering an error. The training goes smoothly and I get good accuracies for my system, I'm just having trouble loading the model. I get the same error when evaluating the trained zinc_protein example system (see the error message below). It seems like something related to "dfparam" and "daparam", where the Tensors are missing.

I get the same errors for deepmd versions 2.2.7 and 2.2.10, and tensorflow versions 2.9.0 and 2.15.0.

For the zinc example, I train and freeze the model as such:

dp train zinc_se_a_mask.json --skip-neighbor-stat
dp freeze -o graph.mask.pb

The problem occurs when I want to load the model:

from deepmd.infer import DeepPot
model = DeepPot("graph.mask.pb")

Traceback (most recent call last):
File "", line 1, in
File "/home/lukasb/miniforge3/envs/deepmd_gpu_2.2.7/lib/python3.10/site-packages/deepmd/infer/deep_pot.py", line 156, in init
self._get_tensor(tensor_name, attr_name)
File "/home/lukasb/miniforge3/envs/deepmd_gpu_2.2.7/lib/python3.10/site-packages/deepmd/infer/deep_eval.py", line 165, in _get_tensor
tensor = self.graph.get_tensor_by_name(tensor_path)
File "/home/lukasb/miniforge3/envs/deepmd_gpu_2.2.7/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 4128, in get_tensor_by_name
return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
File "/home/lukasb/miniforge3/envs/deepmd_gpu_2.2.7/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 3952, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "/home/lukasb/miniforge3/envs/deepmd_gpu_2.2.7/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 3992, in _as_graph_element_locked
raise KeyError("The name %s refers to a Tensor which does not "
KeyError: "The name 'load/fitting_attr/dfparam:0' refers to a Tensor which does not exist. The operation, 'load/fitting_attr/dfparam', does not exist in the graph."

Metadata

Metadata

Assignees

Labels

bugreproducedThis bug has been reproduced by developers

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions