ihsanvp commited on
Commit
c5c043a
1 Parent(s): 659dcf7

test: global model loading

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -5,15 +5,16 @@ from diffusers import I2VGenXLPipeline
5
  from diffusers.utils.loading_utils import load_image
6
  from PIL import Image
7
 
 
 
 
 
 
 
 
 
8
  def generate(image: Image.Image, prompt: str):
9
- device = torch.device("cpu")
10
- negative_prompt = "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
11
- generator = torch.manual_seed(8888)
12
  image = image.convert("RGB")
13
- pipeline = I2VGenXLPipeline.from_pretrained("ali-vilab/i2vgen-xl", torch_dtype=torch.float16, variant="fp16")
14
- pipeline.to(device)
15
- pipeline.enable_model_cpu_offload()
16
- pipeline.unet.enable_forward_chunking()
17
  frames = pipeline(
18
  prompt=prompt,
19
  image=image,
 
5
  from diffusers.utils.loading_utils import load_image
6
  from PIL import Image
7
 
8
+ device = torch.device("cpu")
9
+ negative_prompt = "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
10
+ generator = torch.manual_seed(8888)
11
+ pipeline = I2VGenXLPipeline.from_pretrained("ali-vilab/i2vgen-xl", torch_dtype=torch.float16, variant="fp16")
12
+ pipeline.to(device)
13
+ pipeline.enable_model_cpu_offload()
14
+ pipeline.unet.enable_forward_chunking()
15
+
16
  def generate(image: Image.Image, prompt: str):
 
 
 
17
  image = image.convert("RGB")
 
 
 
 
18
  frames = pipeline(
19
  prompt=prompt,
20
  image=image,