aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generate.py9
-rw-r--r--server.py11
2 files changed, 14 insertions, 6 deletions
diff --git a/generate.py b/generate.py
index 95b2dd7..b6c0fb8 100644
--- a/generate.py
+++ b/generate.py
@@ -10,10 +10,11 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-# Local SDXL-base image generation for Intel Arc B580 (XPU backend).
-# Bounded scope by design: SDXL base, single 1024x1024 image, no refiner,
-# no Flux, no batching. This is what fits comfortably in 12GB VRAM once the
-# fp32 VAE upcast is removed via the fp16-fix VAE. See README.md for limits.
+# Local SDXL image generation for Intel Arc B580 (XPU backend).
+# Bounded scope by design: SDXL-architecture models (see MODELS registry),
+# single 1024x1024 image, no refiner, no Flux, no batching. This is what fits
+# comfortably in 12GB VRAM once the fp32 VAE upcast is removed via the fp16-fix
+# VAE. See README.md for limits.
import argparse
import sys
diff --git a/server.py b/server.py
index f3be9e5..f289f64 100644
--- a/server.py
+++ b/server.py
@@ -84,6 +84,13 @@ class Handler(BaseHTTPRequestHandler):
return
if self.path == "/generate":
+ width = int(data.get("width", 1024))
+ height = int(data.get("height", 1024))
+ if width % 8 or height % 8:
+ # Match the one-shot CLI: reject bad dims up front with a clear
+ # client error instead of a downstream 500 or garbled output.
+ self._json(400, {"error": "width and height must be multiples of 8"})
+ return
try:
image, elapsed = generate.generate(
STATE["pipe"],
@@ -92,8 +99,8 @@ class Handler(BaseHTTPRequestHandler):
int(data.get("steps", 25)),
float(data.get("guidance", 7.0)),
data.get("seed"),
- int(data.get("width", 1024)),
- int(data.get("height", 1024)),
+ width,
+ height,
)
except torch.OutOfMemoryError:
torch.xpu.empty_cache()