shmishra99 / testRep

hi i am creating the test repo.
0 stars 1 forks source link

My code is having issue. #64

Open shmishra99 opened 9 months ago

shmishra99 commented 9 months ago

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?