pub struct InstructionDataset(/* private fields */);
Expand description
[Exercise 7.2] Modified InstructionDataset
for masking instruction and inputs
NOTE: This is a Rc-wrapped InstructionDataset_
Implementations§
Source§impl InstructionDataset
impl InstructionDataset
pub fn new<P: PromptFormatter>( data: Vec<InstructionResponseExample>, tokenizer: &CoreBPE, prompt_formatter: &P, ) -> Self
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks whether the dataset is empty or has no finetuning examples.
Sourcepub fn get_item_at_index(&self, idx: usize) -> Result<(&Vec<u32>, &u32)>
pub fn get_item_at_index(&self, idx: usize) -> Result<(&Vec<u32>, &u32)>
Returns the tokenized and formatted instruction entry at specified index
pub fn data(&self) -> &Vec<InstructionResponseExample>
Trait Implementations§
Source§impl AsRef<InstructionDataset> for InstructionDataset
impl AsRef<InstructionDataset> for InstructionDataset
Source§fn as_ref(&self) -> &InstructionDataset
fn as_ref(&self) -> &InstructionDataset
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for InstructionDataset
impl Clone for InstructionDataset
Source§fn clone(&self) -> InstructionDataset
fn clone(&self) -> InstructionDataset
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for InstructionDataset
impl RefUnwindSafe for InstructionDataset
impl !Send for InstructionDataset
impl !Sync for InstructionDataset
impl Unpin for InstructionDataset
impl UnwindSafe for InstructionDataset
Blanket Implementations§
Source§impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
fn as_generalized_ref(&'short self) -> &'short Target
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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