Views
No views yet
!pip install -q diffusers transformers accelerate1from diffusers import StableDiffusionXLPipeline
2import torch
3
4model = "IDK-ab0ut/Yiffymix_v51-XL"
5pipeline = StableDiffusionXLPipeline.from_pretrained(
6 model, torch_dtype=torch.float16).to("cuda")
7
8prompt = "a cat, detailed background, dynamic lighting"
9negative_prompt = "low resolution, bad quality, deformed"
10steps = 25
11guidance_scale = 4
12image = pipeline(prompt=prompt, negative_prompt=negative_prompt,
13 num_inference_steps=steps, guidance_scale=guidance_scale,
14 clip_skip=2).images[0]
15imagefrom diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler1model = "IDK-ab0ut/Yiffymix_v51"
2euler = EulerDiscreteScheduler.from_pretrained(
3 model, subfolder="scheduler")
4pipeline = StableDiffusionXLPipeline.from_pretrained(
5 model, scheduler=euler, torch.dtype=torch.float16
6 ).to("cuda")from diffusers import StableDiffusionXLPipeline, DPMSolverMultistepScheduler1model = "IDK-ab0ut/Yiffymix_v51"
2dpmsolver = DPMSolverMultistepScheduler.from_pretrained(
3 model, subfolder="scheduler", use_karras_sigmas=True,
4 algorithm_type="sde-dpmsolver++").to("cuda")
5# 'use_karras_sigmas' is called to make the scheduler
6# use Karras sigmas during sampling.
7pipeline = StableDiffusionXLPipeline.from_pretrained(
8 model, scheduler=dpmsolver, torch.dtype=torch.float16,
9 ).to("cuda")from diffusers import StableDiffusionXLPipeline, AutoencoderKL1link = "your vae's link"
2model = "IDK-ab0ut/Yiffymix_v51"
3vae = AutoencoderKL.from_single_file(link).to("cuda")
4pipeline = StableDiffusionXLPipeline.from_pretrained(
5 model, vae=vae).to("cuda")1link = "your vae's link"
2model = "IDK-ab0ut/Yiffymix_v51"
3vae = AutoencoderKL.from_single_file(
4 link, torch_dtype=torch.float16).to("cuda")
5pipeline = StableDiffusionXLPipeline.from_pretrained(
6 model, torch_dtype=torch.float16,
7 vae=vae).to("cuda")link variable or any string variables containing the link of the file with path directory of the .safetensors.HTTP404 error because the program can't resolve your link, here's a simple fix.pip.!pip install --upgrade huggingface_hubfrom huggingface_hub import hf_hub_download1repo = "username/model"
2file = "the vae's file.safetensors"
3model = "IDK-ab0ut/Yiffymix_v51"
4vae = AutoencoderKL.from_single_file(
5 hf_hub_download(repo_id=repo,
6 filename=file)).to("cuda")
7pipeline = StableDiffusionXLPipeline.from_pretrained(
8 model, vae=vae).to("cuda")
9# use 'torch_dtype=torch.float16' for FP16.
10# add 'subfolder="folder_name"' argument if the VAE is in specific folder.HTTP404 error.from_single_file() method. It only works for files inside HuggingFace and local files only. You can upload the VAE from there into HuggingFace, but you must comply with the model's license before continuing. To solve this issue, you may use wget or curl command to get the file from outside HuggingFace.cd.
Use -O option before specifying the file's link and name. It's the same thing for both wget and curl.1# For 'wget'
2!cd <path>; wget -O [filename.safetensors] <link>
3
4# For 'curl'
5!cd <path>; curl -O [filename.safetensors] <link>
6
7# Use only one of them. Replace "filename" with any
8# name you want. If you run the code in Command Prompt or
9# Windows Shell, you don't need the exclamation mark (!).from_single_file() method normally. Make sure to input the correct path for your VAE file. Load the VAE file into AutoencoderKL.1path = "path to VAE" # Ends with .safetensors file format.
2model = "IDK-ab0ut/Yiffymix_v51"
3vae = AutoencoderKL.from_single_file(path).to("cuda")
4pipeline = StableDiffusionXLPipeline.from_pretrained(
5 model, vae=vae).to("cuda")
6
7# Use 'torch_dtype=torch.float16' for both
8# AutoencoderKL and SDXL pipeline for FP16.wget and curl method to download files from HuggingFace. ㅤ1. In any way that violates any applicable national, federal, state, local or international law or regulation.
ㅤ2. For the purpose of exploiting, harming or attempting to exploit or harm minors in any way.
ㅤ3. To generate or disseminate verifiably false information and/or content with the purpose of harming others.
ㅤ4. To generate or disseminate personal identifiable information that can be used to harm an individual.
ㅤ5. To defame, disparage or otherwise harass others.
ㅤ6. For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation.
ㅤ7. For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics.
ㅤ8. To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm.
ㅤ9. For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories.
ㅤ10. To provide medical advice and medical results interpretation.
ㅤ11. To generate or disseminate information for the purpose to be used for administration of justice, law enforcement, immigration or asylum processes, such as predicting an individual will commit fraud/crime commitment (e.g. by text profiling, drawing causal relationships between assertions made in documents, indiscriminate and arbitrarily-targeted use).