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

AttributeError: module 'keras_nlp' has no attribute 'models' #20531

Closed
iwqculrbud opened this issue Nov 21, 2024 · 4 comments
Closed

AttributeError: module 'keras_nlp' has no attribute 'models' #20531

iwqculrbud opened this issue Nov 21, 2024 · 4 comments
Assignees
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@iwqculrbud
Copy link

:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
:1: SyntaxWarning: invalid escape sequence '/'
Traceback (most recent call last):
File "C:\Users\wangshijiang\Desktop\deep_learning\project\llm\llm.py", line 68, in
preprocessor = keras_nlp.models.DebertaV3Preprocessor.from_preset(
^^^^^^^^^^^^^^^^
AttributeError: module 'keras_nlp' has no attribute 'models'
屏幕截图 2024-11-21 225847

@sachinprasadhs
Copy link
Collaborator

keras-nlp has been renamed to keras-hub with the inclusion of image specific models , all the new development and future release will be as keras-hub package.

You can install keras-hub using
!pip install -Uq keras-hub

and the code is working without any issues.

import keras_hub

preprocessor = keras_hub.models.DebertaV3Preprocessor.from_preset(
   preset= "deberta_v3_extra_small_en",
   sequence_length= 512,
)

Even it is working with keras-nlp as well, just that it will not have any latest update and there will not be any releases.

@sachinprasadhs sachinprasadhs added type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited. stat:awaiting response from contributor labels Nov 21, 2024
@iwqculrbud
Copy link
Author

keras-nlp has been renamed to keras-hub with the inclusion of image specific models , all the new development and future release will be as keras-hub package.

You can install keras-hub using !pip install -Uq keras-hub

and the code is working without any issues.

import keras_hub

preprocessor = keras_hub.models.DebertaV3Preprocessor.from_preset(
   preset= "deberta_v3_extra_small_en",
   sequence_length= 512,
)

Even it is working with keras-nlp as well, just that it will not have any latest update and there will not be any releases.

It sometimes doesn't work locally or on colab.
Why are you unwilling to pursue stability?

@sachinprasadhs
Copy link
Collaborator

If you are facing this in local you could try to upgrade or install the Keras NLP or Keras Hub package using

pip install -U keras-nlp
pip install -U keras-hub

For colab, restart the runtime and follow the same steps.

For Keras Hub announcement and details check keras-team/keras-hub#1831

Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests

2 participants