radames commited on
Commit
74f6ce1
1 Parent(s): dbe1557

constraint steps*strength >= 1

Browse files
pipelines/controlnetSDXLTurbo.py CHANGED
@@ -16,6 +16,7 @@ import psutil
16
  from config import Args
17
  from pydantic import BaseModel, Field
18
  from PIL import Image
 
19
 
20
  controlnet_model = "diffusers/controlnet-canny-sdxl-1.0"
21
  model_id = "stabilityai/sdxl-turbo"
@@ -221,8 +222,8 @@ class Pipeline:
221
  )
222
  steps = params.steps
223
  strength = params.strength
224
- if steps == 1:
225
- strength = 1
226
 
227
  results = self.pipe(
228
  image=params.image,
 
16
  from config import Args
17
  from pydantic import BaseModel, Field
18
  from PIL import Image
19
+ import math
20
 
21
  controlnet_model = "diffusers/controlnet-canny-sdxl-1.0"
22
  model_id = "stabilityai/sdxl-turbo"
 
222
  )
223
  steps = params.steps
224
  strength = params.strength
225
+ if int(steps * strength) < 1:
226
+ steps = math.ceil(1 / max(0.10, strength))
227
 
228
  results = self.pipe(
229
  image=params.image,
pipelines/img2imgSDXLTurbo.py CHANGED
@@ -14,6 +14,7 @@ import psutil
14
  from config import Args
15
  from pydantic import BaseModel, Field
16
  from PIL import Image
 
17
 
18
  base_model = "stabilityai/sdxl-turbo"
19
  taesd_model = "madebyollin/taesd"
@@ -151,10 +152,8 @@ class Pipeline:
151
  )
152
  steps = params.steps
153
  strength = params.strength
154
- if steps <= 1:
155
- strength = 1
156
- else:
157
- strength = 1 / steps
158
 
159
  results = self.pipe(
160
  image=params.image,
 
14
  from config import Args
15
  from pydantic import BaseModel, Field
16
  from PIL import Image
17
+ import math
18
 
19
  base_model = "stabilityai/sdxl-turbo"
20
  taesd_model = "madebyollin/taesd"
 
152
  )
153
  steps = params.steps
154
  strength = params.strength
155
+ if int(steps * strength) < 1:
156
+ steps = math.ceil(1 / max(0.10, strength))
 
 
157
 
158
  results = self.pipe(
159
  image=params.image,