You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When converting a DPA-2 .pth model to .dp format, an error is thrown (see below).
The reason is that we assume all NumPy arrays are in the @variables keys in the serialization data (see #2982). However, it seems that some arrays are stored out of the @variables.
We need to discuss whether we insist on this rule.
DeePMD-kit Version
devel
Backend and its version
How did you download the software?
Built from source
Input Files, Running Commands, Error Log, etc.
Traceback (most recent call last):
File "/home/jz748/anaconda3/bin/dp", line 8, in <module>
sys.exit(main())
File "/home/jz748/codes/deepmd-kit/deepmd/main.py", line 926, in main
deepmd_main(args)
File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/main.py", line 86, in main
convert_backend(**dict_args)
File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/convert_backend.py", line 27, in convert_backend
out_hook(OUTPUT, data)
File "/home/jz748/codes/deepmd-kit/deepmd/dpmodel/utils/serialization.py", line 106, in save_dp_model
f.attrs["json"] = json.dumps(save_dict, separators=(",", ":"))
File "/home/jz748/anaconda3/lib/python3.10/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/home/jz748/anaconda3/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/home/jz748/anaconda3/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/jz748/anaconda3/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable
Steps to Reproduce
cd examples/water/dpa2
# change the number of steps to 0
dp --pt train input_torch_small.json
dp --pt freeze
dp convert-backend frozen_model.pth frozen_model.dp
Further Information, Files, and Links
No response
The text was updated successfully, but these errors were encountered:
Bug summary
When converting a DPA-2
.pth
model to.dp
format, an error is thrown (see below).The reason is that we assume all NumPy arrays are in the
@variables
keys in the serialization data (see #2982). However, it seems that some arrays are stored out of the@variables
.deepmd-kit/deepmd/pt/model/descriptor/repformer_layer.py
Lines 1380 to 1388 in ff04d8b
We don't have a check to check it.
We need to discuss whether we insist on this rule.
DeePMD-kit Version
devel
Backend and its version
How did you download the software?
Built from source
Input Files, Running Commands, Error Log, etc.
Steps to Reproduce
Further Information, Files, and Links
No response
The text was updated successfully, but these errors were encountered: