Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang committed Nov 3, 2024
1 parent 8ccbc59 commit dd0234d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions swift/llm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Recommend using `xxx_main`
from .infer import (VllmEngine, RequestConfig, InferStats, LmdeployEngine, PtEngine, infer_main, deploy_main,
PtLoRARequest, InferClient, SwiftInfer, SwiftDeploy)
from .export import export_main, merge_lora, quantize_model
from .export import export_main, merge_lora, quantize_model, export_to_ollama
from .eval import eval_main
from .train import sft_main, pt_main, rlhf_main
from .argument import (EvalArguments, InferArguments, SftArguments, ExportArguments, DeployArguments, RLHFArguments,
Expand All @@ -31,7 +31,7 @@
'deploy_main', 'VllmEngine', 'RequestConfig', 'InferStats', 'LmdeployEngine', 'PtEngine', 'infer_main',
'PtLoRARequest', 'InferClient', 'SwiftInfer', 'SwiftDeploy'
],
'export': ['export_main', 'merge_lora', 'quantize_model'],
'export': ['export_main', 'merge_lora', 'quantize_model', 'export_to_ollama'],
'eval': ['eval_main'],
'train': ['sft_main', 'pt_main', 'rlhf_main'],
'argument': [
Expand Down
2 changes: 2 additions & 0 deletions swift/llm/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
from .merge_lora import merge_lora
from .export import export_main, SwiftExport
from .quant import quantize_model
from .ollama import export_to_ollama

4 changes: 2 additions & 2 deletions swift/llm/export/export.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Alibaba, Inc. and its affiliates.
from typing import Any, Dict, List, Union

from swift.llm import (ExportArguments, SwiftPipeline, merge_lora, quantize_model)
from swift.llm import ExportArguments, SwiftPipeline, merge_lora, quantize_model, export_to_ollama
from swift.utils import get_logger
from swift.tuners import swift_to_peft_format
from swift.hub import default_hub
Expand All @@ -21,7 +21,7 @@ def run(self):
elif args.quant_method is not None:
quantize_model(args)
elif args.to_ollama:
pass
export_to_ollama(args)
elif args.push_to_hub:
ckpt_dir = args.ckpt_dir or args.model
assert ckpt_dir is not None, 'You need to specify `ckpt_dir`.'
Expand Down
1 change: 0 additions & 1 deletion swift/llm/export/ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def export_to_ollama(args: ExportArguments):
if isinstance(stop_word, list):
stop_word = template.tokenizer.decode(stop_word)
f.write(f'PARAMETER stop "{stop_word}"\n')
generation_config = model.generation_config
if args.temperature:
f.write(f'PARAMETER temperature {args.temperature}\n')
if args.top_k:
Expand Down

0 comments on commit dd0234d

Please sign in to comment.