TPU VM Training Error - tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'SentencepieceOp' in binary running

Author: TambourineMan42Created Jan 27, 2022Updated May 20, 2023

Describe the bug When I run any of the fine-tuning scripts with my own training tsv file on TPU-VM (using v3-8 and v2-alpha-pod), it prematurely ends training (fails to even start). To Reproduce Steps to reproduce the behavior:

  1. In the VM I've tried everything from just pip install t5[gcp] to installing from source both mesh and text-to-text-transfer-transformer.

Expected behavior Here is the entire stack trace:

bash
INFO:tensorflow:training_loop marked as finished
I0127 00:07:37.772910 139764176627712 error_handling.py:115] training_loop marked as finished
WARNING:tensorflow:Reraising captured error
W0127 00:07:37.773025 139764176627712 error_handling.py:149] Reraising captured error
Traceback (most recent call last):
  File "/home/xx/miniconda3/envs/proj/bin/t5_mesh_transformer", line 33, in <module>
    sys.exit(load_entry_point('t5', 'console_scripts', 't5_mesh_transformer')())
  File "/home/xx/text-to-text-transfer-transformer/t5/models/mesh_transformer_main.py", line 280, in console_entry_point
    app.run(main)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/home/xx/text-to-text-transfer-transformer/t5/models/mesh_transformer_main.py", line 274, in main
    model_dir=FLAGS.model_dir)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1605, in gin_wrapper
    utils.augment_exception_message_and_reraise(e, err_str)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise
    raise proxy.with_traceback(exception.__traceback__) from None
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/home/xx/mesh/mesh_tensorflow/transformer/utils.py", line 2447, in run
    skip_seen_data=skip_seen_data)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1605, in gin_wrapper
    utils.augment_exception_message_and_reraise(e, err_str)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise
    raise proxy.with_traceback(exception.__traceback__) from None
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/home/xx/mesh/mesh_tensorflow/transformer/utils.py", line 1677, in train_model
    estimator.train(input_fn=input_fn, max_steps=train_steps)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3110, in train
    rendezvous.raise_errors()
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/error_handling.py", line 150, in raise_errors
    six.reraise(typ, value, traceback)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3105, in train
    saving_listeners=saving_listeners)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 349, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1175, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1208, in _train_model_default
    saving_listeners)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1510, in _train_with_estimator_spec
    save_graph_def=self._config.checkpoint_save_graph_def) as mon_sess:
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 605, in MonitoredTrainingSession
    stop_grace_period_secs=stop_grace_period_secs)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 1039, in __init__
    stop_grace_period_secs=stop_grace_period_secs)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 750, in __init__
    self._sess = _RecoverableSession(self._coordinated_creator)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 1232, in __init__
    _WrappedSession.__init__(self, self._create_session())
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 1237, in _create_session
    return self._sess_creator.create_session()
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/training/monitored_session.py", line 910, in create_session
    hook.after_create_session(self.tf_sess, self.coord)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/util.py", line 94, in after_create_session
    session.run(self._initializers)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 968, in run
    run_metadata_ptr)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1191, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1369, in _do_run
    run_metadata)
  File "/home/xx/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1394, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'SentencepieceOp' in binary running on t1v-n-e076a4c2-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
         [[node ParallelMapDatasetV2_1 (defined at /mesh/mesh_tensorflow/transformer/dataset.py:276) ]]

Errors may have originated from an input operation.
Input Source operations connected to node ParallelMapDatasetV2_1:
 ParallelMapDatasetV2 (defined at /mesh/mesh_tensorflow/transformer/dataset.py:274)

Original stack trace for 'ParallelMapDatasetV2_1':
  File "/miniconda3/envs/proj/bin/t5_mesh_transformer", line 33, in <module>
    sys.exit(load_entry_point('t5', 'console_scripts', 't5_mesh_transformer')())
  File "/text-to-text-transfer-transformer/t5/models/mesh_transformer_main.py", line 280, in console_entry_point
    app.run(main)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/text-to-text-transfer-transformer/t5/models/mesh_transformer_main.py", line 274, in main
    model_dir=FLAGS.model_dir)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/mesh/mesh_tensorflow/transformer/utils.py", line 2447, in run
    skip_seen_data=skip_seen_data)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/mesh/mesh_tensorflow/transformer/utils.py", line 1677, in train_model
    estimator.train(input_fn=input_fn, max_steps=train_steps)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3105, in train
    saving_listeners=saving_listeners)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 349, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1175, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1204, in _train_model_default
    self.config)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 2942, in _call_model_fn
    config)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1163, in _call_model_fn
    model_fn_results = self._model_fn(features=features, **kwargs)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3222, in _model_fn
    input_holders.generate_infeed_enqueue_ops_and_dequeue_fn())
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 1484, in generate_infeed_enqueue_ops_and_dequeue_fn
    self._invoke_input_fn_and_record_structure())
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 1539, in _invoke_input_fn_and_record_structure
    num_hosts))
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 1143, in generate_broadcast_enqueue_ops_fn
    inputs = _Inputs.from_input_fn(input_fn(user_context))
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3076, in _input_fn
    return input_fn(**kwargs)
  File "/mesh/mesh_tensorflow/transformer/utils.py", line 1662, in input_fn
    dataset_split=dataset_split)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/text-to-text-transfer-transformer/t5/models/mesh_transformer.py", line 219, in tsv_dataset_fn
    eos_id=1)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/gin/config.py", line 1582, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/mesh/mesh_tensorflow/transformer/dataset.py", line 276, in packed_parallel_tsv_dataset
    _encode_fn, num_parallel_calls=tf.data.experimental.AUTOTUNE)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 2770, in map
    preserve_cardinality=False))
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 4544, in __init__
    **self._flat_structure)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/ops/gen_dataset_ops.py", line 5550, in parallel_map_dataset_v2
    name=name)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 750, in _apply_op_helper
    attrs=attr_protos, op_def=op_def)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3565, in _create_op_internal
    op_def=op_def)
  File "/miniconda3/envs/proj/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 2045, in __init__
    self._traceback = tf_stack.extract_stack_for_node(self._c_op)

  In call to configurable 'train_model' (<function train_model at 0x7f1a14e977a0>)
  In call to configurable 'run' (<function run at 0x7f1a14e9be60>)
^C[1]+  Exit 1                  

Source: google-research/text-to-text-transfer-transformer