Skip to content

Commit

Permalink
update cli
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Feb 22, 2024
1 parent 00a4972 commit ce486c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions lmdeploy/cli/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ def gradio(args):
quant_policy=args.quant_policy,
rope_scaling_factor=args.rope_scaling_factor,
cache_max_entry_count=args.cache_max_entry_count)
chat_template_config = ChatTemplateConfig(
model_name=args.model_name).from_json(args.chat_template)
chat_template_config = ChatTemplateConfig(model_name=args.model_name)
if args.chat_template:
chat_template_config = ChatTemplateConfig.from_json(
args.chat_template)
run(args.model_path_or_server,
server_name=args.server_name,
server_port=args.server_port,
Expand Down Expand Up @@ -238,8 +240,7 @@ def api_server(args):
quant_policy=args.quant_policy,
rope_scaling_factor=args.rope_scaling_factor,
cache_max_entry_count=args.cache_max_entry_count)
chat_template_config = ChatTemplateConfig(
model_name=args.model_name).from_json(args.chat_template)
chat_template_config = ChatTemplateConfig(model_name=args.model_name)
run_api_server(args.model_path,
backend=args.backend,
backend_config=backend_config,
Expand Down
4 changes: 1 addition & 3 deletions lmdeploy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ def to_json(self, file_path=None):
return json_str

@classmethod
def from_json(cls, file_or_string=None):
def from_json(cls, file_or_string):
"""Construct a dataclass instance from a JSON file or JSON string."""
if file_or_string is None:
return cls
try:
# Try to open the input_data as a file path
with open(file_or_string, 'r', encoding='utf-8') as file:
Expand Down

0 comments on commit ce486c5

Please sign in to comment.