You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: router/src/lib.rs
+25-7Lines changed: 25 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -91,13 +91,20 @@ pub async fn run(
91
91
// Optionally download the pooling config.
92
92
if pooling.is_none(){
93
93
// If a pooling config exist, download it
94
-
let _ = download_pool_config(&api_repo).await;
94
+
let _ = download_pool_config(&api_repo).await.map_err(|err| {
95
+
tracing::warn!("Download failed: {err}");
96
+
err
97
+
});
95
98
}
96
99
97
-
// Download sentence transformers config
100
+
// Download legacy sentence transformers config
101
+
// We don't warn on failure as it is a legacy file
98
102
let _ = download_st_config(&api_repo).await;
99
103
// Download new sentence transformers config
100
-
let _ = download_new_st_config(&api_repo).await;
104
+
let _ = download_new_st_config(&api_repo).await.map_err(|err| {
105
+
tracing::warn!("Download failed: {err}");
106
+
err
107
+
});
101
108
102
109
// Download model from the Hub
103
110
download_artifacts(&api_repo)
@@ -387,10 +394,21 @@ fn get_backend_model_type(
387
394
None => {
388
395
// Load pooling config
389
396
let config_path = model_root.join("1_Pooling/config.json");
390
-
let config = fs::read_to_string(config_path).context("The `--pooling` arg is not set and we could not find a pooling configuration (`1_Pooling/config.json`) for this model.")?;
391
-
let config:PoolConfig =
392
-
serde_json::from_str(&config).context("Failed to parse `1_Pooling/config.json`")?;
393
-
Pool::try_from(config)?
397
+
398
+
match fs::read_to_string(config_path){
399
+
Ok(config) => {
400
+
let config:PoolConfig = serde_json::from_str(&config)
401
+
.context("Failed to parse `1_Pooling/config.json`")?;
402
+
Pool::try_from(config)?
403
+
}
404
+
Err(err) => {
405
+
if !config.model_type.to_lowercase().contains("bert"){
406
+
returnErr(err).context("The `--pooling` arg is not set and we could not find a pooling configuration (`1_Pooling/config.json`) for this model.");
407
+
}
408
+
tracing::warn!("The `--pooling` arg is not set and we could not find a pooling configuration (`1_Pooling/config.json`) for this model but the model is a BERT variant. Defaulting to `CLS` pooling.");
0 commit comments