Unable to Exclude OOV Tokens

When creating a post, please add:

For Exercise 4: fit_label_encoder, my function is making all my OOV Tokens None. To exclude the OOV tokens from my vocabulary, I am setting the oov_token parameter to None in my tf.keras.layers.StringLookup function. However, I’m getting that the first element of my Vocabulary of labels is None. How can I fix this?

As a hint, these are the arguments according to the Tensorflow documentation:

tf.keras.layers.StringLookup(
    max_tokens=None,
    num_oov_indices=1,
    mask_token=None,
    oov_token='[UNK]',
    vocabulary=None,
    idf_weights=None,
    invert=False,
    output_mode='int',
    pad_to_max_tokens=False,
    sparse=False,
    encoding='utf-8',
    name=None,
    **kwargs
)

In order to exclude OOV tokens, your argument of interest should be num_oov_indices. Hope this helps.

3 Likes

Oh, I see. Thanks!

i am still getting the same error by setting the num_oov_indices to 1

thanks i was able to get it by setting it to the right valule

1 Like

Props to you for finding the right answer yourself.