pub struct DatasetLoader;Expand description
Dataset loader that provides lazy iteration over entries
Implementations§
Source§impl DatasetLoader
impl DatasetLoader
Sourcepub fn count_entries<P: AsRef<Path>>(path: P) -> Result<usize, Error>
pub fn count_entries<P: AsRef<Path>>(path: P) -> Result<usize, Error>
Count the number of non-empty lines in a JSONL file (fast approximation of entry count)
Sourcepub fn from_file<P: AsRef<Path>>(
path: P,
) -> Result<DatasetIterator<BufReader<File>>, Error>
pub fn from_file<P: AsRef<Path>>( path: P, ) -> Result<DatasetIterator<BufReader<File>>, Error>
Create an iterator from a JSONL file in OpenAI batch API format Returns unparsed entries (without tokenization)
Sourcepub fn from_string(data: String) -> DatasetIterator<BufReader<Cursor<String>>> ⓘ
pub fn from_string(data: String) -> DatasetIterator<BufReader<Cursor<String>>> ⓘ
Create an iterator from a string (useful for testing or WASM) Returns unparsed entries (without tokenization)
Auto Trait Implementations§
impl Freeze for DatasetLoader
impl RefUnwindSafe for DatasetLoader
impl Send for DatasetLoader
impl Sync for DatasetLoader
impl Unpin for DatasetLoader
impl UnsafeUnpin for DatasetLoader
impl UnwindSafe for DatasetLoader
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