diff --git a/rust/src/embeddings/local/bert.rs b/rust/src/embeddings/local/bert.rs index cf8d29c6..22fcf80d 100644 --- a/rust/src/embeddings/local/bert.rs +++ b/rust/src/embeddings/local/bert.rs @@ -77,7 +77,7 @@ impl BertEmbedder { }; let (config_filename, tokenizer_filename, weights_filename) = { - let api = ApiBuilder::new() + let api = ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build() .unwrap(); @@ -299,7 +299,7 @@ pub struct SparseBertEmbedder { impl SparseBertEmbedder { pub fn new(model_id: String, revision: Option, token: Option<&str>) -> Result { let (config_filename, tokenizer_filename, weights_filename) = { - let api = ApiBuilder::new() + let api = ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build() .unwrap(); diff --git a/rust/src/embeddings/local/clip.rs b/rust/src/embeddings/local/clip.rs index 84775731..fa56e900 100644 --- a/rust/src/embeddings/local/clip.rs +++ b/rust/src/embeddings/local/clip.rs @@ -64,7 +64,7 @@ impl Default for ClipEmbedder { impl ClipEmbedder { pub fn new(model_id: String, revision: Option<&str>, token: Option<&str>) -> Result { - let api = hf_hub::api::sync::ApiBuilder::new() + let api = hf_hub::api::sync::ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build()?; @@ -372,7 +372,7 @@ mod tests { "EmbedAnything is the best!".to_string(), ] ); - assert_eq!(input_ids.shape().clone().into_dims(), &[2, 8]); + assert_eq!(input_ids.shape().clone().into_dims(), &[2, 77]); } // Tests the load_image method. diff --git a/rust/src/embeddings/local/jina.rs b/rust/src/embeddings/local/jina.rs index 9d47e512..b8c7d3c4 100644 --- a/rust/src/embeddings/local/jina.rs +++ b/rust/src/embeddings/local/jina.rs @@ -50,7 +50,7 @@ impl Default for JinaEmbedder { impl JinaEmbedder { pub fn new(model_id: &str, revision: Option<&str>, token: Option<&str>) -> Result { - let api = hf_hub::api::sync::ApiBuilder::new() + let api = hf_hub::api::sync::ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build()?; let api = match revision { diff --git a/rust/src/embeddings/local/modernbert.rs b/rust/src/embeddings/local/modernbert.rs index 2814094a..ae6d2801 100644 --- a/rust/src/embeddings/local/modernbert.rs +++ b/rust/src/embeddings/local/modernbert.rs @@ -41,7 +41,7 @@ impl ModernBertEmbedder { dtype: Option, ) -> Result { let (config_filename, tokenizer_filename, weights_filename) = { - let api = ApiBuilder::new() + let api = ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build() .unwrap(); diff --git a/rust/src/embeddings/local/qwen3.rs b/rust/src/embeddings/local/qwen3.rs index bbce4480..668d14d8 100644 --- a/rust/src/embeddings/local/qwen3.rs +++ b/rust/src/embeddings/local/qwen3.rs @@ -35,7 +35,7 @@ impl Qwen3Embedder { token: Option<&str>, dtype: Option, ) -> Result { - let api = ApiBuilder::new() + let api = ApiBuilder::from_env() .with_token(token.map(|s| s.to_string())) .build() .unwrap();