def timing2mask(
        silent_starts: np.ndarray,
        silent_ends: np.ndarray,
        size: int,
        time_offset: float = None,
        units_per_second: Optional[int] = None
) -> torch.Tensor:
    """
    Return Tensor of booleans that is ``True`` corresponding to ``silent_starts`` and ``silent_ends``.
    """
    if units_per_second is None:
        units_per_second = TOKENS_PER_SECOND
    assert len(silent_starts) == len(silent_ends)
    ts_token_mask = torch.zeros(size, dtype=torch.bool)
    if time_offset:
        silent_starts = (silent_starts - time_offset).clip(min=0)
        silent_ends = (silent_ends - time_offset).clip(min=0)
    mask_i = (silent_starts * units_per_second).round().astype(np.int32)
    mask_e = (silent_ends * units_per_second).round().astype(np.int32)
    for mi, me in zip(mask_i, mask_e):
        ts_token_mask[mi:me+1] = True

    return ts_token_mask

    Return Tensor of booleans that is ``True`` corresponding to ``silent_starts`` and ``silent_ends``.
    
stable_whisper/stabilization/utils.py