-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Description
Describe the bug
if not isinstance(data, (list, tf.data.Dataset)): #from source code
AttributeError: 'NoneType' object has no attribute 'data'
because compute_word_piece_vocabulary
function is not importing TensorFlow correctly (tf = None
)(refer to source code lines 4-11 and 117)
To Reproduce
def train_word_piece(dataset, vocab_size, reserved_tokens):
word_piece_ds = dataset.unbatch().map(lambda x, y: x)
vocab = compute_word_piece_vocabulary(
data = word_piece_ds.batch(1000).prefetch(2),
vocabulary_size=vocab_size,
reserved_tokens=reserved_tokens,
)
return vocab
train_word_piece(train_dataset, VOCAB_SIZE, reserved_tokens)
Code from https://keras.io/examples/nlp/fnet_classification_with_keras_hub/
Expected behavior
Function executes without error.
Additional context
Tensorflow version 2.17.1
KerasHub version 0.18.1
Maybe remove lines 4-11 in source?
Metadata
Metadata
Assignees
Labels
No labels