mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 10:54:19 +00:00
# What does this PR do? [Provide a short summary of what this PR does and why. Link to relevant issues if applicable.] add a subcommand, help to clean the unneeded model: ``` $ llama model --help usage: llama model [-h] {download,list,prompt-format,describe,verify-download,remove} ... Work with llama models options: -h, --help show this help message and exit $ llama model remove --help usage: llama model remove [-h] -m MODEL [-f] Remove the downloaded llama model options: -h, --help show this help message and exit -m MODEL, --model MODEL Specify the llama downloaded model name -f, --force Used to forcefully remove the llama model from the storage without further confirmation $ llama model remove -m Llama3.2-1B-Instruct:int4-qlora-eo8 Are you sure you want to remove Llama3.2-1B-Instruct:int4-qlora-eo8? (y/n): n Removal aborted. $ llama model remove -mLlama3.2-1B-Instruct:int4-qlora-eo8-f Llama3.2-1B-Instruct:int4-qlora-eo8 removed. ``` [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*] [//]: # (## Documentation) --------- Signed-off-by: reidliu <reid201711@gmail.com> Co-authored-by: reidliu <reid201711@gmail.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the terms described in the LICENSE file in
|
|
# the root directory of this source tree.
|
|
|
|
import argparse
|
|
|
|
from llama_stack.cli.model.describe import ModelDescribe
|
|
from llama_stack.cli.model.download import ModelDownload
|
|
from llama_stack.cli.model.list import ModelList
|
|
from llama_stack.cli.model.prompt_format import ModelPromptFormat
|
|
from llama_stack.cli.model.remove import ModelRemove
|
|
from llama_stack.cli.model.verify_download import ModelVerifyDownload
|
|
from llama_stack.cli.subcommand import Subcommand
|
|
|
|
|
|
class ModelParser(Subcommand):
|
|
"""Llama cli for model interface apis"""
|
|
|
|
def __init__(self, subparsers: argparse._SubParsersAction):
|
|
super().__init__()
|
|
self.parser = subparsers.add_parser(
|
|
"model",
|
|
prog="llama model",
|
|
description="Work with llama models",
|
|
)
|
|
|
|
self.parser.set_defaults(func=lambda args: self.parser.print_help())
|
|
|
|
subparsers = self.parser.add_subparsers(title="model_subcommands")
|
|
|
|
# Add sub-commands
|
|
ModelDownload.create(subparsers)
|
|
ModelList.create(subparsers)
|
|
ModelPromptFormat.create(subparsers)
|
|
ModelDescribe.create(subparsers)
|
|
ModelVerifyDownload.create(subparsers)
|
|
ModelRemove.create(subparsers)
|