Instructions to use ostris/krea2_turbo_style_reference with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ostris/krea2_turbo_style_reference 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("ostris/krea2_turbo_style_reference") prompt = "a white yeti with horns reading a book that is titled \"Ostris + Krea2 Style Reference\"" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
| tags: | |
| - text-to-image | |
| - lora | |
| - diffusers | |
| - template:diffusion-lora | |
| widget: | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00027_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00030_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00028_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00031_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00062_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| - output: | |
| url: images/ComfyUI_temp_bgxgv_00068_.png | |
| text: >- | |
| a white yeti with horns reading a book that is titled "Ostris + Krea2 Style | |
| Reference" | |
| license: other | |
| license_name: krea-2-community-license | |
| license_link: https://huggingface.co/krea/Krea-2-Turbo/blob/main/LICENSE.pdf | |
| base_model: krea/Krea-2-Turbo | |
| instance_prompt: null | |
| # Krea 2 Style Reference LoRA | |
| <Gallery /> | |
| ## Model description | |
| This LoRA will allow you to inference on the Krea2 Turbo model in the style of a reference image. It was trained with [AI Toolkit](https://github.com/ostris/ai-toolkit) using the experimental Krea2 reference image trainer with the turbo training adapter. It was trained on thousands of hand curated style pairs I have been building over the years. It was trained to handle 1-2 reference images. | |
| For inference in Comfy UI you will need this custom node. [ComfyUI-Krea2-Ostris-Edit](https://github.com/ostris/ComfyUI-Krea2-Ostris-Edit) Use the template in that repo with this lora for the effect. No trigger word is needed just image and prompt. | |
| For diffusers, there is a communiuty pipeline here [ostris/Krea2OstrisEdit](https://huggingface.co/ostris/Krea2OstrisEdit). You can run it like below: | |
| ```python | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| from PIL import Image | |
| pipe = DiffusionPipeline.from_pretrained( | |
| "krea/Krea-2-Turbo", | |
| custom_pipeline="ostris/Krea2OstrisEdit", | |
| torch_dtype=torch.bfloat16, | |
| ) | |
| pipe.enable_model_cpu_offload() # or pipe.to("cuda") with ~40+ GB of VRAM | |
| # An AI-Toolkit Krea 2 LoRA, e.g. the style reference LoRA | |
| pipe.load_lora_weights( | |
| "ostris/krea2_turbo_style_reference", weight_name="krea2_style_reference.safetensors" | |
| ) | |
| image = pipe( | |
| "a white yeti with horns reading a book", | |
| image=Image.open("style_reference.png"), # one reference image or a list of them | |
| ).images[0] | |
| image.save("output.png") | |
| ``` | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| ## Download model | |
| [Download](/ostris/krea2_turbo_style_reference/tree/main) them in the Files & versions tab. | |