Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
serve: ending the server removes the image encoder's scratch directory (#914)
Niko1221e02815a5e53b
diff --git a/serve/server.py b/serve/server.pyindex fcb57f61b..1f43af05a 100644--- a/serve/server.py+++ b/serve/server.py@@ -1722,6 +1722,12 @@ class Vision:except Exception:self.proc.kill()+ def shutdown(self):+ """#914: close() for good: the server ends, so the encoder's directory (one ~10 MB .sve per image, on a tmpfs+ /tmp that is RAM) goes with it instead of piling up with every start. unload() keeps it for the restart."""+ self.close()+ shutil.rmtree(self.dir, ignore_errors=True)+def gpu_list(cfg: dict) -> list[int]:"""The config's "gpu": one card (2), or several for a layer split ([0, 2] or "0,2"), numbered as nvidia-smi@@ -4942,7 +4948,7 @@ def main() -> int:time.sleep(1) # Windows never delivers Ctrl+C to an untimed Event.wait()except KeyboardInterrupt:print("\n[strata] stopping (Ctrl+C again to end the engine at once) ...", flush=True)- closers = [httpd.shutdown, getattr(engine, "close", None), vision.close if vision else None,+ closers = [httpd.shutdown, getattr(engine, "close", None), vision.shutdown if vision else None,hub.close if hub is not None else None]for close in filter(None, closers):try:diff --git a/serve/test_server.py b/serve/test_server.pyindex 01d198272..b27742a2a 100644--- a/serve/test_server.py+++ b/serve/test_server.py@@ -3783,5 +3783,33 @@ class VisionArgs(unittest.TestCase):["--max-tokens", "1024", "--min-tokens", "768"])+class VisionShutdown(unittest.TestCase):+ """#914: ending the server removes the encoder's scratch directory; unloading keeps it."""++ def test_shutdown_removes_the_work_dir_but_close_keeps_it(self):+ import serve.server as server+ with tempfile.TemporaryDirectory() as t:+ d = Path(t) / "strata-vision-x"+ d.mkdir()+ (d / "k.sve").write_bytes(b"x")+ v = server.Vision.__new__(server.Vision)+ v.dir = d++ class Proc:+ stdin = io.StringIO()++ def wait(self, timeout=None):+ return 0++ def kill(self):+ pass++ v.proc = Proc()+ v.close()+ self.assertTrue((d / "k.sve").exists())+ v.shutdown()+ self.assertFalse(d.exists())++if __name__ == "__main__":unittest.main()