Instructions to use Beinsezii/Krea-2-Turbo-Projector-Scale-LoRA-Diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Beinsezii/Krea-2-Turbo-Projector-Scale-LoRA-Diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("krea/Krea-2-Turbo", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Beinsezii/Krea-2-Turbo-Projector-Scale-LoRA-Diffusers") 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
File size: 882 Bytes
bdae485 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # /// script
# requires-python = ">=3.14"
# dependencies = [
# "huggingface-hub>=1",
# "numpy>2",
# "safetensors>=0.8",
# "torch>2",
# ]
#
# [[tool.uv.index]]
# url = "https://download.pytorch.org/whl/cpu"
# ///
import huggingface_hub
import safetensors
import safetensors.torch
import torch
with safetensors.safe_open(
filename=huggingface_hub.hf_hub_download(
repo_id="krea/Krea-2-Turbo",
filename="transformer/diffusion_pytorch_model-00001-of-00003.safetensors",
),
framework="pt",
) as sft:
lora: dict[str, torch.Tensor] = {}
proj: torch.Tensor = sft.get_tensor("text_fusion.projector.weight")
lora["transformer.text_fusion.projector.lora_A.weight"] = proj
lora["transformer.text_fusion.projector.lora_B.weight"] = proj.new_tensor([[100.0]])
safetensors.torch.save_file(lora, "pytorch_lora_weights.safetensors")
|