How to use this in Kohya?

#1
by GeneralAwareness - opened

I can't get this to work, or the original, to work in Kohya trainer.

Owner

or the original

Important information. This is pretty much it for me. Maybe the original was not converted properly in the strict sense of the word. (The whole Flux conversion feature is still kind of under testing.)
Because the rest of the body of this repo is the dev version itself.

This is probably easy in terms of code, but very hard in terms of file size. I'm working on another project for a bit, so I'll probably mess around with it a bit later.

Yeah, I converted, had some error. If I try to directly use this in Kohya crash, error, boom. It does do diffusers.

Owner

Kohya is for a single safetensors file for A1111 WebUI system, right? If so, there is no way to use it.

Think png and gif, zip and rar, for example. The purpose is the same, and the data they contain is essentially the same, but the format is different, so changing only the extension will not work. (Well, on Windows or Mac, it is detected and works on its own.)

Currently, for SDXL and SD1.5 models, it is possible to convert from Diffusers format to a single safetensors file, but for Flux models, the code itself does not exist yet.
The only way is for someone else to create it, but if I were to create it from scratch, it would be 100% buggy.

In other words, for now the Diffusers format is a Diffusers-only showroom or graveyard for Flux models.
That's definitely not a good thing.
I'd really like to make a request to the developer, but I honestly don't know who's in charge, and before that I don't have a github account yet...

Yes, I agree. They made it so they have the script, but they are very secretive about far too much having been the SAI devs I can expect that, but this is going next level now.

Owner

Everyone at HF is very knowledgeable about the various AI situations, respectively.
I'm a newbie since Animagine 3.1, so I don't know enough about it to have an intuition about the dynamics between organizations and individuals.

BTW, I said I didn't know who was in charge earlier, but I just looked on github and found out the author is sayakpaul. If someone sends him a mentions on HF, he will get the message immediately.
Well, putting aside the small details, what all I need to do is just tell make a FLUX version of the script below! to @ sayakpaul. But he seems busy and it's hard to start to tell him...😭
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_sdxl_lora_to_webui.py
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_sdxl.py
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_stable_diffusion.py

Well, Juggernaught is working with BFL to make a new model and are training it. My hope is this is a training (which I think) and not a distillation.

Owner

HF should hire more development staff for Diffusers...rather seriously...
They are all technically talented, but with so many new architecture models being released, they don't have enough people...

Speaking of models, there are no conversion scripts not only for Flux but also for AuraFlow, which is considered to be the next Pony platform.
For what it's worth, Diffusers have many entrances, but the three above are all the exits. This is kind of a...business strategy no-no. Even Apple at their worst won't lock you up this much.
And maybe it's not that kind of HF's strategy, but they're simply not aware of it because of carelessness.

I agree with you. How did BFL make the conversion from diffusers to a single safetensors on their download page?

Owner

https://github.com/huggingface/diffusers/blob/main/scripts/convert_flux_to_diffusers.py
I think they created a stand alone safetensors file and then converted it to Diffusers. Maybe the author of this is a BFL guy?
In the extreme, we could just write the inverse function of this, but that's easier said than done.
If even one byte is wrong, a broken model will be mass-produced, so it is not so easy to do.

The candidate should be familiar with the file structure of Diffusers...and so on...and in the end, it is best to leave it to the Diffusers developers.

Now it's just a matter of when to bring it up...
It's hard to do this when HF is buggy, SD1.5 referenced in from_single_files disappears, and everyone seems to be busy...πŸ˜”

When I went searching I found it ironic that whatever I could find was a safetensors to diffusers but nothing the other way around, which made zero sense to me. A one way street, maybe?

Owner
β€’
edited Sep 7

A one way street, maybe?

Definitely yes except for these 3.
At least that's all that's out there on the net in open source.
This is a treasure trove of HF training resources.
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_sdxl_lora_to_webui.py
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_sdxl.py
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_stable_diffusion.py

Of course, there will be those who create and have their own conversion tools. Perhaps someone else may have made it available to the public.
But until now, there was a long period of time when SD1.5 and SDXL were the de facto standard, so even if they were made public, there would not have been any demand for anyone.

Owner
β€’
edited Sep 7

Oh, and by the way, I think only Flux LoRA can be converted because there is no change in structure (it's just a diff in the extreme). I think that's one of the reasons why there's so much activity in making LoRAs for Flux.

Sign up or log in to comment