Skip to content

Conversation

@mattdangerw
Copy link
Member

🚧 This is an experimental feature branch, more details soon. 🚧

I'm temporarily basing this on preprocessing branch so we can start review.

Copy link
Contributor

@ianstenbit ianstenbit left a comment

Choose a reason for hiding this comment

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

Some minor questions for you, but looks good!

Way to go Matt 🎊 🥳 ❗

self.backbone.get_layer("token_embedding").embeddings,
transpose_b=True,
)
logits = self.get_layer("reverse_embedding")(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, as I see this is done throughout -- what's the purpose of using self.get_layer instead of storing the layer as a member on the object directly e.g. self.reverse_embedding?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we are functional, they actually aren't self.layer or self.backbone.layer accessors.

)

@pytest.mark.large # Saving is slow, so mark these large.
@pytest.mark.tf_only
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it because of the tokenizer that this is TF only? If so, can we potentially make the test work on other backends?

Copy link
Contributor

Choose a reason for hiding this comment

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

(Same throughout the PR)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because a string model inputs are only supported in tf. So a model that includes tokenization inside call really only makes sense in tf.

I am also open to just deleting these tests. I think saving for backbone models and tasks are important, for tokenizers saving directly like this less so.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially rewrite the test with preprocessor=False to make it generic

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh this is actually a test for just the tokenizer. So preprocessor=False would not apply here.

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mattdangerw mattdangerw changed the base branch from preprocessing to core July 7, 2023 23:02
Copy link
Contributor

@jbischof jbischof left a comment

Choose a reason for hiding this comment

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

Thanks!

)

@pytest.mark.large # Saving is slow, so mark these large.
@pytest.mark.tf_only
Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially rewrite the test with preprocessor=False to make it generic

@mattdangerw mattdangerw merged commit 0bf113c into core Jul 10, 2023
@mattdangerw mattdangerw deleted the models branch July 10, 2023 20:46
mattdangerw added a commit that referenced this pull request Jul 10, 2023
* Port models to core

* Proper seed generation for jax

* Don't test metrics yet (for a separate PR)

* Add all model variables to the jax state mapping

We want to avoid a bug in the case that looks like
model.generate()
mode.fit()
model.generate()

In this case we need to be careful to not pull in the cached variable
state at generation compile time.

* Address Ian's comments

* Add TODO's for revers embedding

* Run pytest on the entirety of keras-nlp

* Misc cleanups

* Mark docstring tests tf only

* Last failing doctest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants