Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port GPT Text Generation Guide to Keras Core #1490

Closed
wants to merge 10 commits into from

Conversation

shivance
Copy link
Contributor

@shivance shivance commented Aug 16, 2023

@shivance
Copy link
Contributor Author

This PR is WIP

  1. Still testing for Torch and JAX backend
  2. Need to update ipynb and md files.

@sachinprasadhs
Copy link
Collaborator

Could you please change it to draft till you make all the changes. Thanks

@shivance shivance marked this pull request as draft August 17, 2023 01:30
@shivance shivance marked this pull request as ready for review August 22, 2023 08:42
@shivance
Copy link
Contributor Author

This PR is ready for review, could you @fchollet ?

perplexity = keras_nlp.metrics.Perplexity(from_logits=True, mask_token_id=0)
model.compile(optimizer="adam", loss=loss_fn, metrics=[perplexity])

"""
Let's take a look at our model summary - a large majority of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove this section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run a generation script, it simply fails saying that console width is not enough to print summary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, probably not a reason to cut this section. Do you have the error handy?

@@ -264,19 +252,31 @@ model.fit(train_ds, validation_data=val_ds, verbose=2, epochs=EPOCHS)
<div class="k-default-codeblock">
```
Epoch 1/6
3169/3169 - 132s - loss: 4.5592 - perplexity: 95.8829 - val_loss: 4.1382 - val_perplexity: 63.2792 - 132s/epoch - 42ms/step

/usr/local/lib/python3.10/dist-packages/keras_core/src/layers/layer.py:759: UserWarning: Layer 'position_embedding' (of type PositionEmbedding) was passed an input with a mask attached to it. However, this layer does not support masking and will therefore destroy the mask information. Downstream layers will not see the mask.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to take a look at these warning, are they valid?

Copy link

This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label Nov 30, 2023
Copy link

This PR was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

@github-actions github-actions bot closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port GPT Text generation guide to multi backend Keras
3 participants