Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

[FEATURE REQUEST] add download of the ckpt from hugging face git LFS instead of sending users there directly #4

Closed
altryne opened this issue Aug 29, 2022 · 7 comments

Comments

@altryne
Copy link
Owner

altryne commented Aug 29, 2022

Possible to have the notebook download the model for people with slow upload speeds?

I ended up using this: https://gist.github.com/davo/4b374f41be657f59bfb60d1ee61d2616 to save myself a lot of time

Originally posted by @pinilpypinilpy in Sygil-Dev/stable-diffusion#108 (comment)

@pinilpypinilpy
Copy link
Contributor

I find that this does the trick:
token="" #@param {type:"string"} #download just the required model to avoid the massive 7gb ema one !git lfs install --system --skip-repo !mkdir sd-model %cd /content/sd-model/ !git init !git remote add -f origin "https://USER:{token}@huggingface.co/CompVis/stable-diffusion-v-1-4-original" !git config core.sparsecheckout true !echo "sd-v1-4.ckpt" > .git/info/sparse-checkout !git pull origin main

@altryne
Copy link
Owner Author

altryne commented Aug 30, 2022

This needs a checkbox for sure, for folks who use colab alot, they already have the model in their drive, this could just mean un-nessesary download time.

Care to open a PR with how you think this should work?

I'd also comment that I think it's a good idea to still save this model if it doesn't exist in users Gdrive, as well as outputs, so when the colab closes on them, they will still have the results

@altryne altryne changed the title Looks good, thanks! [FEATURE REQUEST] add download of the ckpt from hugging face git LFS instead of sending users there directly Aug 30, 2022
@altryne
Copy link
Owner Author

altryne commented Aug 30, 2022

Could be super cool if we... check if the model exists already in the specified model folder (either in drive or locally) and then if it doesn't.. ask them for their hugging face token and download it for them

@Lyntai
Copy link

Lyntai commented Aug 30, 2022

I just use this, it downloads in about 30 seconds:

!wget --user=*YOUR USER* --password=*YOUR PSW* https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt

Then move to folder:

import shutil
shutil.move('sd-v1-4.ckpt', models_path)

@altryne
Copy link
Owner Author

altryne commented Aug 30, 2022

or could someone who already have the file in their google drive share a link so we can save it to our google drive without uploading the same file?

I won't add this to the repo as it would violate the hugging face TOC I think

@thrasher150306
Copy link

or could someone who already have the file in their google drive share a link so we can save it to our google drive without uploading the same file?

I won't add this to the repo as it would violate the hugging face TOC I think

sorry haha stupid question

@altryne
Copy link
Owner Author

altryne commented Aug 30, 2022

That's all good, and it works! I did this when I walked some of my friends through this.
I think a simple option is to link to hugging face and ask for token in an input so it'll skip the manual step.
Will also be helpful in paperspace (I'm planning that next)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants