BiliSakura commited on
Commit
a310d14
·
verified ·
1 Parent(s): 31577d2

Update README.md and *.py files for RSEdit-DiT

Browse files
Files changed (1) hide show
  1. README.md +43 -0
README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RSEdit-DiT - Inference Guide
2
+
3
+ Quick guide for running inference with RSEdit DiT model for remote sensing image editing.
4
+
5
+ ## Quick Start
6
+
7
+ ### Python Code Example
8
+
9
+ ```python
10
+ import torch
11
+ from PIL import Image
12
+ from diffusers import DiffusionPipeline
13
+
14
+ # Load model with custom pipeline
15
+ model_path = "/data/models/ours/BiliSakura/RSEdit-DiT"
16
+ pipe = DiffusionPipeline.from_pretrained(
17
+ model_path,
18
+ torch_dtype=torch.bfloat16,
19
+ custom_pipeline="pipeline_rsedit_dit"
20
+ ).to("cuda")
21
+
22
+ # Switch to AttnProcessor (required for RSEdit DiT)
23
+ from diffusers.models.attention_processor import AttnProcessor
24
+ pipe.transformer.set_attn_processor(AttnProcessor())
25
+
26
+ # Load source image
27
+ source_image = Image.open("satellite_image.png").convert("RGB")
28
+
29
+ # Edit with instruction
30
+ prompt = "Flood the coastal area"
31
+ edited_image = pipe(
32
+ prompt=prompt,
33
+ source_image=source_image,
34
+ num_inference_steps=50,
35
+ guidance_scale=4.5,
36
+ image_guidance_scale=1.5,
37
+ height=512,
38
+ width=512,
39
+ ).images[0]
40
+
41
+ # Save result
42
+ edited_image.save("edited_image.png")
43
+ ```