Skip to content

Commit df58536

Browse files
authored
fix bugs (#1038)
1 parent c1f8761 commit df58536

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

docs/source/LLM/VLLM推理加速与部署.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
1818
pip install 'ms-swift[llm]' -U
1919

2020
# vllm与cuda版本有对应关系,请按照`https://docs.vllm.ai/en/latest/getting_started/installation.html`选择版本
21-
pip install vllm -U
21+
pip install vllm
2222
pip install openai -U
2323

2424
# 环境对齐 (通常不需要运行. 如果你运行错误, 可以跑下面的代码, 仓库使用最新环境测试)
@@ -484,7 +484,7 @@ CUDA_VISIBLE_DEVICES=0 swift deploy --ckpt_dir 'xxx/vx-xxx/checkpoint-xxx-merged
484484

485485
客户端示例代码同原始模型.
486486

487-
### 多LoRA部署
487+
## 多LoRA部署
488488

489489
目前pt方式部署模型已经支持`peft>=0.10.0`进行多LoRA部署,具体方法为:
490490

docs/source_en/LLM/VLLM-inference-acceleration-and-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
1515
pip install 'ms-swift[llm]' -U
1616

1717
# vllm version corresponds to cuda version, please select version according to `https://docs.vllm.ai/en/latest/getting_started/installation.html`
18-
pip install vllm -U
18+
pip install vllm
1919
pip install openai -U
2020

2121
# Environment alignment (usually not needed. If you get errors, you can run the code below, the repo uses the latest environment for testing)
@@ -481,7 +481,7 @@ CUDA_VISIBLE_DEVICES=0 swift deploy --ckpt_dir 'xxx/vx-xxx/checkpoint-xxx-merged
481481
482482
The example code for the client side is the same as the original models.
483483
484-
### Multiple LoRA Deployments
484+
## Multiple LoRA Deployments
485485
486486
The current model deployment method now supports multiple LoRA deployments with `peft>=0.10.0`. The specific steps are:
487487

examples/pytorch/llm/custom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ class CustomDatasetName:
2828
stsb_en = 'stsb-en'
2929

3030

31-
@register_model(CustomModelType.tigerbot_7b, 'TigerResearch/tigerbot-7b-base-v3', LoRATM.llama,
31+
@register_model(CustomModelType.tigerbot_7b, 'TigerResearch/tigerbot-7b-base-v3', LoRATM.llama2,
3232
TemplateType.default_generation)
33-
@register_model(CustomModelType.tigerbot_13b, 'TigerResearch/tigerbot-13b-base-v2', LoRATM.llama,
33+
@register_model(CustomModelType.tigerbot_13b, 'TigerResearch/tigerbot-13b-base-v2', LoRATM.llama2,
3434
TemplateType.default_generation)
35-
@register_model(CustomModelType.tigerbot_13b_chat, 'TigerResearch/tigerbot-13b-chat-v4', LoRATM.llama,
35+
@register_model(CustomModelType.tigerbot_13b_chat, 'TigerResearch/tigerbot-13b-chat-v4', LoRATM.llama2,
3636
CustomTemplateType.tigerbot)
3737
def get_tigerbot_model_tokenizer(model_dir: str,
3838
torch_dtype: Dtype,

swift/llm/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def get_available_models():
4242
if _args.lora_request_list is not None:
4343
model_list += [lora_request.lora_name for lora_request in _args.lora_request_list]
4444
data = [
45-
Model(id=model_id, is_chat=not is_generation_template(model_id), owned_by=_args.owned_by)
45+
Model(id=model_id, is_chat=not is_generation_template(_args.template_type), owned_by=_args.owned_by)
4646
for model_id in model_list
4747
]
4848
return ModelList(data=data)

swift/llm/utils/argument.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ def handle_compatibility(self: Union['SftArguments', 'InferArguments']) -> None:
220220
_dataset = getattr(self, key)
221221
if isinstance(_dataset, str):
222222
_dataset = [_dataset]
223+
elif _dataset is None:
224+
_dataset = []
223225
if len(_dataset) == 1 and ',' in _dataset[0]:
224226
_dataset = _dataset[0].split(',')
225227
for i, d in enumerate(_dataset):

swift/llm/utils/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ class LoRATM(NamedTuple):
435435
'kv_b_proj',
436436
'o_proj',
437437
]
438+
# compat
439+
llama2 = llama
438440

439441

440442
GetModelTokenizerFunction = Callable[..., Tuple[Optional[PreTrainedModel], PreTrainedTokenizerBase]]

0 commit comments

Comments
 (0)