Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion core/src/services/huggingface/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl HuggingfaceBuilder {
/// Available values:
/// - model
/// - dataset
/// - datasets (alias for dataset)
///
/// Currently, only models and datasets are supported.
/// [Reference](https://huggingface.co/docs/hub/repositories)
Expand Down Expand Up @@ -128,7 +129,7 @@ impl Builder for HuggingfaceBuilder {

let repo_type = match self.config.repo_type.as_deref() {
Some("model") => Ok(RepoType::Model),
Some("dataset") => Ok(RepoType::Dataset),
Some("dataset") | Some("datasets") => Ok(RepoType::Dataset),
Some("space") => Err(Error::new(
ErrorKind::ConfigInvalid,
"repo type \"space\" is unsupported",
Expand Down Expand Up @@ -290,3 +291,17 @@ pub enum RepoType {
Model,
Dataset,
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn build_accepts_datasets_alias() {
HuggingfaceBuilder::default()
.repo_id("org/repo")
.repo_type("datasets")
.build()
.expect("builder should accept datasets alias");
}
}
1 change: 1 addition & 0 deletions core/src/services/huggingface/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct HuggingfaceConfig {
/// Available values:
/// - model
/// - dataset
/// - datasets (alias for dataset)
pub repo_type: Option<String>,
/// Repo id of this backend.
///
Expand Down
Loading