Diffusers
English
stable-diffusion
stable-diffusion-diffusers
inpainting
art
artistic
anime
absolute-realism
Run this model with HF Jobs
Run diffusers/tools on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/diffusers/tools. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/diffusers/tools on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use diffusers/tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusers/tools with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("diffusers/tools", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Commit ·
18ff08e
1
Parent(s): 9ae8cf2
up
Browse filesFiles changed (3)
- cat.ptAdded+3
- dog.ptAdded+3
- run_pix2pix0.pyAdded+54
123version https://git-lfs.github.com/spec/v1oid sha256:aa9441dc014d5e86567c5ef165e10b50d2a7b3a68d90686d0cd1006792adf334size 237300123version https://git-lfs.github.com/spec/v1oid sha256:becf079d61d7f35727bcc0d8506ddcdcddb61e62d611840ff3d18eca7fb6338csize 237300123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!/usr/bin/env python3from huggingface_hub import HfApiimport torch
# https://github.com/pix2pixzero/pix2pix-zero/blob/main/src/edit_synthetic.pyimport requests
from diffusers import DDIMScheduler, StableDiffusionPix2PixZeroPipeline
api = HfApi()
def download(embedding_url, local_filepath): r = requests.get(embedding_url) with open(local_filepath, "wb") as f: f.write(r.content)
model_ckpt = "CompVis/stable-diffusion-v1-4"pipeline = StableDiffusionPix2PixZeroPipeline.from_pretrained( model_ckpt, conditions_input_image=False, torch_dtype=torch.float16)pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)pipeline.to("cuda")
prompt = "a high resolution painting of a cat in the style of van gough"source_embedding_url = "https://github.com/pix2pixzero/pix2pix-zero/raw/main/assets/embeddings_sd_1.4/cat.pt"target_embedding_url = "https://github.com/pix2pixzero/pix2pix-zero/raw/main/assets/embeddings_sd_1.4/dog.pt"
for url in [source_embedding_url, target_embedding_url]: download(url, url.split("/")[-1])
source_embeds = torch.load(source_embedding_url.split("/")[-1])target_embeds = torch.load(target_embedding_url.split("/")[-1])
image = pipeline( prompt, source_embeds=source_embeds, target_embeds=target_embeds, num_inference_steps=50, cross_attention_guidance_amount=0.15,).images[0]
path = "/home/patrick_huggingface_co/images/aa.png"image.save(path)
api.upload_file( path_or_fileobj=path, path_in_repo=path.split("/")[-1], repo_id="patrickvonplaten/images", repo_type="dataset",)print("https://huggingface.co/datasets/patrickvonplaten/images/blob/main/aa.png")cat.ptAdded+3
dog.ptAdded+3
run_pix2pix0.pyAdded+54