EmergentTwilight's picture
download
raw
688 Bytes
"""Lightweight canonical supervision-label helpers."""
from __future__ import annotations
import torch
def canonical_autonomous_text_labels(
input_ids: torch.Tensor, labels: torch.Tensor
) -> torch.Tensor:
"""Mask controller/visual positions while retaining student vision_start."""
if input_ids.shape != labels.shape:
raise ValueError("input IDs and text labels must have identical shapes")
from uniar import SPECIAL_TOKEN_IDS
result = labels.clone()
result[input_ids == SPECIAL_TOKEN_IDS["<|image_pad|>"]] = -100
result[input_ids == SPECIAL_TOKEN_IDS["<|vision_end|>"]] = -100
return result
__all__ = ["canonical_autonomous_text_labels"]

Xet Storage Details

Size:
688 Bytes
·
Xet hash:
1ee7541b11d8fe6670a6fca5b39ad09f34074fc2a9015f118732e9021b81cfa0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.