Skip to content

module 'tensorflow' has no attribute 'gfile' #1

Description

@abebe9849

When I encountered the error below, I solved the problem by rewriting the tokenizer as follows.

/uth-bert/tokenization_mod.py in load_vocab(vocab_file)
    122     vocab = collections.OrderedDict()
    123     index = 0
--> 124     with tf.gfile.GFile(vocab_file, "r") as reader:
    125         while True:
    126             token = convert_to_unicode(reader.readline())

AttributeError: module 'tensorflow' has no attribute 'gfile'

→→replace tf.gfile.GFile to tf.io.gfile.GFile

If UTH-BERT intends to support tf2 series, I think it is better to modify this part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions