google-ai-edge / ai-edge-torch

Supporting PyTorch models with the Google AI Edge TFLite runtime.
Apache License 2.0
280 stars 36 forks source link

tinyllama quantize can't inference correctly #154

Open nigelzzz opened 3 weeks ago

nigelzzz commented 3 weeks ago

Description of the bug:

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

pkgoogle commented 3 weeks ago

Hi @nigelzzz, I'm getting this issue when I run your command:

ERROR: Didn't find op for builtin opcode 'STABLEHLO_COMPOSITE' version '1'. An older version of this builtin might be supported. Are you using an old TFLite binary with a newer model?

ERROR: Registration failed.

Error at ai_edge_torch/generative/examples/c++/text_generator_main.cc:93

Can you either share/provide your .tflite file or provide reproduce steps for your model conversion? i.e. the branch/version you are on when you do the conversion, whether you are using cuda when converting as well. Generally the more information I know, the faster we can help you. Is there any special reason your model name is ttiny_llama_seq512_kv1024? or is that just a typo? Thanks.

nigelzzz commented 3 weeks ago

Hi @pkgoogle, ttiny_ llama_seq512_kv1024 is typo, i just classify quantize or no quantize. by the way i think the root cause is WORKSPACE tensorflow version isn't correctly

ERROR: Registration failed.

Error at ai_edge_torch/generative/examples/c++/text_generator_main.cc:93



- above this error, i see in newer version has add `stablehlo_composite`, 
https://github.com/tensorflow/tensorflow/commit/f4f2393888af78879dc9b299786023fe87fbbcfc
- in WORKSPACE version, doesn't add 
     - _TENSORFLOW_GIT_COMMIT = "26d4ea90364daa14bbb2bc5c2aa68f5b70c4641f"
     - https://github.com/tensorflow/tensorflow/blob/26d4ea90364daa14bbb2bc5c2aa68f5b70c4641f/tensorflow/lite/core/kernels/register.cc#L385
nigelzzz commented 3 weeks ago

and i have other question in this ticket. https://github.com/google-ai-edge/ai-edge-torch/issues/109

nigelzzz commented 3 weeks ago

or i can help open a pr to fix it

pkgoogle commented 3 weeks ago

Hi @nigelzzz, thanks for the info -- I'm having trouble building against that particular commit/version of TF -- did you modify your BUILD file? https://github.com/google-ai-edge/ai-edge-torch/blob/release/0.2.0/ai_edge_torch/generative/examples/c%2B%2B/BUILD

You can open a PR if you feel it is actually fixing the root cause. And this might just be a new issue as HEAD/nightly should work as well :).

github-actions[bot] commented 2 weeks ago

Marking this issue as stale since it has been open for 7 days with no activity. This issue will be closed if no further activity occurs.

nigelzzz commented 1 week ago

Hi @pkgoogle , I just do some patch in my local tensorflow library. I guess we just update tensorflow version, change version in WORKSPACE file. e.g., (https://github.com/google-ai-edge/ai-edge-torch/blob/main/WORKSPACE)

pkgoogle commented 1 week ago

Hi @nigelzzz, for better reproducibility can you produce a diff between your local files and the github repo (maybe pull the latest changes).

something like this:

# navigate to tf root
git diff origin/master > diff.txt

Then share/upload that diff.txt file... that will help me a lot, thanks.

github-actions[bot] commented 1 day ago

Marking this issue as stale since it has been open for 7 days with no activity. This issue will be closed if no further activity occurs.