5 ms·
Is there any way to download this on my PC and run it offline? Something like a command-line tool like $ ./something "cow flying in space" > cow-in-space.p
by badsectoracula 4y ago
Is there any way to download this on my PC and run it offline? Something like a command-line tool like
$ ./something "cow flying in space" > cow-in-space.png
that runs with local-only data (i.e. no internet access, no DRM, no weird API keys, etc like pretty much every AI-related application i've seen recently) would be neat.
- GaggiX 4y agoYes you can https://github.com/huggingface/diffusers/releases/tag/v0.2.3 https://github.com/huggingface/diffusers/releases/tag/v0.2.3 (probably the easiest way)
- timmg 4y agoGarr: > And log in on your machine using the huggingface-cli login command. I find that annoying. I guess it is what it is.
- mkaic 4y agoYes, that's actually the biggest reason this is such a cool announcement! You just need to download the model checkpoints from HuggingFace[0] and follow the instructions on their Github repo[1] and and you should be good to go. You basically just need to clone the repo, set up a conda environment, and make the weights available to the scripts they provide. [0] https://huggingface.co/CompVis/stable-diffusion https://huggingface.co/CompVis/stable-diffusion [1] https://github.com/CompVis/stable-diffusion https://github.com/CompVis/stable-diffusion Good luck!
- vintermann 4y agoYou need a decent GPU, though. I suspect my 6080MiB won't cut it any longer :(
- neurostimulant 4y agoYou're going to need at least 10GB VRAM. My SFF pc with 4GB VRAM can only run dalle mini / craiyon :(
- mempko 4y agoNot if you change the precision to float16. Should work on a smaller card. Tried on a 1080 with 8GB and it works well.
- krisoft 4y agoHow would one do that? ----- Sorry my bad, found the answer. One simply adds the following flags to the StableDiffusionPipeline.from_pretrained call in the example: revision="fp16", torch_dtype=torch.float16 Found it in this blogpost: https://huggingface.co/blog/stable_diffusion https://huggingface.co/blog/stable_diffusion mempko thank you for your hint! I was about to drop a not insignificant amount of money on a new GPU. What does one lose by using float16 representation? Does it make the images visually less detailed? Or how can one reason about this?
- ShamelessC 4y agoZero loss. All upside. Only causes issues when training. 32-bit ships by default because it is compatible with cpu and GPU’s that might not have native fp16 support. Edit: Just to be clear, your intuition that it could cause issues is certainly merited - and not _all_ models can be trivially converted from fp32 to fp16 without some new error accumulating (during inference). Variational autoencoders like VQGAN and GAN's are particularly prone to such issues. But in this case, it's all upside.
- deleted 4y ago[deleted]
- ompto 4y agoThere's a version that's a bit slower but more memory efficient https://github.com/basujindal/stable-diffusion https://github.com/basujindal/stable-diffusion that runs on 6GB too.
- miohtama 4y agoIs Apple M1 support expected soon? Because even if Apple’s chips are slower, they have plenty of RAM on laptops. I saw some weeks ago it was coming, but I am not sure where to follow the process.
- bm-rf 4y agolooks like there is a nightly release for apple silicon, https://towardsdatascience.com/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1 https://towardsdatascience.com/gpu-acceleration-comes-to-pyt...
- tariq2388 4y agoCan you please tell me where is the model.ckpt? I am not able to find any weight with ".ckpt" format there in the both links that you have given. There are the ".bin" file on the hugging face.
- NosliwPilf 4y agoOn the huggingface site, click the checkbox and then access the repository. The chkpt file is under the "files and version" tab.
- IanCal 4y agoFor anyone else reading you need the -original versions. The others are setup for the diffusers library and I can't find a checkpoint file in that, just the original one.
- snak 4y agoWhat's the difference between those 4 checkpoints? From the GitHub's README: sd-v1-1.ckpt: 237k steps at resolution 256x256 on laion2B-en. 194k steps at resolution 512x512 on laion-high-resolution (170M examples from LAION-5B with resolution >= 1024x1024). sd-v1-2.ckpt: Resumed from sd-v1-1.ckpt. 515k steps at resolution 512x512 on laion-aesthetics v2 5+ (a subset of laion2B-en with estimated aesthetics score > 5.0, and additionally filtered to images with an original size >= 512x512, and an estimated watermark probability < 0.5. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using the LAION-Aesthetics Predictor V2). sd-v1-3.ckpt: Resumed from sd-v1-2.ckpt. 195k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve classifier-free guidance sampling. sd-v1-4.ckpt: Resumed from sd-v1-2.ckpt. 225k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve classifier-free guidance sampling. Which one is the general use case checkpoint one should be using?
- deleted 4y ago[deleted]
- cercatrova 4y agoYes, clone the repo (https://github.com/CompVis/stable-diffusion https://github.com/CompVis/stable-diffusion), download the weights and follow the readme for setting up a conda environment. I am presently doing so on my RTX 3080.
- isoprophlex 4y agoI can't believe i sold my rtx2070 last month, aaargh...!
- google234123 4y agoYou should have sold it a year ago when the market was better :p
- tariq2388 4y agoCan you please tell me where is the model.ckpt? I am not able to find any weight with ".ckpt" format there in the both links that you have given. There are the ".bin" file on the hugging face.
- cercatrova 4y agohttps://cdn-lfs.huggingface.co/repos/4c/37/4c372b4ebb57bbd02e68413d4951aa326d4b3cfb6e62db989e529c6d4b26fb21/fe4efff1e174c627256e44ec2991ba279b3816e364b49f9be2abc0b3ff3f8556?response-content-disposition=attachment%3B%20filename%3D%22sd-v1-4.ckpt%22 https://cdn-lfs.huggingface.co/repos/4c/37/4c372b4ebb57bbd02... Here's the direct link.
- jsmith45 4y agoI think the answer is yes, but setup is a bit complicated. I would test this myself, but I don't have an NVIDIA card with at least 10GB of VRAM. One time: 1. Have "conda" installed. 2. clone https://github.com/CompVis/stable-diffusion https://github.com/CompVis/stable-diffusion 3. `conda env create -f environment.yaml` 4. activate the Venv with `conda activate ldm` 5. Download weights from https://huggingface.co/CompVis/stable-diffusion-v-1-4-original https://huggingface.co/CompVis/stable-diffusion-v-1-4-origin... (requires registration). 6. `mkdir -p models/ldm/stable-diffusion-v1/` 7. `ln -s <path/to/model.ckpt> models/ldm/stable-diffusion-v1/model.ckpt`. (you can download the other version of the model, like v1-1, v1-2, and v1-3 and symlink them instead if you prefer). To run: 1. activate venv with `conda activate ldm` (unless still in a prompt running inside the venv). 2. `python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms`. Also there is a safety filter in the code that will black out NSFW or otherwise expected to be offensive images (presumably also including things like swastikas, gore, etc). It is trivial to disable by editing the source if you want.
- cypress66 4y agoI haven't gotten around it, but I remember reading on /g/ that you can make it run on 5GB (sacrificing accuracy). You should check their threads there, there's some good info.
- entrep 4y agoThanks for these instructions. Unfortunately I'm getting this error message (Win11, 3080 10GB): > RuntimeError: CUDA out of memory. Tried to allocate 3.00 GiB (GPU 0; 10.00 GiB total capacity; 5.62 GiB already allocated; 1.80 GiB free; 5.74 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CON Edit: >>> from GPUtil import showUtilization as gpu_usage >>> gpu_usage() | ID | GPU | MEM | ------------------ | 0 | 1% | 6% | Edit 2: Got this optimized fork to work: https://github.com/basujindal/stable-diffusion https://github.com/basujindal/stable-diffusion
- orpheansodality 4y ago
- digitallyfree 4y agoAs an aside I wonder how performance would be like running this on CPU (with the current GPU shortage this might well be a worthwhile choice). Even something like 30 minutes to generate an image on a multicore CPU would greatly increase the number of people able to freely play with this model.
- squeaky-clean 4y agoThere's some additional discussion on running it locally here https://old.reddit.com/r/StableDiffusion/comments/wuyu2u/how_do_i_run_stable_diffusion_and_sharing_faqs/ https://old.reddit.com/r/StableDiffusion/comments/wuyu2u/how...
- drexlspivey 4y agoYes but you need a GPU with 10Gb of vRAM
- simsspoons 4y agoor just run it on baseten https://app.baseten.co/apps/VqK2vYP/operator_views/pqvba2q https://app.baseten.co/apps/VqK2vYP/operator_views/pqvba2q
- naillo 4y agoThis should be possible if someone just exported them to tflite or onnxruntime etc (quantization could help a ton too). Not sure why ppl haven't yet. Sure it'll come in the next few days (I might do it).
- bfirsh 4y agoYou can run it with Cog: https://github.com/replicate/cog https://github.com/replicate/cog cog predict r8.im/stability-ai/stable-diffusion -i prompt="cow flying in space" Or you can run the Docker image directly. More details under "run on your own computer" here: https://replicate.com/stability-ai/stable-diffusion https://replicate.com/stability-ai/stable-diffusion
- cmdr2 4y agoThanks! This worked for me finally. The conda approach suggested elsewhere was getting too complicated, and wasn't working properly (for me). I built a simple UI around this, which installs Stable Diffusion's docker image, and lets you play with it locally in a browser-based UI. https://github.com/cmdr2/stable-diffusion-ui https://github.com/cmdr2/stable-diffusion-ui
- martopix 4y agoThat is literally the announcement.
- cmdr2 4y agoYou can try https://github.com/cmdr2/stable-diffusion-ui https://github.com/cmdr2/stable-diffusion-ui . It installs Stable Diffusion to your local computer, and provides a simple browser-based UI for playing with it. No need to mess with conda and other environment settings.