blog icon indicating copy to clipboard operation
blog copied to clipboard

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

Open dgrnd4 opened this issue 3 years ago • 1 comments

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?

dgrnd4 avatar Jul 27 '22 09:07 dgrnd4

Hey there! Thanks for the question! This question would go better in the forums :) https://discuss.huggingface.co/

osanseviero avatar Jul 27 '22 09:07 osanseviero