update to v6 modal pipeline
This commit is contained in:
parent
05ff0a42d5
commit
5a5c2038bb
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue