universal-sentence-encoder-fine-tune icon indicating copy to clipboard operation
universal-sentence-encoder-fine-tune copied to clipboard

Running into: `ValueError: cannot add an op with id 133 as it already exists in the graph`

Open madhavthaker opened this issue 2 years ago • 0 comments

Tensorflow versions:

tensorflow               1.15.2
tensorflow-estimator     1.15.1
tensorflow-hub           0.9.0
tensorflow-text          1.15.1

I'm running the code as is and I'm consistently running into the following error:

/tmp/ipykernel_1454/3669827002.py in main()
     24             ops_list = g1.get_operations()
     25             for op in g1.get_operations():
---> 26                 copy_op_to_graph(op, g2, variables, scope)
     27             # copy table initilization
     28             copy_op_to_graph(tf.tables_initializer(), g2, variables, scope)

/tmp/ipykernel_1454/1749896782.py in copy_op_to_graph(org_instance, to_graph, variables, scope)
    190                            op_def)
    191     #Use Graph's hidden methods to add the op
--> 192     to_graph._add_op(new_op)  # pylint: disable=protected-access
    193     to_graph._record_op_seen_by_control_dependencies(new_op)
    194     for device_function in reversed(to_graph._device_function_stack):

/opt/miniconda/envs/product_recos_description_model/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py in _add_op(self, op)
   3015       if op._id in self._nodes_by_id:
   3016         raise ValueError("cannot add an op with id %d as it already "
-> 3017                          "exists in the graph" % op._id)
   3018       if op.name in self._nodes_by_name:
   3019         raise ValueError("cannot add op with name %s as that name "

ValueError: cannot add an op with id 133 as it already exists in the graph

I'm wondering if anyone else has run into this error.

madhavthaker avatar Apr 26 '22 03:04 madhavthaker