Spaces:
Runtime error
Runtime error
fix: save full conditioning (node 132) instead of text-only (nodes 6/7)
Browse files
app.py
CHANGED
|
@@ -1003,33 +1003,38 @@ def generate_chunk_handler(
|
|
| 1003 |
api_wf[sampler_id]["inputs"]["add_noise"] = "enable"
|
| 1004 |
api_wf[sampler_id]["inputs"]["noise_seed"] = final_seed
|
| 1005 |
|
| 1006 |
-
# Save cond from
|
|
|
|
|
|
|
|
|
|
| 1007 |
api_wf["901"] = {"class_type": "BerniniChunkSaveCond", "inputs": {
|
| 1008 |
-
"positive":
|
| 1009 |
-
"negative":
|
| 1010 |
"session_id": session_id,
|
| 1011 |
}}
|
| 1012 |
|
| 1013 |
# Save output latent
|
| 1014 |
-
pos_ref = ["901", 0]
|
| 1015 |
-
neg_ref = ["901", 1]
|
| 1016 |
-
|
| 1017 |
api_wf["902"] = {"class_type": "BerniniChunkSaveLatent", "inputs": {
|
| 1018 |
"samples": [sampler_id, 0],
|
| 1019 |
"session_id": session_id,
|
| 1020 |
}}
|
|
|
|
|
|
|
| 1021 |
else:
|
| 1022 |
# Step k>0: no noise, load saved cond + latent
|
| 1023 |
api_wf[sampler_id]["inputs"]["add_noise"] = "disable"
|
| 1024 |
|
| 1025 |
-
# Load saved conditioning (fallback to
|
|
|
|
|
|
|
| 1026 |
api_wf["901"] = {"class_type": "BerniniChunkLoadCond", "inputs": {
|
| 1027 |
-
"fallback_pos":
|
| 1028 |
-
"fallback_neg":
|
| 1029 |
"session_id": session_id,
|
| 1030 |
}}
|
| 1031 |
-
|
| 1032 |
-
|
|
|
|
| 1033 |
|
| 1034 |
# Load previous latent, feed into sampler
|
| 1035 |
api_wf["902"] = {"class_type": "BerniniChunkLoadLatent", "inputs": {
|
|
@@ -1044,10 +1049,6 @@ def generate_chunk_handler(
|
|
| 1044 |
"session_id": session_id,
|
| 1045 |
}}
|
| 1046 |
|
| 1047 |
-
# Wire positive/negative from chunk nodes
|
| 1048 |
-
api_wf[sampler_id]["inputs"]["positive"] = pos_ref
|
| 1049 |
-
api_wf[sampler_id]["inputs"]["negative"] = neg_ref
|
| 1050 |
-
|
| 1051 |
# Output node for this step — determines what the executor returns
|
| 1052 |
exec_node = NODE_OUTPUT if is_final else (902 if chunk_idx == 0 else 903)
|
| 1053 |
output_video = _execute_workflow(api_wf, exec_node)
|
|
|
|
| 1003 |
api_wf[sampler_id]["inputs"]["add_noise"] = "enable"
|
| 1004 |
api_wf[sampler_id]["inputs"]["noise_seed"] = final_seed
|
| 1005 |
|
| 1006 |
+
# Save cond from node 132 (BerniniConditioning) to capture full visual context latents
|
| 1007 |
+
# Find the actual original connections for the sampler
|
| 1008 |
+
orig_pos = api_wf[sampler_id]["inputs"]["positive"]
|
| 1009 |
+
orig_neg = api_wf[sampler_id]["inputs"]["negative"]
|
| 1010 |
api_wf["901"] = {"class_type": "BerniniChunkSaveCond", "inputs": {
|
| 1011 |
+
"positive": orig_pos,
|
| 1012 |
+
"negative": orig_neg,
|
| 1013 |
"session_id": session_id,
|
| 1014 |
}}
|
| 1015 |
|
| 1016 |
# Save output latent
|
|
|
|
|
|
|
|
|
|
| 1017 |
api_wf["902"] = {"class_type": "BerniniChunkSaveLatent", "inputs": {
|
| 1018 |
"samples": [sampler_id, 0],
|
| 1019 |
"session_id": session_id,
|
| 1020 |
}}
|
| 1021 |
+
# On step 0, sampler keeps its original positive/negative connections to node 132
|
| 1022 |
+
|
| 1023 |
else:
|
| 1024 |
# Step k>0: no noise, load saved cond + latent
|
| 1025 |
api_wf[sampler_id]["inputs"]["add_noise"] = "disable"
|
| 1026 |
|
| 1027 |
+
# Load saved conditioning (fallback to node 132 if file missing)
|
| 1028 |
+
orig_pos = api_wf[sampler_id]["inputs"]["positive"]
|
| 1029 |
+
orig_neg = api_wf[sampler_id]["inputs"]["negative"]
|
| 1030 |
api_wf["901"] = {"class_type": "BerniniChunkLoadCond", "inputs": {
|
| 1031 |
+
"fallback_pos": orig_pos,
|
| 1032 |
+
"fallback_neg": orig_neg,
|
| 1033 |
"session_id": session_id,
|
| 1034 |
}}
|
| 1035 |
+
# Overwrite sampler inputs with the loaded conditioning
|
| 1036 |
+
api_wf[sampler_id]["inputs"]["positive"] = ["901", 0]
|
| 1037 |
+
api_wf[sampler_id]["inputs"]["negative"] = ["901", 1]
|
| 1038 |
|
| 1039 |
# Load previous latent, feed into sampler
|
| 1040 |
api_wf["902"] = {"class_type": "BerniniChunkLoadLatent", "inputs": {
|
|
|
|
| 1049 |
"session_id": session_id,
|
| 1050 |
}}
|
| 1051 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1052 |
# Output node for this step — determines what the executor returns
|
| 1053 |
exec_node = NODE_OUTPUT if is_final else (902 if chunk_idx == 0 else 903)
|
| 1054 |
output_video = _execute_workflow(api_wf, exec_node)
|