From 5a5c2038bb9268a8d99e6705ca45a9beb065a3df Mon Sep 17 00:00:00 2001 From: Yudi Xiao Date: Mon, 3 Mar 2025 10:50:23 +0800 Subject: [PATCH] update to v6 modal pipeline --- server_with_s3.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server_with_s3.py b/server_with_s3.py index eba0821..5a65a92 100644 --- a/server_with_s3.py +++ b/server_with_s3.py @@ -83,8 +83,9 @@ output_dir = "/root/comfy/ComfyUI/output" concurrency_limit=50, container_idle_timeout=120, # 5 minute container keep alive after it processes an input; increasing this value is a great way to reduce ComfyUI cold start times - timeout=800, - gpu="T4", + timeout=600, + gpu="L4", + memory=(32768, 32768), secrets=[secret], volumes={ "/root/comfy/ComfyUI/models": vol, @@ -125,7 +126,7 @@ class ComfyUI: node["inputs"]["default_value"] = node["inputs"]["default_value"].replace("input_s3", "input") with open(f"/root/{session_id}.json", "w", encoding="utf-8") as f: f.write(json.dumps(workflow, ensure_ascii=False)) - cmd = f"comfy run --workflow /root/{session_id}.json --wait --timeout 1200" + cmd = f"comfy run --workflow /root/{session_id}.json --wait --timeout 600 --verbose" # TODO 接收返回值 subprocess.run(cmd, shell=True, check=True) @@ -144,8 +145,8 @@ class ComfyUI: # print("file_list", new_file_list) for f in new_file_list: if f.startswith(file_prefix): - os.makedirs(os.path.dirname(os.path.join(output_dir.replace("output","output_s3"), f)), exist_ok=True) - shutil.copy(os.path.join(output_dir, f), os.path.join(output_dir.replace("output","output_s3"), f)) + os.makedirs(os.path.dirname(os.path.join(output_dir.replace("output", "output_s3"), f)), exist_ok=True) + shutil.copy(os.path.join(output_dir, f), os.path.join(output_dir.replace("output", "output_s3"), f)) return f @modal.web_endpoint(method="POST") @@ -157,9 +158,7 @@ class ComfyUI: # run inference on the currently running container fname = self.infer.local(new_workflow_file) - j = { - "file_name": fname - } + j = {"file_name": fname} print("json", j) return Response(content=json.dumps(j), media_type="application/json")