exporters icon indicating copy to clipboard operation
exporters copied to clipboard

Error for Keras (TF) models

Open a-maci opened this issue 1 year ago • 1 comments

Seems like each of the Keras models need a config.json file.

For e.g. python -m exporters.coreml --model=keras-io/transformers-qa exported/ works because this model has a config.json but python -m exporters.coreml --model=keras-io/image-captioning exported/ fails with message OSError: keras-io/image-captioning does not appear to have a file named config.json. Checkout 'https://huggingface.co/keras-io/image-captioning/main' for available files.

Is there any workaround or each of the Keras models need a config file for exporter to work?

a-maci avatar Apr 05 '23 18:04 a-maci

The exporters tool only works for models from the 🤗 Transformers library. The first model you mentioned is a version of DistilBert from Transformers (has a config.json), but the second model isn't from Transformers (has no config.json).

You still might be able to convert the keras-io/image-captioning model to Core ML but you'll have to write a small script that uses the coremltools library directly.

hollance avatar Apr 05 '23 19:04 hollance