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
Error on saving keras custom layer with tensorflow_text.BertTokenizer #224
Comments
Hi @galfridman - We're still working on enabling saving of lookup tables in core Keras - that fix went in internally yesterday. Now that it's in, we will create a Keras layer that will wrap BertTokenizer- stay tuned! |
I have the same issue that I implemented a BertVocabLayer:
I used that to build model and training successfully, however it throws exact same errors when saving it.
Any updates for this issue resolving? Thanks a lot! |
Im having the same issue but with tensorflow_text.SentencepieceTokenizer. Is the fix for all type of tokenizers or only Bert? |
Hi Mark, Is this in yet / can you help with a temporary workaround? Thanks! |
Can we expect to save tokenizers into SavedModels when TensorFlow and TF Text 2.2.0 go stable? |
@markomernick Confirming that this is still an issue on
Please let us know when there's a fix. Thanks! |
I can also confirm this error on this version: |
Hey all, Unfortunately we had to push this out to ensure compatibility with DistributionStrategy. I'm working on it now and will have a fix in the nightly as soon as possible. |
@markomernick any tips on how to hack some solution in the mean time that becomes official? |
@markomernick Any updates regarding this ?? |
Hey - we are currently working on a BertTokenizer Keras layer, as well as a Wordpiece Keras layer. We expect these to be part of the TF.Text 2.3 release. |
Any news about the same for the SentencePiece tokenizer? |
@MoggeM We are thinking about this as well. I certainly hope to have it for 2.3, barring any unforeseen issues. |
This fixes #224 where tokenizers were unable to be saved from within custom Keras layers. PiperOrigin-RevId: 315784812
This fixes #224 where tokenizers were unable to be saved from within custom Keras layers. PiperOrigin-RevId: 315784812
@Mistobaan now It's a bit late not sure if still helpful, but you can hack your way around it like this.
|
This fixes #224 where tokenizers were unable to be saved from within custom Keras layers. PiperOrigin-RevId: 315784812
fyi: pr #328 will resolve this issue |
It seems that this PR is not included in the 2.3 branch? |
Yeah; we found an issue with it when Sentencepiece was used from within map_fn. That's fixed and it will be a part of the 2.3.0 release later today. |
2.3.0 is now released, so I'm going to close this bug. Feel free to reopen if a problem arises. |
Saving now works properly in v2.3.0, but still got some warnings while loading the SavedModel:
Is this a known issue? I can confirm that the restored model is working despite the warnings. |
Trying so save a keras custom layers with tokenizer in it fails
versions info:
Code to reproduce:
It also gives error on
Error:
The text was updated successfully, but these errors were encountered: