Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

AttributeError: module 'bert.tokenization' has no attribute 'printable_text' #1105

@hdecamp

Description

@hdecamp

TF Version: 2.3.0-dev20200612
Hub version: 0.8.0
Running Bert with Tensorflow for text classification.

I've got stucked here:
train_features = bert.run_classifier.convert_examples_to_features(train_InputExamples, label_list, MAX_SEQ_LENGTH, tokenizer)
The error is:
AttributeError: module 'bert.tokenization' has no attribute 'printable_text'

Last call:
run_classifier.py in (.0)
464 tf.logging.info("guid: %s" % (example.guid))
465 tf.logging.info("tokens: %s" % " ".join(
--> 466 [tokenization.printable_text(x) for x in tokens]))
467 tf.logging.info("input_ids: %s" % " ".join([str(x) for x in input_ids]))
468 tf.logging.info("input_mask: %s" % " ".join([str(x) for x in input_mask]))

The line is 466 because I've added:
import tensorflow.compat.v1 as tf.

Maybe the printable_text is not compatible with the tf.logging.info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions