33import re
44import json
55import base64
6- import shutil
76import argparse
87import subprocess
98import glob
109from typing import List , Set , Dict , Any , Union
11- import graph_net
1210from graph_net .analysis_util import get_incorrect_models
1311from graph_net import path_utils
1412
@@ -135,12 +133,12 @@ def save_decompose_config(
135133
136134 with open (config_path , "w" ) as f :
137135 json .dump (config , f , indent = 4 )
138- print (f"[INFO] State saved to: { config_path } " )
136+ print (f"[INFO] Save state to: { config_path } " )
139137
140138
141139def get_model_name_with_subgraph_tag (model_path ):
142140 fields = model_path .rstrip ("/" ).split (os .sep )
143- pattern = rf "^subgraph(_\d+)?$"
141+ pattern = r "^subgraph(_\d+)?$"
144142 return f"{ fields [- 2 ]} _{ fields [- 1 ]} " if re .match (pattern , fields [- 1 ]) else fields [- 1 ]
145143
146144
@@ -270,7 +268,7 @@ def calculate_current_subgraph_size(
270268 )
271269
272270
273- def calculate_split_postions_for_subgraph (subgraph_size ):
271+ def calculate_split_positions_for_subgraph (subgraph_size ):
274272 assert isinstance (subgraph_size , (list , tuple )) and len (subgraph_size ) == 2
275273
276274 # Get the specific failing subgraph size [Start, End]
@@ -345,10 +343,10 @@ def main(args):
345343 max_subgraph_size = prev_max_size
346344
347345 if not prev_incorrect_subgraphs :
348- print (f "[FINISHED] Debugging completed." )
346+ print ("[FINISHED] Debugging completed." )
349347 sys .exit (0 )
350348
351- print (f "[Analysis] Refining splits based on previous incorrect models ..." )
349+ print ("[Analysis] Refining splits based on previous incorrect models ..." )
352350
353351 for subgraph_path in prev_incorrect_subgraphs :
354352 print (f"- subgraph_path: { subgraph_path } " )
@@ -367,15 +365,15 @@ def main(args):
367365 subgraph_size
368366 ), f"subgraph_idx { subgraph_idx } is out of bounds for { model_name } (previous split_positions: { prev_split_positions } )"
369367
370- split_postions = calculate_split_postions_for_subgraph (
368+ split_positions = calculate_split_positions_for_subgraph (
371369 subgraph_size [subgraph_idx ]
372370 )
373371 if model_name not in tasks_map :
374372 tasks_map [model_name ] = {
375373 "subgraph_path" : subgraph_path ,
376374 "original_path" : prev_active_models_map [model_name ],
377375 "subgraph_size" : subgraph_size [subgraph_idx ],
378- "split_positions" : split_postions ,
376+ "split_positions" : split_positions ,
379377 }
380378 else :
381379 continue
@@ -389,7 +387,7 @@ def main(args):
389387 print (f"- { original_path } " )
390388
391389 if not tasks_map :
392- print (f "[FINISHED] No models need processing." )
390+ print ("[FINISHED] No models need processing." )
393391 sys .exit (0 )
394392
395393 # --- Step 2: Prepare Workspace ---
@@ -473,9 +471,9 @@ def main(args):
473471 print (f">>> [SUGGESTION] Issues remain (Count: { len (next_round_models )} )." )
474472 print (">>> Please start next round decomposition test (Run this script again)." )
475473 elif next_round_models and real_subgraph_size <= 1 :
476- print (f ">>> [FAILURE] Minimal granularity reached, but errors persist." )
474+ print (">>> [FAILURE] Minimal granularity reached, but errors persist." )
477475 else :
478- print (f ">>> [SUCCESS] Debugging converged." )
476+ print (">>> [SUCCESS] Debugging converged." )
479477 print ("=" * 80 )
480478
481479
0 commit comments