Instructions to use elvis92/pets_rank_2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use elvis92/pets_rank_2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("elvis92/pets_rank_2") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Download diffusers/docs/source/en/using-diffusers/control_brightness.md from elvis92/pets_rank_2: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/docs/source/en/using-diffusers/control_brightness.md
- Command line
-
hf download hf://elvis92/pets_rank_2/diffusers/docs/source/en/using-diffusers/control_brightness.md
-
curl -L -o control_brightness.md https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/docs/source/en/using-diffusers/control_brightness.md
Control image brightness
The Stable Diffusion pipeline is mediocre at generating images that are either very bright or dark as explained in the Common Diffusion Noise Schedules and Sample Steps are Flawed paper. The solutions proposed in the paper are currently implemented in the [DDIMScheduler] which you can use to improve the lighting in your images.
💡 Take a look at the paper linked above for more details about the proposed solutions!
One of the solutions is to train a model with v prediction and v loss. Add the following flag to the train_text_to_image.py or train_text_to_image_lora.py scripts to enable v_prediction:
--prediction_type="v_prediction"
For example, let's use the ptx0/pseudo-journey-v2 checkpoint which has been finetuned with v_prediction.
Next, configure the following parameters in the [DDIMScheduler]:
rescale_betas_zero_snr=True, rescales the noise schedule to zero terminal signal-to-noise ratio (SNR)timestep_spacing="trailing", starts sampling from the last timestep
from diffusers import DiffusionPipeline, DDIMScheduler
pipeline = DiffusionPipeline.from_pretrained("ptx0/pseudo-journey-v2", use_safetensors=True)
# switch the scheduler in the pipeline to use the DDIMScheduler
pipeline.scheduler = DDIMScheduler.from_config(
pipeline.scheduler.config, rescale_betas_zero_snr=True, timestep_spacing="trailing"
)
pipeline.to("cuda")
Finally, in your call to the pipeline, set guidance_rescale to prevent overexposure:
prompt = "A lion in galaxies, spirals, nebulae, stars, smoke, iridescent, intricate detail, octane render, 8k"
image = pipeline(prompt, guidance_rescale=0.7).images[0]
image