def _get_models(domain, sub_domain) -> List[str]: page = 1 models = [] while True: results = Zoo.search_models(domain, sub_domain, page=page) if len(results) == 0: break models.extend(results) page += 1 return [model.stub for model in models]
def search(args): LOGGER.info("loading available models...") models = Zoo.search_models( domain=args.domain, sub_domain=args.sub_domain, architecture=args.architecture, sub_architecture=args.sub_architecture, framework=args.framework, repo=args.repo, dataset=args.dataset, training_scheme=args.training_scheme, sparse_name=args.sparse_name, sparse_category=args.sparse_category, sparse_target=args.sparse_target, release_version=args.release_version, page=args.page, page_length=args.page_length, ) print("Search results") print("====================") result_start = (args.page - 1) * args.page_length + 1 result_end = (args.page) * args.page_length print(f"Showing results {result_start} - {result_end}") print("") for index, model in enumerate(models): result_index = (index + 1) + (args.page_length * (args.page - 1)) header = f"{result_index}) {model.display_name}" print(header) print("-------------------------") print(f"Model Description: {model.display_description}") print("") print(f"Framework: {model.framework}") print("") print(f"Repository: {model.repo}") print("") tag_string = ", ".join([tag.display_name for tag in model.tags]) print(f"Tags: {tag_string}") print("") print(f"Download Command: {_get_command_from_model(model)}") print("") print("")