Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions keras_nlp/models/gpt2/gpt2_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GPT2CausalLM(Task):
"I don't listen to music while coding.",
"But I watch youtube while coding!",
]
ds = tf.data.Dataset.from_tensor_slices(features)
ds = tf.data.Dataset.from_tensor_slices(features).batch(2)

# Create a `GPT2CausalLM` and fit your data.
gpt2_lm = keras_nlp.models.GPT2CausalLM.from_preset(
Expand All @@ -100,7 +100,7 @@ class GPT2CausalLM(Task):
gpt2_lm.compile(
loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
)
gpt2_lm.fit(ds, batch_size=2)
gpt2_lm.fit(ds)
```

Load a pretrained `GPT2CausalLM` with custom preprocessor, and predict on
Expand Down