pub struct PackedCausalBatch<B: Backend> {
pub input_ids: Tensor<B, 1, Int>,
pub labels: Tensor<B, 1, Int>,
pub attention_mask: Tensor<B, 1, Bool>,
pub position_ids: Tensor<B, 1, Int>,
pub boundaries: Vec<usize>,
pub maximum_sequence_length: usize,
pub supervised_tokens: usize,
pub ignore_index: i64,
pub target_alignment: CausalTargetAlignment,
}Available on crate feature
std only.Expand description
Flat actual documents, ready for an explicit packed-attention model.
Fields§
§input_ids: Tensor<B, 1, Int>Actual flat token IDs, without separator or filler tokens.
labels: Tensor<B, 1, Int>Supervised labels with ignored document starts for next-token training.
attention_mask: Tensor<B, 1, Bool>True for every real token; no physical padding in this representation.
position_ids: Tensor<B, 1, Int>Per-document positions reset to zero.
boundaries: Vec<usize>Cumulative physical token boundaries, beginning with zero.
maximum_sequence_length: usizeMaximum actual document length.
supervised_tokens: usizeActual nonignored supervised targets under the selected alignment.
ignore_index: i64Actual label sentinel used during collation.
target_alignment: CausalTargetAlignmentTarget alignment recorded for the downstream loss contract.
Implementations§
Source§impl<B: Backend> PackedCausalBatch<B>
impl<B: Backend> PackedCausalBatch<B>
Source§impl<B: Backend> PackedCausalBatch<B>
impl<B: Backend> PackedCausalBatch<B>
Sourcepub fn token_inputs(&self) -> PackedTokenBatch<B>
pub fn token_inputs(&self) -> PackedTokenBatch<B>
Label-free flat input view with the exact original document boundaries.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for PackedCausalBatch<B>
impl<B> RefUnwindSafe for PackedCausalBatch<B>
impl<B> Send for PackedCausalBatch<B>
impl<B> Sync for PackedCausalBatch<B>
impl<B> Unpin for PackedCausalBatch<B>
impl<B> UnsafeUnpin for PackedCausalBatch<B>
impl<B> UnwindSafe for PackedCausalBatch<B>
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