Update src/pipeline.py
Browse files- src/pipeline.py +5 -2
src/pipeline.py
CHANGED
|
@@ -9,8 +9,9 @@ from loss import SchedulerWrapper, get_instance
|
|
| 9 |
import time
|
| 10 |
from onediffx import compile_pipe, save_pipe, load_pipe
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
def callback_dynamic_cfg(pipe, step_index, timestep, callback_kwargs):
|
|
@@ -23,6 +24,7 @@ def callback_dynamic_cfg(pipe, step_index, timestep, callback_kwargs):
|
|
| 23 |
return callback_kwargs
|
| 24 |
|
| 25 |
def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
|
|
|
|
| 26 |
if not pipeline:
|
| 27 |
pipeline = StableDiffusionXLPipeline.from_pretrained(
|
| 28 |
"stablediffusionapi/newdream-sdxl-20",
|
|
@@ -130,6 +132,7 @@ def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
|
|
| 130 |
return pipeline
|
| 131 |
|
| 132 |
def infer(request: TextToImageRequest, pipeline: StableDiffusionXLPipeline) -> Image:
|
|
|
|
| 133 |
if request.seed is None:
|
| 134 |
generator = None
|
| 135 |
else:
|
|
|
|
| 9 |
import time
|
| 10 |
from onediffx import compile_pipe, save_pipe, load_pipe
|
| 11 |
|
| 12 |
+
instance = None
|
| 13 |
+
loss_fn = None
|
| 14 |
+
optimizer = None
|
| 15 |
|
| 16 |
|
| 17 |
def callback_dynamic_cfg(pipe, step_index, timestep, callback_kwargs):
|
|
|
|
| 24 |
return callback_kwargs
|
| 25 |
|
| 26 |
def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
|
| 27 |
+
global instance, loss_fn, optimizer
|
| 28 |
if not pipeline:
|
| 29 |
pipeline = StableDiffusionXLPipeline.from_pretrained(
|
| 30 |
"stablediffusionapi/newdream-sdxl-20",
|
|
|
|
| 132 |
return pipeline
|
| 133 |
|
| 134 |
def infer(request: TextToImageRequest, pipeline: StableDiffusionXLPipeline) -> Image:
|
| 135 |
+
global instance, loss_fn, optimizer
|
| 136 |
if request.seed is None:
|
| 137 |
generator = None
|
| 138 |
else:
|