manbeast3b commited on
Commit
b1c8150
·
verified ·
1 Parent(s): c4803ee

Update src/pipeline.py

Browse files
Files changed (1) hide show
  1. src/pipeline.py +7 -16
src/pipeline.py CHANGED
@@ -106,25 +106,16 @@ def load_pipeline() -> Pipeline:
106
  )
107
  return pipeline
108
 
109
-
110
- sample = 1
111
  @torch.no_grad()
112
- def infer(request: TextToImageRequest, pipeline: Pipeline, generator: Generator) -> Image:
113
- global sample
114
- if sample <= 0:
115
- torch.cuda.reset_peak_memory_stats()
116
- torch.cuda.empty_cache()
117
- gc.collect()
118
- torch.cuda.reset_max_memory_allocated()
119
- sample = 1
120
- result = pipeline(
121
  request.prompt,
122
- height=request.height,
123
- width=request.width,
124
  generator=generator,
125
  guidance_scale=0.0,
126
  num_inference_steps=4,
127
  max_sequence_length=256,
128
- output_type="pil"
129
- )
130
- return result.images[0]
 
106
  )
107
  return pipeline
108
 
 
 
109
  @torch.no_grad()
110
+ def infer(request: TextToImageRequest, pipeline: Pipeline) -> Image:
111
+ generator = Generator(pipeline.device).manual_seed(request.seed)
112
+
113
+ return pipeline(
 
 
 
 
 
114
  request.prompt,
 
 
115
  generator=generator,
116
  guidance_scale=0.0,
117
  num_inference_steps=4,
118
  max_sequence_length=256,
119
+ height=request.height,
120
+ width=request.width,
121
+ ).images[0]