LaurentMazare / diffusers-rs

An implementation of the diffusers api in Rust
Apache License 2.0
522 stars 54 forks source link

Automate weights setup #4

Closed mspronesti closed 1 year ago

mspronesti commented 1 year ago

Hello @LaurentMazare and thanks for this awesome Rust implementation! I'm playing around with it but I find the overall setup a little boring as it requires to switch from bash to python a couple of times and to place things in the right directory.

Therefore, I wrote a shell script to automate the whole process. Might you be interested in such a contribution (e.g. under a scripts folder in the root of the repository) ? Cheers :smiley:

JohnAlcatraz commented 1 year ago

Yes, please make a PR with that! Even if it's not getting merged, it would still allow people to use it. I'd really like to be able to use it :)

mspronesti commented 1 year ago

Hi @JohnAlcatraz, I'm happy you are interested in this contribution. I think I will wait for a reply from @LaurentMazare and if he is not interested in this contribution I will just upload the script here :+1:

I'm not opening a PR right now not to mess up with the repository structure he might have in mind, which would force me to rebase the PR and so on.

LaurentMazare commented 1 year ago

If you already have a small script to do this, certainly feel free to make a PR. That said don't put too much effort in it, I have some hope that we can tweak things to use the original weight files directly, and if it doesn't work out I'll check the license and package the weights on huggingface as per #8 , so the script won't be necessary anymore at that point (I should get around it this weekend).

JohnAlcatraz commented 1 year ago

I have some hope that we can tweak things to use the original weight files directly, and if it doesn't work out I'll check the license and package the weights on huggingface as per https://github.com/LaurentMazare/diffusers-rs/issues/8 , so the script won't be necessary anymore at that point (I should get around it this weekend).

Any news on that? Would love to try this out, but I'm waiting for that first. Either option sounds fine to me, using the original weight files directly seems best of course.

LaurentMazare commented 1 year ago

Using the original files directly from Rust is challenging because of some Python specific bits that they include that would require a Python runtime. I'll have a look at packaging the weights on huggingface but I would recommend using the script that @mspronesti added, scripts/download_weights.sh as this should grab the original weights and convert them for you automatically.

mspronesti commented 1 year ago

@LaurentMazare Maybe you could update the last section of the README, including the instruction to use the script instead of manual installation.

JohnAlcatraz commented 1 year ago

The script unfortunately does not work for me. It opens a window with some text for 0.1 seconds, that closes before I can read what it says, and is not downloading or converting anything.

I used OBS to capture my screen to be able to then see in the video what the window with the text says:

image

It does create the "data" folder successfully, but after it run, the data folder is empty. The wget command seems to fail.

I think the issue is that your script is really designed for Linux, and not for Windows, right? Windows by default does not even have wget. I know I installed it myself a few months ago for something. Windows also does not have gunzip.

Unfortunately, a script that only works on Linux is not very helpful for most people, since only around 2% of people use Linux.

JohnAlcatraz commented 1 year ago

I managed to get it to work by running it on the WSL on Windows. But it's not really a nice way to do it that way, the average user does not know how to use the WSL. It took quite a while to install all the stuff that was required for it in the WSL.