Where is the .task file ?

#1
by iTzFaisal - opened

Hello,

The other models in "litert-community" have .task file to be downloaded. I could not find the .task file for this model SmolVLM-256M-Instruct.

My use case:
import SmolVLM-256M-Instruct to Google's edge gallery app (https://github.com/google-ai-edge/gallery)

Regards,
Faisal Alkheraiji

LiteRT Community (FKA TFLite) org
edited Aug 11

Hello! You can convert a .tflite model to a .task file by following the guide here:
https://ai.google.dev/edge/mediapipe/solutions/genai/llm_inference?hl=ru
using this Colab notebook:
https://colab.research.google.com/github/googlesamples/mediapipe/blob/main/examples/llm_inference/bundling/llm_bundling.ipynb?hl=ru

However, there is no clear procedure for converting VLM's with VISION support. So far, I’ve only been able to successfully convert it with text-only capabilities.

The llm_converter.py script includes an image_encoder_file parameter, but there are no examples or documentation on how to use it:
https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/genai/converter/llm_converter.py

Due to this limitation, I've opted to implement a custom C++ pipeline instead.

Thank you for your quick reply and clarification.

May I ask another question ? How to convert a non .tflite model to .task model ?

I'm planning to convert SmoLM3 to .task model. Is it visible and technically possible with consumer grade hardware ?

Regards,
Faisal Alkheraiji

LiteRT Community (FKA TFLite) org
edited Aug 11

You can follow this guide: https://github.com/google-ai-edge/ai-edge-torch/tree/main/ai_edge_torch/generative
to convert a Hugging Face checkpoint into a .tflite model. Then, use the following Colab notebook:
https://colab.research.google.com/github/googlesamples/mediapipe/blob/main/examples/llm_inference/bundling/llm_bundling.ipynb?hl=ru
to convert the .tflite model into a .task file, which you can upload to the Google AI Edge Gallery.

However, note that you will need to re-authorize SmoLM3 according to the guide, which can be time-consuming.

Alternatively, you can use the existing implementation for SmalLM or SmalLMv2:
https://github.com/google-ai-edge/ai-edge-torch/blob/main/ai_edge_torch/generative/examples/smollm/convert_v2_to_tflite.py
to create the .tflite model, and then use the same Colab notebook to generate the .task file.

"Is it visible and technically possible with consumer grade hardware ?" Yes, it's possible.

Thank you once more !

I'll have a look at these resources

Sign up or log in to comment