From 08be0232907d37cf36522df2dd7a0be80ba2d711 Mon Sep 17 00:00:00 2001 From: varunfb Date: Tue, 19 Nov 2024 17:42:43 -0800 Subject: [PATCH] Added optional md5 validate command once download is completed (#486) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What does this PR do? Adds description at the end of successful download the optionally run the verify md5 checksums command. ## Test Plan Screenshot 2024-11-19 at 12 11 37 PM ## Before submitting - [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). - [x] Ran pre-commit to handle lint / formatting issues. - [x] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), Pull Request section? - [x] Updated relevant documentation. - [x] Wrote necessary unit or integration tests. --------- Co-authored-by: varunfb --- llama_stack/cli/download.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/llama_stack/cli/download.py b/llama_stack/cli/download.py index bb57186e5..c2f8ac855 100644 --- a/llama_stack/cli/download.py +++ b/llama_stack/cli/download.py @@ -380,6 +380,7 @@ def _hf_download( def _meta_download( model: "Model", + model_id: str, meta_url: str, info: "LlamaDownloadInfo", max_concurrent_downloads: int, @@ -405,8 +406,15 @@ def _meta_download( downloader = ParallelDownloader(max_concurrent_downloads=max_concurrent_downloads) asyncio.run(downloader.download_all(tasks)) - print(f"\nSuccessfully downloaded model to {output_dir}") - cprint(f"\nMD5 Checksums are at: {output_dir / 'checklist.chk'}", "white") + cprint(f"\nSuccessfully downloaded model to {output_dir}", "green") + cprint( + f"\nView MD5 checksum files at: {output_dir / 'checklist.chk'}", + "white", + ) + cprint( + f"\n[Optionally] To run MD5 checksums, use the following command: llama model verify-download --model-id {model_id}", + "yellow", + ) class ModelEntry(BaseModel): @@ -512,7 +520,7 @@ def run_download_cmd(args: argparse.Namespace, parser: argparse.ArgumentParser): ) if "llamameta.net" not in meta_url: parser.error("Invalid Meta URL provided") - _meta_download(model, meta_url, info, args.max_parallel) + _meta_download(model, model_id, meta_url, info, args.max_parallel) except Exception as e: parser.error(f"Download failed: {str(e)}")