madcato / huggingface-coreml

This repository contains a script and information to convert a Huggingface models to CoreML.
16 stars 2 forks source link

Example script not working #1

Closed microcoder-py closed 1 year ago

microcoder-py commented 1 year ago

Tried running the example script for exporting blenderbot, got error

File "C:\Users\TK\AppData\Local\Programs\Python\Python311\Lib\site-packages\coremltools\converters\mil\backend\mil\load.py", line 283, in load
    raise RuntimeError("BlobWriter not loaded")
RuntimeError: BlobWriter not loaded
madcato commented 1 year ago

I had also many problems with Blenderbot and then I started using Microsoft/DialoGPT-small, and it works!

If you need to use BlenderBot, I recommend you to go to https://github.com/huggingface/exporters This is the project that I used to create mine, and it have much better documentation and support.

Sorry for the inconveniences and thank you for this issue: I will remove any reference to BlenderBot to not to annoy other developers.

I'l be very pleased to answer any other issue you have.

microcoder-py commented 1 year ago

Actually I want to convert FLAN-T5 Small. Do you think we could work together on that?

madcato commented 1 year ago

I have just now try to convert FLAN-T5 and returns a CoreML error hard to solve.

I had no luck trying to use any T5 model when I created this repo.

Also the T5 tokenizer is really complicated to convert to Swift. If you know anyone already done, please tell me where it is.

I recommend you to use only GPT2 and Bert models, because they are easy to convert to CoreML. Also you will find good tokenizers and samples in this other project: https://github.com/huggingface/swift-coreml-transformers

In other of my projects I use microsoft/DialoGPT-small, and it's already working on my iPhone.

microcoder-py commented 1 year ago

Thank you for your response. One last thing - if you could provide any examples of Swift implementation of the converted GPT models, that would be amazing

madcato commented 1 year ago

You can find some of my experiments in https://github.com/madcato/huggingface-coreml/tree/389543708f19929b47a49f55534589ba2cda9b29/huggingface-ios-app/Sources

These models are based on the ones you can watch in https://github.com/huggingface/swift-coreml-transformers