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 @@
# A modified implementation of the AIMv2 Transformer
# inserted here also the image tokenizer used by Ovis2
from collections.abc import Iterable
from typing import Optional
import torch
import torch.nn as nn
@@ -165,7 +164,7 @@ class AIMv2Transformer(nn.Module):
config: AIMv2Config,
quant_config: QuantizationConfig,
*,
require_post_norm: Optional[bool] = None,
require_post_norm: bool | None = None,
prefix: str = "",
):
super().__init__()
@@ -196,7 +195,7 @@ class AIMv2Model(torch.nn.Module):
config: AIMv2Config,
quant_config: QuantizationConfig,
*,
require_post_norm: Optional[bool] = None,
require_post_norm: bool | None = None,
prefix: str = "",
):
super().__init__()