khawir commited on
Commit
81feb39
1 Parent(s): 691262e

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +4 -2
app/main.py CHANGED
@@ -39,7 +39,8 @@ async def lifespan(app: FastAPI):
39
  ti_pipe.scheduler = DPMSolverMultistepScheduler.from_config(
40
  ti_pipe.scheduler.config
41
  )
42
- ti_pipe.enable_sequential_cpu_offload() # to(DEVICE)
 
43
 
44
  ii_pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
45
  "timbrooks/instruct-pix2pix", torch_dtype=torch.float16, safety_checker=None
@@ -47,7 +48,8 @@ async def lifespan(app: FastAPI):
47
  ii_pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(
48
  ii_pipe.scheduler.config
49
  )
50
- ii_pipe.enable_sequential_cpu_offload() # to(DEVICE)
 
51
 
52
  br_model = AutoModelForImageSegmentation.from_pretrained(
53
  "briaai/RMBG-1.4", trust_remote_code=True
 
39
  ti_pipe.scheduler = DPMSolverMultistepScheduler.from_config(
40
  ti_pipe.scheduler.config
41
  )
42
+ ti_pipe.to(DEVICE)
43
+ ti_pipe.enable_xformers_memory_efficient_attention()
44
 
45
  ii_pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
46
  "timbrooks/instruct-pix2pix", torch_dtype=torch.float16, safety_checker=None
 
48
  ii_pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(
49
  ii_pipe.scheduler.config
50
  )
51
+ ii_pipe.to(DEVICE)
52
+ ii_pipe.enable_xformers_memory_efficient_attention()
53
 
54
  br_model = AutoModelForImageSegmentation.from_pretrained(
55
  "briaai/RMBG-1.4", trust_remote_code=True