diff --git a/bert/tokenization/albert_tokenization.py b/bert/tokenization/albert_tokenization.py index 2d1676b..1077954 100644 --- a/bert/tokenization/albert_tokenization.py +++ b/bert/tokenization/albert_tokenization.py @@ -26,7 +26,6 @@ import six from six.moves import range import tensorflow.compat.v1 as tf -import tensorflow_hub as hub import sentencepiece as spm SPIECE_UNDERLINE = u"▁".encode("utf-8") @@ -258,6 +257,7 @@ def from_scratch(cls, vocab_file, do_lower_case, spm_model_file): @classmethod def from_hub_module(cls, hub_module, spm_model_file): """Get the vocab file and casing info from the Hub module.""" + import tensorflow_hub as hub with tf.Graph().as_default(): albert_module = hub.Module(hub_module) tokenization_info = albert_module(signature="tokenization_info",