MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / main

Function main

scripts/worldmirror/compare_to_reference.py:207–319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

205
206
207def main() -> int:
208 ap = argparse.ArgumentParser()
209 ap.add_argument(
210 "--ref",
211 default="/workspace/HY-World-2.0/inference_output/Workspace/20260416_074356",
212 help="Reference output dir (or parent containing it).",
213 )
214 ap.add_argument(
215 "--cand",
216 default="/workspace/LightX2V/inference_output/Workspace",
217 help="Candidate output dir (or parent; latest subdir is picked).",
218 )
219 ap.add_argument("--json", action="store_true", help="Emit JSON.")
220 ap.add_argument(
221 "--quant",
222 action="store_true",
223 help="Apply the relaxed MAE threshold (1e-2) used for fp8/int8/bf16 paths.",
224 )
225 ap.add_argument(
226 "--bf16_ref",
227 action="store_true",
228 help=(
229 "Switch ``--ref`` default to the bf16 reference output at "
230 "``/workspace/HY-World-2.0/inference_output/Workspace_bf16`` "
231 "(for validating the bf16 path against itself across commits). "
232 "Implies --quant unless overridden."
233 ),
234 )
235 ap.add_argument(
236 "--mae_threshold",
237 type=float,
238 default=None,
239 help="Override MAE threshold (overrides --quant).",
240 )
241 args = ap.parse_args()
242
243 global MAE_THRESHOLD
244 # --bf16_ref: snap --ref to the bf16 reference if the user didn't
245 # already override it, and relax MAE (bf16 has ~1e-3 precision floor).
246 if args.bf16_ref and args.ref == ap.get_default("ref"):
247 args.ref = "/workspace/HY-World-2.0/inference_output/Workspace_bf16"
248 if args.mae_threshold is not None:
249 MAE_THRESHOLD = args.mae_threshold
250 elif args.quant or args.bf16_ref:
251 MAE_THRESHOLD = MAE_THRESHOLD_QUANT
252
253 ref = resolve_output_dir(Path(args.ref))
254 cand = resolve_output_dir(Path(args.cand))
255 print(f"[compare] ref : {ref}")
256 print(f"[compare] cand: {cand}")
257
258 if not ref.exists() or not cand.exists():
259 print(f"[compare] missing dir: ref={ref.exists()}, cand={cand.exists()}")
260 return 2
261
262 report = {"ref": str(ref), "cand": str(cand)}
263 failures = []
264

Callers 1

Calls 6

resolve_output_dirFunction · 0.85
depth_maeFunction · 0.85
png_u8_maeFunction · 0.85
point_cloud_statsFunction · 0.85
appendMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected