[Misc] Replace Optional[X] with X | None syntax (#33332)
Signed-off-by: carlory <baofa.fan@daocloud.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
c87eac18f7
commit
1a7894dbdf
@@ -2,7 +2,6 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from collections.abc import Sequence as GenericSequence
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
import torch.types
|
||||
@@ -126,7 +125,7 @@ class PackedLoRALayerWeights(LoRALayerWeights):
|
||||
|
||||
@classmethod
|
||||
def pack(
|
||||
cls, loras: GenericSequence[Optional["LoRALayerWeights"]]
|
||||
cls, loras: GenericSequence["LoRALayerWeights | None"]
|
||||
) -> "PackedLoRALayerWeights":
|
||||
"""Pack a list of LoRAs into a single LoRA.
|
||||
|
||||
@@ -155,7 +154,7 @@ class PackedLoRALayerWeights(LoRALayerWeights):
|
||||
@classmethod
|
||||
def pack_moe(
|
||||
cls,
|
||||
loras: GenericSequence[Optional["LoRALayerWeights"]],
|
||||
loras: GenericSequence["LoRALayerWeights | None"],
|
||||
module_name: str,
|
||||
is_non_gated_moe: bool = False,
|
||||
) -> "PackedLoRALayerWeights":
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import huggingface_hub
|
||||
from huggingface_hub.utils import HfHubHTTPError, HFValidationError
|
||||
@@ -131,7 +131,7 @@ def replace_submodule(
|
||||
|
||||
|
||||
def parse_fine_tuned_lora_name(
|
||||
name: str, weights_mapper: Optional["WeightsMapper"] = None
|
||||
name: str, weights_mapper: "WeightsMapper | None" = None
|
||||
) -> tuple[str, bool]:
|
||||
"""Parse the name of lora weights.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user