Feature Request(s)

#4
by xi0v - opened

Hello!
Great space, I'm trying to convert an SDXL model from diffusers format to .safetensors.
But the space should have more customizability. Please do consider adding those once you are available!
Such as being able to select the precision of the .safetensors file such as ; bf16, fp16 and f32 (if possible ofcourse.)(f32 is probably not a good idea but it's there)
Upload to another repo (customizable repo name like the one in https://huggingface.co/spaces/John6666/sdxl-to-diffusers-v2)
And finally, Private repo conversion and upload.

Owner

Good morning.
Private repo related and upload related functions are easy. It's mostly diverted, and there's the HF API.
It will take time to develop, so it won't be finished soon, but it's not difficult at all.
It would be convenient if it could be completed only in HF without using local storage.

I originally didn't convert the accuracy at save time. It will be saved with the same accuracy as when it is loaded.
If I had to do it, I would only have to specify the precision at load time, but it would still be easy to change this from fp16.
However, as you mention, fp32 precision is rarely used to begin with, and in free space I think it would get stuck in the middle due to lack of RAM...
I'll try to only give it the option when I put it on, but it probably won't work.
BF16 on the other hand would be useful. Accuracy is high and the size is the same as fp16.

Goodmorning.

Private repo related and upload related functions are easy. It's mostly diverted, and there's the HF API.

Yeah these are easy stuff.

However, as you mention, fp32 precision is rarely used to begin with, and in free space I think it would get stuck in the middle due to lack of RAM...

Yeah that's why I said f32 is not a good idea.

The main focus should just be the customizability and precision selection.

It will take time to develop, so it won't be finished soon, but it's not difficult at all.
It would be convenient if it could be completed only in HF without using local storage
Agreed. I'd love to see these features implemented even if it'll take a while!

I'll probably try to Implement these in my duplicated space and if its good I'll open a PR.

Owner
โ€ข
edited Oct 6

I'll probably try to Implement these in my duplicated space and if its good I'll open a PR.

It helps.
As for the precision change, the original script was designed to allow only half or other options, so I fixed it to half for now, but in short, just use .to(torch.float16) or .to(torch.bfloat16) instead of .half(). This function is just an alias, and the processing should have been exactly the same as .to(torch.float16). I'd also prefer to make the options a string type and have it branch. Right now it's a bool type, so it's not suitable for a lot of choices.
I'll need to change the parser part, so I might as well do this part myself. It would be easier for me if you do it.

In any case, it would be faster if we try to change it first and adjust it. I'll make a copy of the repo for experimentation.

https://huggingface.co/spaces/John6666/convert_repo_to_safetensors_mod
It is for experimental use only, and it would be undesirable to change the URL, so when the experiment is over, we'll backport it here and hide this one.

Owner

@xi0v I thought of it as a preliminary adjustment and tinkered with it, and before I knew it, the logic part was almost complete.
Now it's time to check the operation and make adjustments.
https://huggingface.co/spaces/John6666/convert_repo_to_safetensors_mod

Sign up or log in to comment