rootlocalghost commited on
Commit
f228eca
·
verified ·
1 Parent(s): b5feb9b

clone README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ pipeline_tag: image-to-image
7
+ library_name: transformers
8
+ ---
9
+ <div align="center">
10
+ <img src="assets/longcat-image_logo.svg" width="45%" alt="LongCat-Image" />
11
+ </div>
12
+ <hr>
13
+
14
+ <div align="center" style="line-height: 1;">
15
+ <a href='https://arxiv.org/pdf/2512.07584'><img src='https://img.shields.io/badge/Technical-Report-red'></a>
16
+ <a href='https://github.com/meituan-longcat/LongCat-Image'><img src='https://img.shields.io/badge/GitHub-Code-black'></a>
17
+ <a href='https://github.com/meituan-longcat/LongCat-Flash-Chat/blob/main/figures/wechat_official_accounts.png'><img src='https://img.shields.io/badge/WeChat-LongCat-brightgreen?logo=wechat&logoColor=white'></a>
18
+ <a href='https://x.com/Meituan_LongCat'><img src='https://img.shields.io/badge/Twitter-LongCat-white?logo=x&logoColor=white'></a>
19
+ </div>
20
+ <div align="center" style="line-height: 1;">
21
+
22
+ [//]: # ( <a href='https://meituan-longcat.github.io/LongCat-Image/'><img src='https://img.shields.io/badge/Project-Page-green'></a>)
23
+ <a href='https://huggingface.co/meituan-longcat/LongCat-Image'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCat--Image-blue'></a>
24
+ <a href='https://huggingface.co/meituan-longcat/LongCat-Image-Dev'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCat--Image--Dev-blue'></a>
25
+ <a href='https://huggingface.co/meituan-longcat/LongCat-Image-Edit'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCat--Image--Edit-blue'></a>
26
+ <a href='https://huggingface.co/meituan-longcat/LongCat-Image-Edit-Turbo'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCat--Image--Edit--Turbo-blue'></a>
27
+ </div>
28
+
29
+
30
+ ## Introduction
31
+ We introduce **LongCat-Image-Edit-Turbo**, the distilled version of LongCat-Image-Edit. It achieves high-quality image editing with only 8 NFEs (Number of Function Evaluations) , offering extremely low inference latency.
32
+
33
+ <div align="center">
34
+ <img src="assets/model_struct_edit.png" width="90%" alt="LongCat-Image-Edit model" />
35
+ </div>
36
+
37
+
38
+ ### Installation
39
+
40
+ ```shell
41
+ pip install git+https://github.com/huggingface/diffusers
42
+ ```
43
+
44
+ ### Run Image Editing
45
+
46
+ > [!CAUTION]
47
+ > **📝 Special Handling for Text Rendering**
48
+ >
49
+ > For both Text-to-Image and Image Editing tasks involving text generation, **you must enclose the target text within single or double quotation marks** (both English '...' / "..." and Chinese ‘...’ / “...” styles are supported).
50
+ >
51
+ > **Reasoning:** The model utilizes a specialized **character-level encoding** strategy specifically for quoted content. Failure to use explicit quotation marks prevents this mechanism from triggering, which will severely compromise the text rendering capability.
52
+ >
53
+ ```python
54
+ import torch
55
+ from PIL import Image
56
+ from diffusers import LongCatImageEditPipeline
57
+
58
+ if __name__ == '__main__':
59
+ device = torch.device('cuda')
60
+ pipe = LongCatImageEditPipeline.from_pretrained("meituan-longcat/LongCat-Image-Edit-Turbo", torch_dtype= torch.bfloat16 )
61
+ # pipe.to(device, torch.bfloat16) # Uncomment for high VRAM devices (Faster inference)
62
+ pipe.enable_model_cpu_offload() # Offload to CPU to save VRAM (Required ~18 GB); slower but prevents OOM
63
+ img = Image.open('assets/test.png').convert('RGB')
64
+ prompt = '将猫变成狗'
65
+ image = pipe(
66
+ img,
67
+ prompt,
68
+ negative_prompt='',
69
+ guidance_scale=1,
70
+ num_inference_steps=8,
71
+ num_images_per_prompt=1,
72
+ generator=torch.Generator("cpu").manual_seed(43)
73
+ ).images[0]
74
+ image.save('./edit_example.png')
75
+ ```