-
Notifications
You must be signed in to change notification settings - Fork 608
Open
Description
我在使用 LMDeploy时无法载入用 ms-swift 训练得到的 lora ,在pipeline使用backend_config 时会报TypeError: load_lora_weights() missing 1 required positional argument: 'adapter_id'错误
Reproduction
from lmdeploy import pipeline, GenerationConfig, PytorchEngineConfig, ChatTemplateConfig
backend_config = PytorchEngineConfig(adapters=dict(lora_name_1='/home/heimer_lan/ms-swift/output/MDC_advice_info_removeEmpty_parameterTest/v0-20250919-111103/checkpoint-19/'))
gen_config = GenerationConfig(
max_new_tokens=1024)
chat_template_config = ChatTemplateConfig('internvl2_5')
pipe = pipeline('/home/heimer_lan/InternVL/pretrained/InternVL3-14B',
chat_template_config=chat_template_config
, backend_config=backend_config
)
Environment
Package Version
-----------------------------
absl-py 2.3.1
accelerate 1.10.1
addict 2.4.0
aiofiles 24.1.0
aiohappyeyeballs 2.6.1
aiohttp 3.12.15
aiosignal 1.4.0
aliyun-python-sdk-core 2.16.0
aliyun-python-sdk-kms 2.16.5
annotated-types 0.7.0
anyio 4.10.0
attrdict 2.0.1
attrs 25.3.0
binpacking 1.5.2
Brotli 1.1.0
certifi 2025.8.3
cffi 2.0.0
charset-normalizer 3.4.3
click 8.3.0
cloudpickle 3.1.1
contourpy 1.3.3
cpm-kernels 1.0.11
crcmod 1.7
cryptography 46.0.1
cycler 0.12.1
dacite 1.9.2
datasets 3.6.0
deepspeed 0.17.5
dill 0.3.8
diskcache 5.6.3
distro 1.9.0
einops 0.8.1
fastapi 0.116.2
ffmpy 0.6.1
filelock 3.19.1
fire 0.7.1
fonttools 4.60.0
frozenlist 1.7.0
fsspec 2025.3.0
future 1.0.0
genson 1.3.0
gradio 5.46.0
gradio_client 1.13.0
groovy 0.1.2
grpcio 1.75.0
h11 0.16.0
hf-xet 1.1.10
hjson 3.1.0
httpcore 1.0.9
httpx 0.28.1
huggingface-hub 0.35.0
idna 3.10
importlib_metadata 8.7.0
jieba 0.42.1
Jinja2 3.1.6
jiter 0.11.0
jmespath 0.10.0
joblib 1.5.2
jsonpath-ng 1.7.0
jsonschema 4.25.1
jsonschema-specifications 2025.9.1
kiwisolver 1.4.9
lmdeploy 0.9.1
Markdown 3.9
markdown-it-py 4.0.0
MarkupSafe 3.0.2
matplotlib 3.10.6
mdurl 0.1.2
mmengine-lite 0.10.7
modelscope 1.30.0
mpmath 1.3.0
ms_swift 3.8.1
msgpack 1.1.1
multidict 6.6.4
multiprocess 0.70.16
networkx 3.5
ninja 1.13.0
nltk 3.9.1
numpy 1.26.4
nvidia-cublas-cu12 12.6.4.1
nvidia-cuda-cupti-cu12 12.6.80
nvidia-cuda-nvrtc-cu12 12.6.77
nvidia-cuda-runtime-cu12 12.6.77
nvidia-cudnn-cu12 9.5.1.17
nvidia-cufft-cu12 11.3.0.4
nvidia-cufile-cu12 1.11.1.6
nvidia-curand-cu12 10.3.7.77
nvidia-cusolver-cu12 11.7.1.2
nvidia-cusparse-cu12 12.5.4.2
nvidia-cusparselt-cu12 0.6.3
nvidia-ml-py 13.580.82
nvidia-nccl-cu12 2.26.2
nvidia-nvjitlink-cu12 12.6.85
nvidia-nvtx-cu12 12.6.77
openai 1.108.0
orjson 3.11.3
oss2 2.19.1
outlines 1.2.5
outlines_core 0.2.11
packaging 25.0
pandas 2.3.2
partial-json-parser 0.2.1.1.post6
peft 0.14.0
pillow 11.3.0
pip 24.0
platformdirs 4.4.0
ply 3.11
prometheus_client 0.23.1
propcache 0.3.2
protobuf 6.32.1
psutil 7.1.0
py-cpuinfo 9.0.0
pyarrow 21.0.0
pycparser 2.23
pycryptodome 3.23.0
pydantic 2.11.9
pydantic_core 2.33.2
pydub 0.25.1
Pygments 2.19.2
pynvml 13.0.1
pyparsing 3.2.4
python-dateutil 2.9.0.post0
python-multipart 0.0.20
pytz 2025.2
PyYAML 6.0.2
pyzmq 27.1.0
ray 2.49.1
referencing 0.36.2
regex 2025.9.18
requests 2.32.5
rich 14.1.0
rouge 1.0.1
rpds-py 0.27.1
ruff 0.13.1
safehttpx 0.1.6
safetensors 0.6.2
scipy 1.16.2
semantic-version 2.10.0
sentencepiece 0.2.1
setuptools 80.9.0
shellingham 1.5.4
shortuuid 1.0.13
simplejson 3.20.1
six 1.17.0
sniffio 1.3.1
sortedcontainers 2.4.0
starlette 0.48.0
sympy 1.14.0
tensorboard 2.20.0
tensorboard-data-server 0.7.2
termcolor 3.1.0
tiktoken 0.11.0
timm 1.0.19
tokenizers 0.21.4
tomlkit 0.13.3
torch 2.7.1
torchvision 0.22.1
tqdm 4.67.1
transformers 4.55.2
transformers-stream-generator 0.0.5
triton 3.3.1
trl 0.20.0
typer 0.17.4
typing_extensions 4.15.0
typing-inspection 0.4.1
tzdata 2025.2
urllib3 2.5.0
uvicorn 0.35.0
websockets 15.0.1
Werkzeug 3.1.3
xxhash 3.5.0
yapf 0.43.0
yarl 1.20.1
zipp 3.23.0
zstandard 0.25.0
Error traceback
Traceback (most recent call last):
File "/home/heimer_lan/Desktop/QWEN_FastAPI/internVL3_lora_test.py", line 8, in <module>
pipe = pipeline('/home/heimer_lan/InternVL/pretrained/InternVL3-14B',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/api.py", line 83, in pipeline
return pipeline_class(model_path,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/serve/vl_async_engine.py", line 32, in __init__
super().__init__(model_path, backend=backend, backend_config=backend_config, **kwargs)
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/serve/async_engine.py", line 283, in __init__
self._build_pytorch(model_path=model_path, backend_config=backend_config, **kwargs)
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/serve/async_engine.py", line 345, in _build_pytorch
self.engine = Engine.from_pretrained(model_path, tokenizer=self.tokenizer, engine_config=backend_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/engine.py", line 418, in from_pretrained
return cls(model_path=pretrained_model_name_or_path,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/engine.py", line 359, in __init__
self.executor.init()
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/executor/base.py", line 177, in init
self.build_model()
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/executor/uni_executor.py", line 56, in build_model
self.model_agent.build_model()
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 807, in build_model
self._build_model()
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 801, in _build_model
add_adapters(patched_model, adapters, dtype=self.model_config.dtype, device=device)
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/models/patch.py", line 320, in add_adapters
model.load_lora_weights(state_dict.items(), adapter_id=adapter_id)
File "/home/heimer_lan/lmdeploy_ms-swift/lib/python3.12/site-packages/lmdeploy/pytorch/models/internvl.py", line 500, in load_lora_weights
return load_lora_weights(weights, adapter_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: load_lora_weights() missing 1 required positional argument: 'adapter_id'
Metadata
Metadata
Assignees
Labels
No labels