keras-io icon indicating copy to clipboard operation
keras-io copied to clipboard

GPT text generation with KerasNLP Example error

Open ygModesto opened this issue 1 year ago • 13 comments

Hello, in the GPT text generation example with KerasNLP (https://keras.io/examples/nlp/text_generation_gpt/) when executing the code associated with # Train tokenizer vocabulary the following error is thrown: AttributeError: module 'keras_nlp.tokenizers' has no attribute 'compute_word_piece_vocabulary'

I have tried with several versions of keras-nlp but I have not fixed the error.

ygModesto avatar Aug 16 '22 07:08 ygModesto

@ygModesto Actually the error is caused because the latest release of KerasNLP doesn't yet have the compute_word_piece_vocabulary function. If you want to run it you can install KerasNLP from github directly using this syntax - pip install git+https://github.com/user/repo.git@branch

aflah02 avatar Aug 16 '22 20:08 aflah02

@Alpes-ai Hey that was just a placeholder should've been more clearer :( Instead of that link use the link from the KerasNLP repository with the master branch, hope that sorts it!

aflah02 avatar Aug 26 '22 12:08 aflah02

Same here am getting the error when I pip install []pip install git+https://github.com/user/repo.git@branch) fatal: could not read Username for 'https://github.com/': No such device or address

Simon-PSR avatar Aug 26 '22 12:08 Simon-PSR

yeah, now the model is loaded, thanks for your support.

NareshSandrugu avatar Aug 26 '22 12:08 NareshSandrugu

use this command its working: pip install git+https://github.com/keras-team/keras-nlp.git

NareshSandrugu avatar Aug 27 '22 05:08 NareshSandrugu

Hi, also I tried installing using [,](pip install git+https://github.com/keras-team/keras-nlp.git), but I still get the same error. is there a workaround or a solution? the error is like: AttributeError: module 'keras_nlp.tokenizers' has no attribute 'compute_word_piece_vocabulary'

Simon-PSR avatar Aug 27 '22 08:08 Simon-PSR

Thanks

Hi, tried installing using [,](pip install git+ https://github.com/keras-team/keras-nlp.git), but I still get the same error. when training the tokenizer, is there a workaround or a solution? the error is like: AttributeError: module 'keras_nlp.tokenizers' has no attribute 'compute_word_piece_vocabulary'

regards

On Sat, Aug 27, 2022 at 7:51 AM Naresh Sandrugu @.***> wrote:

use this command its working: pip install git+ https://github.com/keras-team/keras-nlp.git

— Reply to this email directly, view it on GitHub https://github.com/keras-team/keras-io/issues/1031#issuecomment-1229129929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDRARVRNRXLCDQ7UJHWBPTV3GUELANCNFSM56UYI4GQ . You are receiving this because you commented.Message ID: @.***>

--

--

DISCLAIMER *** This message and any attachments are confidential and intended solely for the addressee. The following link will display the full disclaimer: http://www.ul.ac.za/disclaimer.jpg http://www.ul.ac.za/disclaimer.jpg ***

--

https://www.ul.ac.za/index.php?Entity=c_events&TheS=970#start https://www.ul.ac.za/index.php?Entity=c_events&TheS=970#start

Simon-PSR avatar Aug 27 '22 08:08 Simon-PSR

Thanks, It worked after importing 'compute_word_piece_vocabulary' 👍 [from keras_nlp.tokenizers.word_piece_tokenizer_trainer import ( compute_word_piece_vocabulary,].

But now it complains when executing #StartEndPacker [ TypeError: Exception encountered when calling layer "start_end_packer_1" (type StartEndPacker).

in user code:

    File "/usr/local/lib/python3.7/dist-packages/keras_nlp/layers/start_end_packer.py", line 123, in call  *
        batch_size = tf.shape(inputs)[0]](url)

Please help.

Simon-PSR avatar Aug 27 '22 11:08 Simon-PSR

Exactly the same problem I have Naresh, any help, please🤔

On Sat, Aug 27, 2022 at 1:48 PM Naresh Sandrugu @.***> wrote:

am sturck at this point with error any one can help, for reference purpose screen shot below [image: image] https://user-images.githubusercontent.com/59958507/187028860-711c901e-81af-492e-ae4a-9c5f57ac8486.png

— Reply to this email directly, view it on GitHub https://github.com/keras-team/keras-io/issues/1031#issuecomment-1229177581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDRARR7VBH53ZWQUEQO3I3V3H6BPANCNFSM56UYI4GQ . You are receiving this because you commented.Message ID: @.***>

--

--

DISCLAIMER *** This message and any attachments are confidential and intended solely for the addressee. The following link will display the full disclaimer: http://www.ul.ac.za/disclaimer.jpg http://www.ul.ac.za/disclaimer.jpg ***

--

https://www.ul.ac.za/index.php?Entity=c_events&TheS=970#start https://www.ul.ac.za/index.php?Entity=c_events&TheS=970#start

Simon-PSR avatar Aug 27 '22 12:08 Simon-PSR

yeah, also facing the same issue with start_end_packer function, even i tried with simple examples from keras link like: https://keras.io/api/keras_nlp/layers/start_end_packer/

the below are error,any one can help this image

NareshSandrugu avatar Aug 27 '22 12:08 NareshSandrugu

@ygModesto, @Simon-PSR, @NareshSandrugu, linking a comment here, which will solve your issue: https://github.com/keras-team/keras-nlp/issues/301#issuecomment-1221337946. Hope this works! Colab has an older version of TensorFlow pre-installed...so, it has to be uninstalled first.

abheesht17 avatar Aug 28 '22 18:08 abheesht17

Thanks Abheesht, start_end_packer issue resolved.

NareshSandrugu avatar Aug 29 '22 06:08 NareshSandrugu

@fchollet we an close this issue

jbischof avatar Jan 07 '23 22:01 jbischof