MCPcopy Create free account
hub / github.com/cactus-compute/cactus / cmd_test

Function cmd_test

python/src/cli.py:1477–1565  ·  view source on GitHub ↗

Run the Cactus test suite.

(args)

Source from the content-addressed store, hash-verified

1475
1476
1477def cmd_test(args):
1478 """Run the Cactus test suite."""
1479 print_color(BLUE, "Running test suite...")
1480 print("=" * 20)
1481
1482 if getattr(args, 'ios', False) and not getattr(args, 'reconvert', False):
1483 print_color(
1484 YELLOW,
1485 "Warning: iOS tests without --reconvert may use stale or inconsistent local weights. "
1486 "If tests fail unexpectedly, rerun with --reconvert."
1487 )
1488
1489 if getattr(args, 'benchmark', False):
1490 args.model = 'LiquidAI/LFM2.5-VL-1.6B'
1491 args.transcribe_model = 'nvidia/parakeet-ctc-1.1b'
1492 print_color(BLUE, f"Using large models: {args.model}, {args.transcribe_model}, {args.vad_model}")
1493
1494 if getattr(args, 'reconvert', False):
1495 reconvert_models = [
1496 getattr(args, 'model', 'LiquidAI/LFM2-VL-450M'),
1497 getattr(args, 'transcribe_model', DEFAULT_TEST_TRANSCRIBE_MODEL_ID),
1498 getattr(args, 'whisper_model', DEFAULT_TEST_WHISPER_MODEL_ID),
1499 getattr(args, 'vad_model', 'snakers4/silero-vad'),
1500 getattr(args, 'diarize_model', DEFAULT_TEST_DIARIZE_MODEL_ID),
1501 getattr(args, 'embed_speaker_model', DEFAULT_TEST_EMBED_SPEAKER_MODEL_ID),
1502 ]
1503 for model_id in reconvert_models:
1504 class DownloadArgs:
1505 pass
1506 dl_args = DownloadArgs()
1507 dl_args.model_id = model_id
1508 dl_args.reconvert = True
1509 dl_args.cache_dir = None
1510 if args.precision:
1511 dl_args.precision = args.precision
1512 else:
1513 is_asr = 'whisper' in model_id.lower() or 'moonshine' in model_id.lower() or 'silero-vad' in model_id.lower()
1514 is_fp16_only = 'segmentation-3.0' in model_id.lower() or 'wespeaker' in model_id.lower()
1515 dl_args.precision = 'FP16' if is_fp16_only else ('INT8' if is_asr else 'INT4')
1516 if args.token:
1517 dl_args.token = args.token
1518 if cmd_download(dl_args) != 0:
1519 return 1
1520
1521 test_script = PROJECT_ROOT / "tests" / "run.sh"
1522
1523 if not test_script.exists():
1524 print_color(RED, f"Error: Test script not found at {test_script}")
1525 return 1
1526
1527 cmd = [str(test_script)]
1528
1529 if args.model:
1530 cmd.extend(["--model", args.model])
1531 if args.transcribe_model:
1532 cmd.extend(["--transcribe_model", args.transcribe_model])
1533 if getattr(args, 'whisper_model', None):
1534 cmd.extend(["--whisper_model", args.whisper_model])

Callers 1

mainFunction · 0.85

Calls 3

print_colorFunction · 0.85
DownloadArgsClass · 0.85
cmd_downloadFunction · 0.85

Tested by

no test coverage detected