-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
When trying to create a Task Bundle using a TFLite file, I'm not allowed to enter the stop token of the model #5715
Comments
Hi @Arya-Hari, Could you please share the complete example you are using from our documentation? Additionally, if you have any error logs, sharing them would help us better understand the issue. Thank you!! |
Hello @kuaashish So I converted the tokenizer to the SentencePiece compatible format through the code given in the ai-edge-torch repository. It generated a llama3.spm.model file. Then I ran this script import sentencepiece as spm
# Load the SentencePiece model
sp = spm.SentencePieceProcessor()
sp.load("/content/llama3.spm.model")
# Check special tokens or tokens that might indicate sequence ends
print("End token ID:", sp.eos_id()) # Check if the model has a predefined EOS token ID
print("Start token ID:", sp.bos_id()) # BOS may also indicate a start-of-sequence token
vocab_size = sp.get_piece_size()
for i in range(vocab_size):
print(f"ID {i}: {sp.id_to_piece(i)}") This then printed 128255 tokens along with their ID. The token with ID 128001 was When running this piece of code as given in llm_bundling.ipynb,
I get this error - Secondly, when pushing the model onto the device, the documentation requires that a .bin file be pushed. I did not understand how to generate the .bin file after generating the Task Bundle. Your help is much appreciated. Thank you! |
@kuaashish Hello...is there way to resolve this? |
Thanks for all of the detail provided. Two quick items:
Is this just a copy/paste error? I assumed you would have something like |
Hi @talumbau. To clarify, I used the quantization script provided in the AI Edge Torch repository for quantizing and converting it to the TFLite format. The script used there, by default, saves the output file under the name of |
Hello @Arya-Hari, |
Okay thank you |
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
No
OS Platform and Distribution
Linux Ubuntu 16.04
Mobile device if the issue happens on mobile device
No response
Browser and version if the issue happens on browser
No response
Programming Language and version
Python
MediaPipe version
No response
Bazel version
No response
Solution
LLM Inference
Android Studio, NDK, SDK versions (if issue is related to building in Android environment)
No response
Xcode & Tulsi version (if issue is related to building for iOS)
No response
Describe the actual behavior
I created .tflite file using ai-edge-torch for Llama 3.2 1B model and now am trying to deploy it for inference on edge. When trying to create the task bundle, the stop token is asked. When I provide "<|end_of_text|>", it is not able to resolve it. I previously converted the tokenizer to the SentencePiece format through the code given in the ai-edge-torch repository.
Describe the expected behaviour
The task bundle should be created without errors.
Standalone code/steps you may have used to try to get what you need
I tried to manually check the possible tokens the model could identify using its vocab and "<|end_of_text|>" is a token in its vocab.
I also tried changing the stop token and the task bundle was created. However, on using the bundle for deployment, I was getting a Failed to initialize engine : modelError building tflite model. Also, just as a side question, the .task file that's created, can it be used interchangeably with the .bin file that's given in the model path in the repository examples?
Other info / Complete Logs
No response
The text was updated successfully, but these errors were encountered: