|
16 | 16 | - Force-redownload capability |
17 | 17 | """ |
18 | 18 |
|
19 | | -import argparse |
20 | 19 | import os |
21 | 20 | import sys |
22 | 21 | import tempfile |
@@ -1560,149 +1559,3 @@ def list_models_for_arch( |
1560 | 1559 | if include_extra: |
1561 | 1560 | total_msg += f", {len(extra_models)} extra model(s)" |
1562 | 1561 | print(total_msg) |
1563 | | - |
1564 | | - |
1565 | | -# ============================================================================= |
1566 | | -# CLI Entry Point |
1567 | | -# ============================================================================= |
1568 | | - |
1569 | | -def main(): |
1570 | | - parser = argparse.ArgumentParser( |
1571 | | - description="Download Hailo resources (models, videos, images, configs)", |
1572 | | - formatter_class=argparse.RawDescriptionHelpFormatter, |
1573 | | - epilog=""" |
1574 | | -Examples: |
1575 | | - # Download default resources for detected architecture |
1576 | | - %(prog)s |
1577 | | -
|
1578 | | - # Download all models (default + extra) for all apps |
1579 | | - %(prog)s --all |
1580 | | -
|
1581 | | - # Download resources for a specific app |
1582 | | - %(prog)s --group detection |
1583 | | -
|
1584 | | - # Download a specific resource (strict targeted mode) |
1585 | | - %(prog)s --group detection --resource-type model --resource-name yolov8m |
1586 | | - %(prog)s --group detection --resource-type image --resource-name bus.jpg |
1587 | | - %(prog)s --group detection --resource-type video --resource-name example.mp4 |
1588 | | -
|
1589 | | - # Download for a specific architecture |
1590 | | - %(prog)s --arch hailo10h |
1591 | | -
|
1592 | | - # Preview what would be downloaded (dry run) |
1593 | | - %(prog)s --dry-run |
1594 | | -
|
1595 | | - # Force re-download existing files |
1596 | | - %(prog)s --force |
1597 | | -
|
1598 | | - # Download gen-ai app (auto-includes gen-ai models) |
1599 | | - %(prog)s --group vlm_chat --arch hailo10h |
1600 | | -
|
1601 | | - # Include gen-ai apps in bulk download (downloads ALL apps including VLM, LLM, Whisper) |
1602 | | - %(prog)s --all --include-gen-ai --arch hailo10h |
1603 | | -""" |
1604 | | - ) |
1605 | | - |
1606 | | - parser.add_argument( |
1607 | | - "--all", |
1608 | | - action="store_true", |
1609 | | - help="Download all models (default + extra) for all apps" |
1610 | | - ) |
1611 | | - parser.add_argument( |
1612 | | - "--config", |
1613 | | - type=str, |
1614 | | - default=DEFAULT_RESOURCES_CONFIG_PATH, |
1615 | | - help="Path to config file" |
1616 | | - ) |
1617 | | - parser.add_argument( |
1618 | | - "--arch", |
1619 | | - type=str, |
1620 | | - default=None, |
1621 | | - choices=["hailo8", "hailo8l", "hailo10h"], |
1622 | | - help="Hailo architecture override" |
1623 | | - ) |
1624 | | - parser.add_argument( |
1625 | | - "--group", |
1626 | | - type=str, |
1627 | | - default=None, |
1628 | | - help="Group/app name to download resources for (e.g., detection, vlm_chat)" |
1629 | | - ) |
1630 | | - parser.add_argument( |
1631 | | - "--resource-name", |
1632 | | - type=str, |
1633 | | - default=None, |
1634 | | - help="Specific resource name to download" |
1635 | | - ) |
1636 | | - parser.add_argument( |
1637 | | - "--resource-type", |
1638 | | - type=str, |
1639 | | - default=None, |
1640 | | - choices=sorted(RESOURCE_TYPES), |
1641 | | - help="Type of the resource specified by --resource-name (model/image/video/onnx)" |
1642 | | - ) |
1643 | | - parser.add_argument( |
1644 | | - "--list-models", |
1645 | | - action="store_true", |
1646 | | - help="List all available models for the detected/selected architecture" |
1647 | | - ) |
1648 | | - parser.add_argument( |
1649 | | - "--dry-run", |
1650 | | - action="store_true", |
1651 | | - help="Show what would be downloaded without actually downloading" |
1652 | | - ) |
1653 | | - parser.add_argument( |
1654 | | - "--force", |
1655 | | - action="store_true", |
1656 | | - help="Force re-download even if files already exist" |
1657 | | - ) |
1658 | | - parser.add_argument( |
1659 | | - "--no-parallel", |
1660 | | - action="store_true", |
1661 | | - help="Disable parallel downloads (download sequentially)" |
1662 | | - ) |
1663 | | - parser.add_argument( |
1664 | | - "--include-gen-ai", |
1665 | | - action="store_true", |
1666 | | - help="Include gen-ai apps in bulk downloads (not needed with --group, gen-ai models are auto-included when group has them)" |
1667 | | - ) |
1668 | | - |
1669 | | - args = parser.parse_args() |
1670 | | - |
1671 | | - load_environment() |
1672 | | - |
1673 | | - # List models and exit |
1674 | | - if args.list_models: |
1675 | | - list_models_for_arch( |
1676 | | - resource_config_path=args.config, |
1677 | | - arch=args.arch, |
1678 | | - include_extra=True |
1679 | | - ) |
1680 | | - return |
1681 | | - |
1682 | | - # Validate targeted mode arguments |
1683 | | - if args.resource_name and not args.resource_type: |
1684 | | - parser.error("--resource-name requires --resource-type") |
1685 | | - |
1686 | | - if args.resource_type and not args.resource_name: |
1687 | | - parser.error("--resource-type requires --resource-name") |
1688 | | - |
1689 | | - |
1690 | | - # Download resources |
1691 | | - download_resources( |
1692 | | - resource_config_path=args.config, |
1693 | | - arch=args.arch, |
1694 | | - group=args.group, |
1695 | | - all_models=args.all, |
1696 | | - resource_name=args.resource_name, |
1697 | | - resource_type=args.resource_type, |
1698 | | - dry_run=args.dry_run, |
1699 | | - force=args.force, |
1700 | | - parallel=not args.no_parallel, |
1701 | | - include_gen_ai=args.include_gen_ai |
1702 | | - ) |
1703 | | - |
1704 | | - hailo_logger.info("Resource download completed.") |
1705 | | - |
1706 | | - |
1707 | | -if __name__ == "__main__": |
1708 | | - main() |
0 commit comments