Upload server.py with huggingface_hub
Browse files
server.py
CHANGED
|
@@ -21,10 +21,9 @@ def load_model():
|
|
| 21 |
pipe = GlmImagePipeline.from_pretrained(
|
| 22 |
"zai-org/GLM-Image",
|
| 23 |
torch_dtype=torch.bfloat16,
|
| 24 |
-
device_map="cuda",
|
| 25 |
-
enable_model_cpu_offload=True,
|
| 26 |
)
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
@app.route("/health", methods=["GET"])
|
| 30 |
def health():
|
|
|
|
| 21 |
pipe = GlmImagePipeline.from_pretrained(
|
| 22 |
"zai-org/GLM-Image",
|
| 23 |
torch_dtype=torch.bfloat16,
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
+
pipe.enable_sequential_cpu_offload()
|
| 26 |
+
print("[image] Model loaded with sequential CPU offload!", flush=True)
|
| 27 |
|
| 28 |
@app.route("/health", methods=["GET"])
|
| 29 |
def health():
|