[LoRA] Support modules_to_save for sequence classification (#53555)
Signed-off-by: linitra24 <Joy25810@foxmail.com> Signed-off-by: linitra24 <renshuang.zhou@daocloud.io> Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from collections.abc import Sequence as GenericSequence
|
||||
from dataclasses import dataclass
|
||||
|
||||
import torch
|
||||
import torch.types
|
||||
@@ -281,3 +282,17 @@ class PackedLoRALayerWeights(LoRALayerWeights):
|
||||
@property
|
||||
def is_packed(self) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
@dataclass
|
||||
class LoRAFullModuleWeights:
|
||||
"""LoRA weights for classification layers."""
|
||||
|
||||
module_name: str
|
||||
weight: torch.Tensor
|
||||
bias: torch.Tensor | None = None
|
||||
|
||||
def pin_memory(self) -> None:
|
||||
self.weight = self.weight.pin_memory()
|
||||
if self.bias is not None:
|
||||
self.bias = self.bias.pin_memory()
|
||||
|
||||
Reference in New Issue
Block a user