Closed piotrkowalczuk closed 3 weeks ago
Hi @piotrkowalczuk - I'm confused here. What are you trying to do here? Do you have a Core ML model and you're trying to get predictions from it in Python?
I have a Tensorflow model that I am trying to convert using the Python tooling. I found that conversion has some limitations. I want a user experience similar to what the Create ML.app
offers. A similar text classifier trained using the Create ML.app
, has a tokenizer included. Such model is easier to distribute.
Can you share complete code to reproduce the problem? This should include all necessary import statements and your call to ct.convert
.
Hi @piotrkowalczuk based on my experience we usually separate the tokenization from the main language model.
One reason is the error you encountered: TypeError: dtype=<class 'coremltools.converters.mil.mil.types.type_str.str'> is unsupported for inputs/outputs of the model.
Core ML framework does not accept string as io dtype (AFAIK only float and int and bool are supported). That is to say, we do need swift driver code that instantiates a tokenizer and tokenize input string before feeding into the language model
How to embed tokenization ❓
Models created using the Create ML app provide this sleek API that hides some complexity:
While trying to convert the model:
I encountered this error
TypeError: dtype=<class 'coremltools.converters.mil.mil.types.type_str.str'> is unsupported for inputs/outputs of the model
.What do you think is the best way to handle my use case? How far the
coremltools
library can take me, without me having to create a Swift Package that will wrap the model?