Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot convert dipole model from TF to PT #3672

Open
njzjz opened this issue Apr 14, 2024 · 1 comment
Open

[BUG] Cannot convert dipole model from TF to PT #3672

njzjz opened this issue Apr 14, 2024 · 1 comment
Labels
bug reproduced This bug has been reproduced by developers
Milestone

Comments

@njzjz
Copy link
Member

njzjz commented Apr 14, 2024

Bug summary

An error throws when using dp convert-backend to convert a frozen dipole model from TF .pb format to PT .pth format.

DeePMD-kit Version

3eb3d51 (edit mode)

Backend and its version

TF 2.15.0, PT 2.1.2.post300

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 807, in main
    deepmd_main(args)
  File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/main.py", line 83, in main
    convert_backend(**dict_args)
  File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/convert_backend.py", line 26, in convert_backend
    data = inp_hook(INPUT)
  File "/home/jz748/codes/deepmd-kit/deepmd/tf/utils/serialization.py", line 47, in serialize_from_file
    model_dict = model.serialize()
  File "/home/jz748/codes/deepmd-kit/deepmd/tf/model/model.py", line 825, in serialize
    dict_fit = self.fitting.serialize(suffix=suffix)
  File "/home/jz748/codes/deepmd-kit/deepmd/tf/fit/dipole.py", line 375, in serialize
    "nets": self.serialize_network(
  File "/home/jz748/codes/deepmd-kit/deepmd/tf/fit/fitting.py", line 206, in serialize_network
    return fittings.serialize()
  File "/home/jz748/codes/deepmd-kit/deepmd/dpmodel/utils/network.py", line 769, in serialize
    "networks": [nn.serialize() for nn in self._networks],
  File "/home/jz748/codes/deepmd-kit/deepmd/dpmodel/utils/network.py", line 769, in <listcomp>
    "networks": [nn.serialize() for nn in self._networks],
AttributeError: 'NoneType' object has no attribute 'serialize'

Steps to Reproduce

cd examples/water_tensor/dipole
dp --tf train dipole_input.json
dp --tf freeze
dp convert-backend frozen_model.pb frozen_model.pth 

Further Information, Files, and Links

No response

@njzjz njzjz added the bug label Apr 14, 2024
@njzjz njzjz added this to the v3.0.0 milestone Apr 14, 2024
@njzjz njzjz added the reproduced This bug has been reproduced by developers label Apr 14, 2024
@njzjz
Copy link
Member Author

njzjz commented Apr 15, 2024

I think I got the reason. Only types in sel_type have networks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reproduced This bug has been reproduced by developers
Development

No branches or pull requests

1 participant