My 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-nlppip install -U kerasCommand run successed.But the kerasNLP I installed seems have incorrect content,
which supposed to have many models over here.
Here is the demo which I want to test.
import keras_nlpimport osos.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 <module> 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?