Update Optional[x] -> x | None and Union[x, y] to x | y (#26633)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-10-12 17:51:31 +01:00
committed by GitHub
parent 9bb38130cb
commit 8fcaaf6a16
944 changed files with 9490 additions and 10121 deletions

View File

@ -4,7 +4,6 @@
import json
import os
from dataclasses import dataclass
from typing import Optional, Union
import torch
from safetensors.torch import save_file
@ -81,7 +80,7 @@ class DummyLoRAManager:
module_name: str,
input_dim: int,
output_dims: list[int],
noop_lora_index: Optional[list[int]] = None,
noop_lora_index: list[int] | None = None,
rank: int = 8,
):
base_loras: list[LoRALayerWeights] = []
@ -113,7 +112,7 @@ def assert_close(a, b):
@dataclass
class PunicaTensors:
inputs_tensor: torch.Tensor
lora_weights: Union[torch.Tensor, list[torch.Tensor]]
lora_weights: torch.Tensor | list[torch.Tensor]
our_out_tensor: torch.Tensor
ref_out_tensor: torch.Tensor
b_seq_start_loc: torch.Tensor