Skip to content

Commit

Permalink
add version and help to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed May 4, 2024
1 parent 177604f commit bd095ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/llmtuner/cli.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import sys
from enum import Enum, unique

from . import __version__
from .api.app import run_api
from .chat.chat_model import run_chat
from .eval.evaluator import run_eval
from .train.tuner import export_model, run_exp
from .webui.interface import run_web_demo, run_web_ui


USAGE = """
Usage:
llamafactory-cli api -h: launch an API server
llamafactory-cli chat -h: launch a chat interface in CLI
llamafactory-cli eval -h: do evaluation
llamafactory-cli export -h: merge LoRA adapters and export model
llamafactory-cli train -h: do training
llamafactory-cli webchat -h: launch a chat interface in Web UI
llamafactory-cli webui: launch LlamaBoard
llamafactory-cli version: show version info
"""


@unique
class Command(str, Enum):
API = "api"
Expand All @@ -17,6 +31,8 @@ class Command(str, Enum):
TRAIN = "train"
WEBDEMO = "webchat"
WEBUI = "webui"
VERSION = "version"
HELP = "help"


def main():
Expand All @@ -35,5 +51,9 @@ def main():
run_web_demo()
elif command == Command.WEBUI:
run_web_ui()
elif command == Command.VERSION:
print("Welcome to LLaMA Factory, version {}".format(__version__))
elif command == Command.HELP:
print(USAGE)
else:
raise NotImplementedError("Unknown command: {}".format(command))

0 comments on commit bd095ee

Please sign in to comment.