Skip to content

Commit b56f87a

Browse files
authored
Revert "Update "tokens" -> "token_ids" (#1152)" (#1155)
This reverts commit fb633da.
1 parent 483ce32 commit b56f87a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

guides/keras_nlp/transformer_pretraining.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def preprocess(inputs):
251251
# Split the masking layer outputs into a (features, labels, and weights)
252252
# tuple that we can use with keras.Model.fit().
253253
features = {
254-
"token_ids": outputs["token_ids"],
254+
"tokens": outputs["tokens"],
255255
"mask_positions": outputs["mask_positions"],
256256
}
257257
labels = outputs["mask_ids"]
@@ -277,7 +277,7 @@ def preprocess(inputs):
277277
278278
We have two features:
279279
280-
1. `"token_ids"`, where some tokens have been replaced with our mask token id.
280+
1. `"tokens"`, where some tokens have been replaced with our mask token id.
281281
2. `"mask_positions"`, which keeps track of which tokens we masked out.
282282
283283
Our labels are simply the ids we masked out.
@@ -350,12 +350,12 @@ def preprocess(inputs):
350350

351351
# Create the pretraining model by attaching a masked language model head.
352352
inputs = {
353-
"token_ids": keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32),
353+
"tokens": keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32),
354354
"mask_positions": keras.Input(shape=(PREDICTIONS_PER_SEQ,), dtype=tf.int32),
355355
}
356356

357357
# Encode the tokens.
358-
encoded_tokens = encoder_model(inputs["token_ids"])
358+
encoded_tokens = encoder_model(inputs["tokens"])
359359

360360
# Predict an output word for each masked input token.
361361
# We use the input token embedding to project from our encoded vectors to

0 commit comments

Comments
 (0)