huggingface / huggingface/blog

How to get/extract CONCRETE FUNCTIONS from my model? (In order to convert my model into TFLite)

Open
#442 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
3.5k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

Hi, i saved my model in these 3 followings ways:

```
from transformers import ViTFeatureExtractor, ViTForImageClassification
from transformers import AutoModelForImageClassification
from transformers import TFAutoModelForImageClassification

model_directory = "drive/MyDrive/Tirocinio/1ris_vit-stanford-dog-dataset"
tokenizer = ViTFeatureExtractor.from_pretrained(model_directory)
model = ViTForImageClassification.from_pretrained(model_directory)

pytorch_path = "drive/MyDrive/Tirocinio/ViT_model_pytorch"
model_pytorch = ViTForImageClassification.from_pretrained(pytorch_path)

h5_path = "drive/MyDrive/Tirocinio/ViT_model_tf"
model_h5 = ViTForImageClassification.from_pretrained(h5_path, from_tf=True)

```

now what i want to do is get the concrete function in order to convert my model into a TFLite model.

can you please tell me how to do it?

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository file or test is named. Start by reviewing the Transformers TensorFlow APIs shown in the issue, especially TFAutoModelForImageClassification, alongside TensorFlow Lite conversion guidance; done means documenting a verified path from the saved ViT model to a TFLite model.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.