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

@@ -14,8 +14,6 @@
# limitations under the License.
"""Inference-only FlexOlmo model compatible with HuggingFace weights."""
from typing import Optional
import torch
from torch import nn
@@ -128,8 +126,8 @@ class FlexOlmoDecoderLayer(nn.Module):
self,
positions: torch.Tensor,
hidden_states: torch.Tensor,
residual: Optional[torch.Tensor],
) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
residual: torch.Tensor | None,
) -> tuple[torch.Tensor, torch.Tensor | None]:
# Attention block.
residual = hidden_states
hidden_states = self.self_attn(positions, hidden_states)