Merge branch 'main' into space-txt2img
Browse files- app_init.py +2 -5
- pipelines/controlnetLoraSD15.py +1 -1
app_init.py
CHANGED
@@ -121,17 +121,14 @@ def init_app(app: FastAPI, user_data: UserData, args: Args, pipeline):
|
|
121 |
last_params = params
|
122 |
image = pipeline.predict(params)
|
123 |
if image is None:
|
|
|
124 |
continue
|
125 |
frame = pil_to_frame(image)
|
126 |
yield frame
|
127 |
# https://bugs.chromium.org/p/chromium/issues/detail?id=1250396
|
128 |
if not is_firefox(request.headers["user-agent"]):
|
129 |
yield frame
|
130 |
-
await websocket.send_json(
|
131 |
-
{
|
132 |
-
"status": "send_frame",
|
133 |
-
}
|
134 |
-
)
|
135 |
|
136 |
return StreamingResponse(
|
137 |
generate(),
|
|
|
121 |
last_params = params
|
122 |
image = pipeline.predict(params)
|
123 |
if image is None:
|
124 |
+
await websocket.send_json({"status": "send_frame"})
|
125 |
continue
|
126 |
frame = pil_to_frame(image)
|
127 |
yield frame
|
128 |
# https://bugs.chromium.org/p/chromium/issues/detail?id=1250396
|
129 |
if not is_firefox(request.headers["user-agent"]):
|
130 |
yield frame
|
131 |
+
await websocket.send_json({"status": "send_frame"})
|
|
|
|
|
|
|
|
|
132 |
|
133 |
return StreamingResponse(
|
134 |
generate(),
|
pipelines/controlnetLoraSD15.py
CHANGED
@@ -172,7 +172,7 @@ class Pipeline:
|
|
172 |
pipe.set_progress_bar_config(disable=True)
|
173 |
pipe.to(device=device, dtype=torch_dtype).to(device)
|
174 |
if device.type != "mps":
|
175 |
-
|
176 |
|
177 |
if psutil.virtual_memory().total < 64 * 1024**3:
|
178 |
pipe.enable_attention_slicing()
|
|
|
172 |
pipe.set_progress_bar_config(disable=True)
|
173 |
pipe.to(device=device, dtype=torch_dtype).to(device)
|
174 |
if device.type != "mps":
|
175 |
+
pipe.unet.to(memory_format=torch.channels_last)
|
176 |
|
177 |
if psutil.virtual_memory().total < 64 * 1024**3:
|
178 |
pipe.enable_attention_slicing()
|