A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
chore: support pytorch format in lora (#22790)
Signed-off-by: jaeeun.kil <rha3122@naver.com> Signed-off-by: 길재은 <rha3122@naver.com>
길재은 committed
Aug 20, 2025 at 13:02 UTC
1a3079a15e5c8ae2790a1897f82e5af0d68a6921
1 file changed
+9
-4
vllm/lora/models.py
+9
-4
@@ -207,6 +207,7 @@ class LoRAModel(AdapterModel):
207
"""
208
lora_tensor_path = os.path.join(lora_dir, "adapter_model.safetensors")
209
lora_bin_file_path = os.path.join(lora_dir, "adapter_model.bin")
210
+ lora_pt_file_path = os.path.join(lora_dir, "adapter_model.pt")
211
new_embeddings_tensor_path = os.path.join(
212
lora_dir, "new_embeddings.safetensors")
213
new_embeddings_bin_file_path = os.path.join(lora_dir,
@@ -255,9 +256,10 @@ class LoRAModel(AdapterModel):
256
check_unexpected_modules(f)
257
for module in f.keys(): # noqa
258
tensors[module] = f.get_tensor(module)
258
- elif os.path.isfile(lora_bin_file_path):
259
- # When a bin file is provided, we rely on config to find unexpected
260
- # modules.
259
+ elif os.path.isfile(lora_bin_file_path) or os.path.isfile(
260
+ lora_pt_file_path):
261
+ # When a bin/pt file is provided, we rely on config to find
262
+ # unexpected modules.
263
unexpected_modules = []
264
target_modules = peft_helper.target_modules
265
if not isinstance(target_modules, list):
@@ -279,7 +281,10 @@ class LoRAModel(AdapterModel):
281
f" target modules in {expected_lora_modules}"
282
f" but received {unexpected_modules}."
283
f" Please verify that the loaded LoRA module is correct")
282
- tensors = torch.load(lora_bin_file_path,
284
+ lora_file_path = (lora_bin_file_path
285
+ if os.path.isfile(lora_bin_file_path) else
286
+ lora_pt_file_path)
287
+ tensors = torch.load(lora_file_path,
288
map_location=device,
289
weights_only=True)
290
else: