Giter VIP home page Giter VIP logo

guernikamodelconverter's Introduction

Guernika Model Converter

This repository contains a model converter compatible with Guernika.

Converting Models to Guernika

WARNING: Xcode is required to convert models:

  • Make sure you have Xcode installed.

  • Once installed run the following commands:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
sudo xcodebuild -license accept
  • You should now be ready to start converting models!

Step 1: Download and install Guernika Model Converter.

Guernika Model Converter icon

Step 2: Launch Guernika Model Converter from your Applications folder, this app may take a few seconds to load.

Step 3: Once the app has loaded you will be able to select what model you want to convert:

  • You can input the model identifier (e.g. CompVis/stable-diffusion-v1-4) to download from Hugging Face. You may have to log in to or register for your Hugging Face account, generate a User Access Token and use this token to set up Hugging Face API access by running huggingface-cli login in a Terminal window.

  • You can select a local model from your machine: Select local model

  • You can select a local .CKPT model from your machine: Select CKPT

Guernika Model Converter interface

Step 4: Once you've chosen the model you want to convert you can choose what modules to convert and/or if you want to chunk the UNet module (recommended for iOS/iPadOS devices).

Step 5: Once you're happy with your selection click Convert to Guernika and wait for the app to complete conversion. WARNING: This command may download several GB worth of PyTorch checkpoints from Hugging Face and may take a long time to complete (15-20 minutes on an M1 machine).

guernikamodelconverter's People

Contributors

guiyec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

guernikamodelconverter's Issues

Compression fails

Hello, amazing work with Guernika, I love using it.

I have a Macbook Air M1 with 8GB of RAM and to run Guernika with XL models I need to compress them. Unfortunately, the conversion fails. After further research it seems that Guernika Model Converter needs to be updated. See this fix Fix quantize-nbits flag.

Currently using version 7.4.1 (1)

Would you provide a new update soon?

Thanks

Screenshot 2024-03-07 at 10 17 15

Unable to convert SDXL

Diffusers have updated the API, and now it is impossible to convert the SDXL model in the safetensors format.

And whether it is SD1.5 or SDXL, the safetensors format must have a yaml file of the same name next to it, otherwise an error will occur.

huggingface/diffusers#4837

Unable to convert SDXL Unet on MacOS 14

It works normally on MacOS 13.5.

On MacOS 14, The process stayed in the process of saving unet.mlpackage for more than 2 hours, and the ANECompilerService service suddenly appeared, but I chose the GPU.

Running MIL backend_mlprogram pipeline: 100%|██████████| 11/11 [00:00<00:00, 32.32 passes/s]
Saved unet model to /var/folders/rz/mv09yyqj2zs340l11vl_1m080000gn/T/SDXL-Base_unet.mlpackage
2023-08-05 20 11 29 2023-08-05 20 27 34

Enhancement request: Checkpoint merger

I understand that the format used by Apple has some limitations in using LoRas, and right now the best option is to first merge LoRas into a checkpoint and then convert the merged model to mlcore. So a feature for this model converter app to first merge a checkpoint with other checkpoints/LoRas, which is then directly converted would be nice.

It would make my workflow a bit easier. I could use a single app and run it all while I'm doing something else (due to swap file usage, it takes quite long to convert full SDXL checkpoints). I am sure other users are in this situation as well.

In any case, great work on the app! Until earlier today I was doing it with the CLI, this makes things a lot comfier.

Compile guernikatools with nuitka

hello @GuiyeC :
The initialization of guernikatools packaged with pyinstaller is particularly slow, and you need to wait 1-2 minutes each time before the conversion can start.
I used nuitka to compile the guernikatools package into an executable program. After replacing the GuernikaTools file in GuernikaModelConverter, No need to wait, start converting immediately.
nuitka can convert py into C code for compilation, and it does not release a large number of packaged environments like pyinstaller during runtime, making it faster.
I used the following command to test successfully, but it only works in the local environment:

python3 -m nuitka --assume-yes-for-download --output-dir=./GuernikaModelConverter ./guernikatools/torch2coreml.py

Adding the --standalone parameter can compile the entire running environment to run on other computers, but some errors have been encountered. If you understand, you can research it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.