exporters icon indicating copy to clipboard operation
exporters copied to clipboard

Converting a pipeline

Open MatthewWaller opened this issue 1 year ago • 2 comments

What would it take to convert an entire pipeline to a coreml model?

For instance, I have saved the stable-diffusion checkpoint, and several of the models have their own configs, but of course they're not the ready-made configs.

Screen Shot 2022-09-08 at 10 24 00 PM

Would this be just a long, hard, custom slog via exporters and not worth it? Or is there something here worth pursuing?

MatthewWaller avatar Sep 09 '22 03:09 MatthewWaller

For folks interested, I added a comment to this gist that has a bunch of the models converted. 3 out of 4!

One bit I'm trying to convert is CLIP. Since the model uses the CLIPTextModel, and the CLIPTextEncoder.

Thoughts about how I might go about this? I get a Torch var mask.3 not found in context and a whole bunch of warnings that a tensor is getting converted to a boolean.

And then I'm also not sure how I could convert the scheduler. Or if I can ignore that.

https://gist.github.com/madebyollin/86b9596ffa4ab0fa7674a16ca2aeab3d

MatthewWaller avatar Sep 13 '22 20:09 MatthewWaller

Ha! The original author of the post was gracious enough to fix up that CLIPTextEncoder. Nice.

One thing I'll need to tackle implementing to start experiment running on iPhone and iPad and Mac app is the tokenizer.

I've opened an issue here if folks know the answer: https://github.com/huggingface/swift-coreml-transformers/issues/28

MatthewWaller avatar Sep 14 '22 17:09 MatthewWaller