Skip to content

Commit 574828f

Browse files
Caozhou1995caozhou
and
caozhou
authoredFeb 27, 2025··
[CLI] Add requirements and improve ease of use (#381)
This PR sets the requirements of the cli installation, and we improve ease of use: - flagscale pull just on host machine, so we moved some imports into concrete functions - To avoid installation error on the CPU without GPU, we fix the exception Co-authored-by: caozhou <caozhou@baai.ac.cn>
1 parent 8ed5844 commit 574828f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎flagscale/cli.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import click
66

7-
from run import main as run_main
87

98
VERSION = "0.6.0"
109

@@ -27,6 +26,7 @@ def train(yaml_path):
2726
"""
2827
Train model from yaml.
2928
"""
29+
from run import main as run_main
3030
click.echo(f"Start training from the yaml {yaml_path}...")
3131
yaml_path = os.path.abspath(yaml_path)
3232
config_path = os.path.dirname(yaml_path)
@@ -49,6 +49,7 @@ def serve(model_name, yaml_path=None):
4949
"""
5050
Serve model from yaml.
5151
"""
52+
from run import main as run_main
5253
if yaml_path:
5354
if os.path.isabs(yaml_path):
5455
yaml_path = yaml_path
@@ -112,6 +113,7 @@ def serve(model_name, yaml_path=None):
112113
help="The path to save ckpt",
113114
)
114115
def pull(image_name, ckpt_name, ckpt_path):
116+
"Docker pull image and git clone ckpt."
115117
# If ckpt_path is not provided, use the default download directory
116118
if ckpt_path is None:
117119
ckpt_path = os.path.join(os.getcwd(), "model_download")

‎setup.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def is_nvidia_chip():
1212
)
1313
if result.returncode == 0:
1414
return True
15-
except FileNotFoundError:
15+
except Exception as e:
1616
pass
1717
return False
1818

@@ -64,7 +64,14 @@ def run(self):
6464
"flag_scale.flagscale": ["**/*"],
6565
"flag_scale.examples": ["**/*"],
6666
},
67-
install_requires=["click", "cryptography"],
67+
install_requires=[
68+
"click",
69+
"cryptography",
70+
"setuptools>=75.1.0",
71+
"packaging>=24.1",
72+
"importlib_metadata>=8.5.0"
73+
],
74+
6875
entry_points={
6976
"console_scripts": [
7077
"flagscale=flag_scale.flagscale.cli:flagscale",

0 commit comments

Comments
 (0)
Please sign in to comment.