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
Upload folder using huggingface_hub
Browse files- README.md +14 -0
- pytorch_lora_weights.safetensors +3 -0
- reproduce.py +30 -0
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- krea/Krea-2-Turbo
|
| 4 |
+
tags:
|
| 5 |
+
- lora
|
| 6 |
+
library_name: diffusers
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
- 0.01 weight = +1×
|
| 11 |
+
- 0.1 weight = +10×
|
| 12 |
+
- 1.0 weight = +100×
|
| 13 |
+
```
|
| 14 |
+
|
pytorch_lora_weights.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c3eeb6ef85bf1b569183c4b0337d97152e8b1fa2e32da5a30095380d5de6e13
|
| 3 |
+
size 268
|
reproduce.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.14"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "huggingface-hub>=1",
|
| 5 |
+
# "numpy>2",
|
| 6 |
+
# "safetensors>=0.8",
|
| 7 |
+
# "torch>2",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [[tool.uv.index]]
|
| 11 |
+
# url = "https://download.pytorch.org/whl/cpu"
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
import huggingface_hub
|
| 15 |
+
import safetensors
|
| 16 |
+
import safetensors.torch
|
| 17 |
+
import torch
|
| 18 |
+
|
| 19 |
+
with safetensors.safe_open(
|
| 20 |
+
filename=huggingface_hub.hf_hub_download(
|
| 21 |
+
repo_id="krea/Krea-2-Turbo",
|
| 22 |
+
filename="transformer/diffusion_pytorch_model-00001-of-00003.safetensors",
|
| 23 |
+
),
|
| 24 |
+
framework="pt",
|
| 25 |
+
) as sft:
|
| 26 |
+
lora: dict[str, torch.Tensor] = {}
|
| 27 |
+
proj: torch.Tensor = sft.get_tensor("text_fusion.projector.weight")
|
| 28 |
+
lora["transformer.text_fusion.projector.lora_A.weight"] = proj
|
| 29 |
+
lora["transformer.text_fusion.projector.lora_B.weight"] = proj.new_tensor([[100.0]])
|
| 30 |
+
safetensors.torch.save_file(lora, "pytorch_lora_weights.safetensors")
|