pub struct Batch {
pub input_ids: Vec<Vec<u32>>,
pub target_ids: Vec<Vec<u32>>,
pub padded_input_ids: Vec<Vec<u32>>,
pub padded_target_ids: Vec<Vec<u32>>,
pub attention_mask: Vec<Vec<u8>>,
pub loss_masks: Vec<Vec<u8>>,
pub batch_size: usize,
pub max_seq_len: usize,
}Expand description
Batch of training data
Fields§
§input_ids: Vec<Vec<u32>>Unpadded inputs, one per sequence.
target_ids: Vec<Vec<u32>>Unpadded targets, one per sequence.
padded_input_ids: Vec<Vec<u32>>Inputs right-padded to max_seq_len with the pad token.
padded_target_ids: Vec<Vec<u32>>Targets right-padded to max_seq_len with the pad token.
attention_mask: Vec<Vec<u8>>1 for real tokens, 0 for padding.
loss_masks: Vec<Vec<u8>>Per-sample loss masks aligned with padded targets (1 = train, 0 = ignore).
batch_size: usizeNumber of sequences.
max_seq_len: usizeLength of the longest sequence.
Auto Trait Implementations§
impl Freeze for Batch
impl RefUnwindSafe for Batch
impl Send for Batch
impl Sync for Batch
impl Unpin for Batch
impl UnsafeUnpin for Batch
impl UnwindSafe for Batch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more