Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Environment:
OS: windows 10
python version 3.12.2
pip 24.0
had never install tensorflow , keras or keras_nlp
I try to run following commands to install keras_nlp and keras following this introduction.
pip install -U keras-nlp
pip install -U keras
Command run successed. But the kerasNLP I installed seems have incorrect content, keras_nlp_init which supposed to have many models over here.
Here is the demo which I want to test.
import keras_nlp
import os
os.environ["KERAS_BACKEND"] = "tensorflow"
gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset("gemma_instruct_7b_en")
gotA = gemma_lm.generate("Keras is a", max_length=30)
print(gotA)
Generate with batched prompts.
gotB = gemma_lm.generate(["Keras is a", "I want to say"], max_length=30)
print(gotB)
Program always shutdown with following log:
2024-02-25 23:23:39.045761: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable
TF_ENABLE_ONEDNN_OPTS=0
.2024-02-25 23:23:39.504814: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable
TF_ENABLE_ONEDNN_OPTS=0
.Traceback (most recent call last):
File "d:\llm_demo\gemma.py", line 5, in
gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset("gemma_instruct_7b_en")
^^^^^^^^^^^^^^^^
AttributeError: module 'keras_nlp' has no attribute 'models'
If there any thing I can do to make this demo work?