Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhougaofeng
internlm2-math-7B
Commits
021c05ec
Commit
021c05ec
authored
Jun 11, 2024
by
zhougaofeng
Browse files
Upload New File
parent
6b8a2a7d
Pipeline
#1116
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
src/llmfactory/cli.py
src/llmfactory/cli.py
+75
-0
No files found.
src/llmfactory/cli.py
0 → 100644
View file @
021c05ec
import
sys
from
enum
import
Enum
,
unique
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
=
(
"-"
*
70
+
"
\n
"
+
"| Usage: |
\n
"
+
"| llamafactory-cli api -h: launch an OpenAI-style API server |
\n
"
+
"| llamafactory-cli chat -h: launch a chat interface in CLI |
\n
"
+
"| llamafactory-cli eval -h: evaluate models |
\n
"
+
"| llamafactory-cli export -h: merge LoRA adapters and export model |
\n
"
+
"| llamafactory-cli train -h: train models |
\n
"
+
"| llamafactory-cli webchat -h: launch a chat interface in Web UI |
\n
"
+
"| llamafactory-cli webui: launch LlamaBoard |
\n
"
+
"| llamafactory-cli version: show version info |
\n
"
+
"-"
*
70
)
VERSION
=
"0.7.2.dev0"
WELCOME
=
(
"-"
*
58
+
"
\n
"
+
"| Welcome to LLaMA Factory, version {}"
.
format
(
VERSION
)
+
" "
*
(
21
-
len
(
VERSION
))
+
"|
\n
|"
+
" "
*
56
+
"|
\n
"
+
"| Project page: https://github.com/hiyouga/LLaMA-Factory |
\n
"
+
"-"
*
58
)
@
unique
class
Command
(
str
,
Enum
):
API
=
"api"
CHAT
=
"chat"
EVAL
=
"eval"
EXPORT
=
"export"
TRAIN
=
"train"
WEBDEMO
=
"webchat"
WEBUI
=
"webui"
VER
=
"version"
HELP
=
"help"
def
main
():
command
=
sys
.
argv
.
pop
(
1
)
if
command
==
Command
.
API
:
run_api
()
elif
command
==
Command
.
CHAT
:
run_chat
()
elif
command
==
Command
.
EVAL
:
run_eval
()
elif
command
==
Command
.
EXPORT
:
export_model
()
elif
command
==
Command
.
TRAIN
:
run_exp
()
elif
command
==
Command
.
WEBDEMO
:
run_web_demo
()
elif
command
==
Command
.
WEBUI
:
run_web_ui
()
elif
command
==
Command
.
VER
:
print
(
WELCOME
)
elif
command
==
Command
.
HELP
:
print
(
USAGE
)
else
:
raise
NotImplementedError
(
"Unknown command: {}"
.
format
(
command
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment