Skip to content
Open
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
4 changes: 2 additions & 2 deletions backends/candle/src/layers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ mod rms_norm;
mod rotary;

pub use cublaslt::get_cublas_lt_wrapper;
#[allow(unused_imports)]
pub use index_select::index_select;
pub use layer_norm::{LayerNorm, LayerNormNoBias};
pub use linear::{HiddenAct, Linear};
#[allow(unused_imports)]
pub use rms_norm::RMSNorm;
#[allow(unused_imports)]
pub use index_select::index_select;
pub use rotary::{apply_rotary, get_cos_sin, get_inv_freqs, RopeScaling};
1 change: 0 additions & 1 deletion backends/candle/src/models/qwen2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::layers::HiddenAct;
use serde::Deserialize;
use tracing;

fn default_is_causal() -> bool {
tracing::warn!("is_causal not set in Qwen2Config, defaulting to true. e.g. Alibaba-NLP/gte-Qwen2-1.5B-instruct/ was trained with causal=False attention, but jinaai/jina-code-embeddings-0.5b with causal=True. Please set this field explicitly in the huggingface repo to avoid this warning.");
Expand Down
4 changes: 2 additions & 2 deletions backends/candle/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Deref for SnapshotEmbeddings {

impl From<Vec<Vec<f32>>> for SnapshotEmbeddings {
fn from(value: Vec<Vec<f32>>) -> Self {
Self(value.into_iter().map(|v| SnapEmbedding(v)).collect())
Self(value.into_iter().map(SnapEmbedding).collect())
}
}

Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn download_artifacts(
}
_ => {
for path in &paths {
download_dense_module(&api_repo, &path)?;
download_dense_module(&api_repo, path)?;
}
Some(paths)
}
Expand Down
12 changes: 3 additions & 9 deletions backends/candle/tests/test_bert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ fn test_emotions() -> Result<()> {
let matcher = relative_matcher();

let predictions: Vec<Vec<f32>> = backend
.predict(input_batch)?
.into_iter()
.map(|(_, v)| v)
.predict(input_batch)?.into_values()
.collect();
let predictions_batch = SnapshotScores::from(predictions);
insta::assert_yaml_snapshot!("emotions_batch", predictions_batch, &matcher);
Expand All @@ -180,9 +178,7 @@ fn test_emotions() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();
let predictions_single = SnapshotScores::from(predictions);

Expand Down Expand Up @@ -222,9 +218,7 @@ fn test_bert_classification() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();
let predictions_single = SnapshotScores::from(predictions);

Expand Down
2 changes: 1 addition & 1 deletion backends/candle/tests/test_dense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn test_stella_en_400m_v5_dense_768() -> Result<()> {
let (model_root, dense_paths) = download_artifacts(
"dunzhang/stella_en_400M_v5",
None,
Some("2_Dense_768".into()),
Some("2_Dense_768"),
)?;
let tokenizer = load_tokenizer(&model_root)?;

Expand Down
4 changes: 1 addition & 3 deletions backends/candle/tests/test_gte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ fn test_gte_classification() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();
let predictions_single = SnapshotScores::from(predictions);

Expand Down
4 changes: 1 addition & 3 deletions backends/candle/tests/test_jina.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ fn test_jina_rerank() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();

let predictions = SnapshotScores::from(predictions);
Expand Down
8 changes: 2 additions & 6 deletions backends/candle/tests/test_modernbert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ fn test_modernbert_classification() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();
let predictions_single = SnapshotScores::from(predictions);

Expand Down Expand Up @@ -234,9 +232,7 @@ fn test_modernbert_classification_mean_pooling() -> Result<()> {
);

let predictions: Vec<Vec<f32>> = backend
.predict(input_single)?
.into_iter()
.map(|(_, v)| v)
.predict(input_single)?.into_values()
.collect();
let predictions_single = SnapshotScores::from(predictions);

Expand Down