Skip to content

[BUG] restart file from v2.0.0.b4 cannot freeze models in v2.0.0 #1053

@njzjz

Description

@njzjz

Summary

Continue training from a checkpoint file in v2.0.0.b4 cannot freeze models in v2.0.0. #1000 breaks it. It worked after I removed model_type, train_attr/min_nbor_dist, and train_attr/training_script.

The following nodes will be frozen: ['model_type', 'descrpt_attr/rcut', 'descrpt_attr/ntypes', 'model_attr/tmap', 'model_attr/model_type', 'model_attr/model_version', 'train_attr/min_nbor_dist', 'train_attr/training_script', 'o_energy', 'o_force', 'o_virial', 'o_atom_energy', 'o_atom_virial', 'fitting_attr/dfparam', 'fitting_attr/daparam']
Traceback (most recent call last):
  File "/home/jz748/ambertools-dp/bin/dp", line 10, in <module>
    sys.exit(main())
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/deepmd/entrypoints/main.py", line 439, in main
    freeze(**dict_args)
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/deepmd/entrypoints/freeze.py", line 183, in freeze
    output_graph_def = tf.graph_util.convert_variables_to_constants(
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py", line 337, in new_func
    return func(*args, **kwargs)
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/framework/graph_util_impl.py", line 276, in convert_variables_to_constants
    ret = convert_to_constants.convert_variables_to_constants_from_session_graph(
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/framework/convert_to_constants.py", line 1160, in convert_variables_to_constants_from_session_graph
    converter_data=_SessionConverterData(
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/framework/convert_to_constants.py", line 857, in __init__
    graph_def = graph_util.extract_sub_graph(graph_def, output_node_names)
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py", line 337, in new_func
    return func(*args, **kwargs)
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/framework/graph_util_impl.py", line 209, in extract_sub_graph
    _assert_nodes_are_present(name_to_node, dest_nodes)
  File "/home/jz748/ambertools-dp/lib/python3.9/site-packages/tensorflow/python/framework/graph_util_impl.py", line 164, in _assert_nodes_are_present
    assert d in name_to_node, "%s is not in graph" % d
AssertionError: model_type is not in graph

Deepmd-kit version, installation way, input file, running commands, error log, etc.

v2.0.0

Steps to Reproduce

Train a model in v2.0.0.b4 without freezing, and freeze in v2.0.0.

Further Information, Files, and Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions