Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang committed Dec 27, 2024
1 parent 5636a5c commit 5530e76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions swift/llm/argument/base_args/base_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ def _handle_ckpt_dir(self: 'BaseArguments'):
if (os.path.exists(os.path.join(self.ckpt_dir, 'adapter_config.json'))
or os.path.exists(os.path.join(self.ckpt_dir, 'default', 'adapter_config.json'))
or os.path.exists(os.path.join(self.ckpt_dir, 'reft'))):
if self.ckpt_dir in self.adapters:
return
self.adapters.insert(0, self.ckpt_dir)
else:
assert self.model is None
assert self.model is None, f'self.model: {self.model}'
self.model = self.ckpt_dir
self.ckpt_dir = None
logger.warning('The `--ckpt_dir` parameter will be removed in `ms-swift>=3.2`. '
'Please use `--model`, `--adapters`.')

def __post_init__(self: 'BaseArguments'):
if self.ckpt_dir is not None:
self._handle_ckpt_dir()
logger.warning('The `--ckpt_dir` parameter will be removed in `ms-swift>=3.2`. '
'Please use `--model`, `--adapters`.')

if self.load_dataset_config is not None:
self.load_data_args = self.load_dataset_config
Expand Down Expand Up @@ -207,7 +209,7 @@ def load_args_from_ckpt(self) -> None:
'tools_prompt',
'use_chat_template'
]
skip_keys = list(f.name for f in fields(GenerationArguments)) + ['adapters']
skip_keys = list(f.name for f in fields(GenerationArguments) + fields(CompatArguments)) + ['adapters']
if not isinstance(self, TrainArguments):
skip_keys += ['max_length']
all_keys = set(all_keys) - set(skip_keys)
Expand Down
2 changes: 1 addition & 1 deletion swift/llm/infer/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse, StreamingResponse

from swift.llm import DeployArguments, AdapterRequest
from swift.llm import AdapterRequest, DeployArguments
from swift.plugin import InferStats
from swift.utils import get_logger
from .infer import SwiftInfer
Expand Down

0 comments on commit 5530e76

Please sign in to comment.