Instructions to use FireRedTeam/FireRed-Image-Edit-1.0-Lightning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use FireRedTeam/FireRed-Image-Edit-1.0-Lightning with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("FireRedTeam/FireRed-Image-Edit-1.0-Lightning", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| language: | |
| - en | |
| - zh | |
| base_model: | |
| - FireRedTeam/FireRed-Image-Edit-1.0 | |
| pipeline_tag: image-to-image | |
| tags: | |
| - FireRed-Image-Edit-1.0 | |
| - distillation | |
| - LoRA | |
| library_name: diffusers | |
| Please refer to [FireRed-Image-Edit-1.0](https://huggingface.co/FireRedTeam/FireRed-Image-Edit-1.0) to learn how to use the distilled edit lora. | |
| use with diffusers 🧨: | |
| make sure to install diffusers from `main` (`pip install git+https://github.com/huggingface/diffusers.git`) | |
| ``` | |
| from diffusers import QwenImageEditPlusPipeline | |
| import torch | |
| from PIL import Image | |
| pipe = QwenImageEditPlusPipeline.from_pretrained( | |
| "FireRedTeam/FireRed-Image-Edit-1.0", torch_dtype=torch.bfloat16, | |
| ).to("cuda") | |
| pipe.load_lora_weights( | |
| "FireRedTeam/FireRed-Image-Edit-1.0-Lightning", weight_name="FireRed-Image-Edit-1.0-Lightning-8steps-v1.0.safetensors" | |
| ) | |
| prompt = "在书本封面Python的下方,添加一行英文文字2nd Edition" | |
| input_image_path = "./examples/edit_example.png" | |
| input_image_raw = Image.open(input_image_path).convert('RGB') | |
| image = pipe( | |
| image = [input_image_raw], | |
| prompt = prompt, | |
| height = None, | |
| width = None, | |
| num_inference_steps = 8, | |
| generator=torch.manual_seed(0), | |
| true_cfg_scale=1.0, # 不使用标准 CFG | |
| ).images[0] | |
| image.save("firered_image_edit_fewsteps.png") | |
| ``` |