Skip to content

Commit 36e70d1

Browse files
authored
fix: ModelConfig import error for aarch64 Linux builds (#2536)
1 parent 481db8a commit 36e70d1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

crates/semantic-search-client/src/client/hosted_model_client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ mod tests {
329329
repo_path: "test/repo".to_string(),
330330
model_file: "model.safetensors".to_string(),
331331
tokenizer_file: "tokenizer.json".to_string(),
332+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
332333
config: Default::default(),
333334
normalize_embeddings: true,
334335
batch_size: 32,
@@ -359,6 +360,7 @@ mod tests {
359360
repo_path: "test/repo".to_string(),
360361
model_file: "model.safetensors".to_string(),
361362
tokenizer_file: "tokenizer.json".to_string(),
363+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
362364
config: Default::default(),
363365
normalize_embeddings: true,
364366
batch_size: 32,

crates/semantic-search-client/src/embedding/candle_models.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
34
use candle_transformers::models::bert::Config as BertConfig;
45

56
/// Type of model to use for text embedding
@@ -29,6 +30,7 @@ pub struct ModelConfig {
2930
/// Name of the tokenizer file
3031
pub tokenizer_file: String,
3132
/// BERT configuration
33+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
3234
pub config: BertConfig,
3335
/// Whether to normalize embeddings
3436
pub normalize_embeddings: bool,
@@ -45,6 +47,7 @@ impl ModelType {
4547
repo_path: "sentence-transformers/all-MiniLM-L6-v2".to_string(),
4648
model_file: "model.safetensors".to_string(),
4749
tokenizer_file: "tokenizer.json".to_string(),
50+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
4851
config: BertConfig {
4952
vocab_size: 30522,
5053
hidden_size: 384,
@@ -71,6 +74,7 @@ impl ModelType {
7174
repo_path: "sentence-transformers/all-MiniLM-L12-v2".to_string(),
7275
model_file: "model.safetensors".to_string(),
7376
tokenizer_file: "tokenizer.json".to_string(),
77+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
7478
config: BertConfig {
7579
vocab_size: 30522,
7680
hidden_size: 384,

crates/semantic-search-client/src/embedding/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ mod benchmark_utils;
44
mod bm25;
55
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
66
mod candle;
7-
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
87
mod candle_models;
98
/// Mock embedder for testing
109
#[cfg(test)]
@@ -20,7 +19,6 @@ pub use benchmark_utils::{
2019
pub use bm25::BM25TextEmbedder;
2120
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
2221
pub use candle::CandleTextEmbedder;
23-
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
2422
pub use candle_models::{
2523
ModelConfig,
2624
ModelType,

0 commit comments

Comments
 (0)