pub struct HfDataset { /* private fields */ }Expand description
HuggingFace Hub dataset configuration and loader.
This struct provides a builder pattern for configuring and downloading datasets from the HuggingFace Hub.
Implementations§
Source§impl HfDataset
impl HfDataset
Sourcepub fn builder(repo_id: impl Into<String>) -> HfDatasetBuilder
pub fn builder(repo_id: impl Into<String>) -> HfDatasetBuilder
Creates a new builder for a HuggingFace dataset.
§Arguments
repo_id- The dataset repository ID (e.g., “squad”, “openai/gsm8k”)
Sourcepub fn download(&self) -> Result<ArrowDataset>
pub fn download(&self) -> Result<ArrowDataset>
Downloads the dataset and returns an ArrowDataset.
This method:
- Checks the local cache for existing data
- Downloads parquet files from HuggingFace Hub if not cached
- Loads the parquet files into an ArrowDataset
§Errors
Returns an error if:
- The dataset cannot be found on HuggingFace Hub
- The download fails
- The parquet files cannot be parsed
Sourcepub fn download_to(&self, output: impl AsRef<Path>) -> Result<ArrowDataset>
pub fn download_to(&self, output: impl AsRef<Path>) -> Result<ArrowDataset>
Sourcepub fn clear_cache(&self) -> Result<()>
pub fn clear_cache(&self) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HfDataset
impl RefUnwindSafe for HfDataset
impl Send for HfDataset
impl Sync for HfDataset
impl Unpin for HfDataset
impl UnsafeUnpin for HfDataset
impl UnwindSafe for HfDataset
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> 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 moreCreates a shared type from an unshared type.