Skip to content

[BUG] ERROR at setup of TestDPTabulate.test_ops: ValueError: tf.enable_eager_execution must be called at program startup. #5110

@njzjz

Description

@njzjz

Bug summary

The CI error occurred at https://github.com/deepmodeling/deepmd-kit/actions/runs/20367227749/job/58525113372?pr=5104

DeePMD-kit Version

See CI log

Backend and its version

See CI log

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

__________________ ERROR at setup of TestDPTabulate.test_ops ___________________

    def setUpModule() -> None:
>       tf.compat.v1.enable_eager_execution()

source/tests/pt/test_tabulate.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.10.19/x64/lib/python3.10/site-packages/tensorflow/python/framework/ops.py:4988: in enable_eager_execution
    return enable_eager_execution_internal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

config = None, device_policy = None, execution_mode = None, server_def = None

    def enable_eager_execution_internal(config=None,
                                        device_policy=None,
                                        execution_mode=None,
                                        server_def=None) -> None:
      """Enables eager execution for the lifetime of this program.
    
      Most of the doc string for enable_eager_execution is relevant here as well.
    
      Args:
        config: See enable_eager_execution doc string
        device_policy: See enable_eager_execution doc string
        execution_mode: See enable_eager_execution doc string
        server_def: (Optional.) A tensorflow::ServerDef proto. Enables execution on
          remote devices. GrpcServers need to be started by creating an identical
          server_def to this, and setting the appropriate task_indexes, so that the
          servers can communicate. It will then be possible to execute operations on
          remote devices.
    
      Raises:
        ValueError
    
      """
      if config is not None and not isinstance(config, config_pb2.ConfigProto):
        raise TypeError("config must be a tf.ConfigProto, but got %s" %
                        type(config))
      if device_policy not in (None, context.DEVICE_PLACEMENT_EXPLICIT,
                               context.DEVICE_PLACEMENT_WARN,
                               context.DEVICE_PLACEMENT_SILENT,
                               context.DEVICE_PLACEMENT_SILENT_FOR_INT32):
        raise ValueError("device_policy must be one of None, DEVICE_PLACEMENT_*")
      if execution_mode not in (None, context.SYNC, context.ASYNC):
        raise ValueError("execution_mode must be one of None, SYNC, " "ASYNC")
      if context.default_execution_mode == context.GRAPH_MODE:
        graph_mode_has_been_used = (
            _default_graph_stack._global_default_graph is not None)  # pylint: disable=protected-access
        if graph_mode_has_been_used:
>         raise ValueError(
              "tf.enable_eager_execution must be called at program startup.")
E         ValueError: tf.enable_eager_execution must be called at program startup.

/opt/hostedtoolcache/Python/3.10.19/x64/lib/python3.10/site-packages/tensorflow/python/framework/ops.py:5052: ValueError

Steps to Reproduce

Occurred in the CI

Further Information, Files, and Links

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions