From 8eee6255cf9f0481c71dc36fd2d3d571612b98bf Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Wed, 12 Jun 2024 23:08:22 +0400 Subject: [PATCH] Add new splade-v3 model change rwlock to mutex to avoid race conditions --- lantern_cli/Cargo.toml | 2 +- .../src/embeddings/core/ort_runtime.rs | 81 ++++++++++++++----- lantern_cli/tests/text_embedding_test.rs | 60 +++++++++----- lantern_extras/Cargo.toml | 2 +- 4 files changed, 105 insertions(+), 40 deletions(-) diff --git a/lantern_cli/Cargo.toml b/lantern_cli/Cargo.toml index 154a189..4d97de6 100644 --- a/lantern_cli/Cargo.toml +++ b/lantern_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lantern_cli" -version = "0.3.1" +version = "0.3.2" edition = "2021" [[bin]] diff --git a/lantern_cli/src/embeddings/core/ort_runtime.rs b/lantern_cli/src/embeddings/core/ort_runtime.rs index bd33761..84ff61d 100644 --- a/lantern_cli/src/embeddings/core/ort_runtime.rs +++ b/lantern_cli/src/embeddings/core/ort_runtime.rs @@ -12,7 +12,7 @@ use std::{ collections::HashMap, io::Cursor, path::{Path, PathBuf}, - sync::{Arc, Mutex, RwLock}, + sync::{Arc, Mutex}, time::Duration, }; use sysinfo::{System, SystemExt}; @@ -30,9 +30,53 @@ type SessionInput<'a> = ArrayBase, Dim>; pub enum PoolingStrategy { CLS, Mean, + ReluLogMaxPooling, } impl PoolingStrategy { + fn relu_log_max_pooling( + embeddings: ViewHolder<'_, f32, Dim>, + attention_mask: &SessionInput, + output_dims: usize, + ) -> Vec> { + // Apply ReLU: max(0, x) + let relu_embeddings = embeddings.mapv(|x| x.max(0.0)); + + // Apply log(1 + x) + let relu_log_embeddings = relu_embeddings.mapv(|x| (1.0 + x).ln()); + + // Expand attention mask to match embeddings dimensions + let attention_mask_shape = attention_mask.shape(); + let input_mask_expanded = attention_mask.clone().insert_axis(Axis(2)).into_owned(); + let input_mask_expanded = input_mask_expanded + .broadcast(( + attention_mask_shape[0], + attention_mask_shape[1], + output_dims, + )) + .unwrap() + .to_owned(); + let input_mask_expanded = input_mask_expanded.mapv(|v| v as f32); + + // Apply attention mask + let relu_log_embeddings = relu_log_embeddings.to_owned(); + let masked_embeddings = &relu_log_embeddings * &input_mask_expanded; + + // Find the maximum value across the sequence dimension (Axis 1) + let max_embeddings = masked_embeddings.map_axis(Axis(1), |view| { + view.fold(f32::NEG_INFINITY, |a, &b| a.max(b)) + }); + + // Convert the resulting max_embeddings to a Vec> + max_embeddings + .iter() + .map(|s| *s) + .chunks(output_dims) + .into_iter() + .map(|b| b.collect()) + .collect() + } + fn cls_pooling( embeddings: ViewHolder<'_, f32, Dim>, output_dims: usize, @@ -90,6 +134,9 @@ impl PoolingStrategy { &PoolingStrategy::Mean => { PoolingStrategy::mean_pooling(embeddings, attention_mask, output_dims) } + &PoolingStrategy::ReluLogMaxPooling => { + PoolingStrategy::relu_log_max_pooling(embeddings, attention_mask, output_dims) + } } } } @@ -242,7 +289,7 @@ impl ModelInfoBuilder { } lazy_static! { - static ref MODEL_INFO_MAP: RwLock> = RwLock::new(HashMap::from([ + static ref MODEL_INFO_MAP: Mutex> = Mutex::new(HashMap::from([ ("clip/ViT-B-32-textual", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/openai/ViT-B-32/textual").with_tokenizer(true).build()), ("clip/ViT-B-32-visual", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/openai/ViT-B-32/visual").with_visual(true).with_input_image_size(224).build()), ("BAAI/bge-small-en", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/BAAI/bge-small-en-v1.5").with_tokenizer(true).build()), @@ -259,7 +306,7 @@ lazy_static! { ("transformers/multi-qa-mpnet-base-dot-v1", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/transformers/multi-qa-mpnet-base-dot-v1").with_tokenizer(true).build()), ("jinaai/jina-embeddings-v2-small-en", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/jinaai/jina-embeddings-v2-small-en").with_tokenizer(true).with_layer_cnt(4).with_head_cnt(4).with_head_dim(64).with_pooling_strategy(PoolingStrategy::Mean).build()), ("jinaai/jina-embeddings-v2-base-en", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/jinaai/jina-embeddings-v2-base-en").with_tokenizer(true).with_layer_cnt(12).with_head_cnt(12).with_head_dim(64).with_pooling_strategy(PoolingStrategy::Mean).build()), - ("naver/splade-v3", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/naver/splade-v3").with_tokenizer(true).build()) + ("naver/splade-v3", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/naver/splade-v3").with_tokenizer(true).with_pooling_strategy(PoolingStrategy::ReluLogMaxPooling).build()) ])); } @@ -723,16 +770,19 @@ impl<'a> OrtRuntime<'a> { Ok(()) } - fn check_and_download_files(&self, model_name: &str) -> Result<(), anyhow::Error> { + fn check_and_download_files( + &self, + model_name: &str, + mut models_map: &mut HashMap<&'static str, ModelInfo>, + ) -> Result<(), anyhow::Error> { { - let map = MODEL_INFO_MAP.read().unwrap(); - let model_info = map.get(model_name); + let model_info = models_map.get(model_name); if model_info.is_none() { anyhow::bail!( "Model \"{}\" not found.\nAvailable models: {}", model_name, - map.keys().join(", ") + models_map.keys().join(", ") ) } @@ -744,8 +794,7 @@ impl<'a> OrtRuntime<'a> { } } - let mut map_write = MODEL_INFO_MAP.write().unwrap(); - let model_info = map_write.get_mut(model_name).unwrap(); + let model_info = models_map.get_mut(model_name).unwrap(); let model_folder = Path::join(&Path::new(&self.data_path), model_name); let model_path = Path::join(&model_folder, "model.onnx"); @@ -774,9 +823,9 @@ impl<'a> OrtRuntime<'a> { } // Check available memory - self.check_available_memory(&model_path, &mut map_write)?; + self.check_available_memory(&model_path, &mut models_map)?; - let model_info = map_write.get_mut(model_name).unwrap(); + let model_info = models_map.get_mut(model_name).unwrap(); let encoder = EncoderService::new( &ONNX_ENV, model_name, @@ -788,7 +837,6 @@ impl<'a> OrtRuntime<'a> { match encoder { Ok(enc) => model_info.encoder = Some(enc), Err(err) => { - drop(map_write); anyhow::bail!(err) } } @@ -892,13 +940,13 @@ impl<'a> EmbeddingRuntime for OrtRuntime<'a> { model_name: &str, inputs: &Vec<&str>, ) -> Result { - let download_result = self.check_and_download_files(model_name); + let mut map = MODEL_INFO_MAP.lock().unwrap(); + let download_result = self.check_and_download_files(model_name, &mut map); if let Err(err) = download_result { anyhow::bail!("{:?}", err); } - let map = MODEL_INFO_MAP.read().unwrap(); let model_info = map.get(model_name).unwrap(); let result; @@ -979,10 +1027,7 @@ impl<'a> EmbeddingRuntime for OrtRuntime<'a> { result = model_info.encoder.as_ref().unwrap().process_text(inputs); } - drop(map); - if !self.cache { - let mut map = MODEL_INFO_MAP.write().unwrap(); let model_info = map.get_mut(model_name).unwrap(); model_info.encoder = None; } @@ -996,7 +1041,7 @@ impl<'a> EmbeddingRuntime for OrtRuntime<'a> { } fn get_available_models(&self) -> (String, Vec<(String, bool)>) { - let map = MODEL_INFO_MAP.read().unwrap(); + let map = MODEL_INFO_MAP.lock().unwrap(); let mut res = String::new(); let data_path = &self.data_path; let mut models = Vec::with_capacity(map.len()); diff --git a/lantern_cli/tests/text_embedding_test.rs b/lantern_cli/tests/text_embedding_test.rs index cd9c415..23b01d1 100644 --- a/lantern_cli/tests/text_embedding_test.rs +++ b/lantern_cli/tests/text_embedding_test.rs @@ -30,7 +30,23 @@ static BGE_M3_EMB: &'static [f32] = &[-0.00014090538024902344, -0.06671142578125 #[rustfmt::skip] static BGE_M3_WEATHER_EMB: &'static [f32] = &[-0.0302734375, 0.038116455078125, -0.043975830078125, -0.0220489501953125, -0.01222991943359375, -0.08197021484375, 0.00858306884765625, 0.0128631591796875, 0.015777587890625, -0.0178680419921875, -0.024383544921875, 0.0139312744140625, 0.01702880859375, -0.00618743896484375, -0.005901336669921875, 0.0037975311279296875, 0.04437255859375, -0.01349639892578125, -0.005107879638671875, -0.056182861328125, 0.00760650634765625, -0.003814697265625, -0.051849365234375, 0.004695892333984375, 0.03424072265625, 0.00885009765625, -0.037506103515625, 0.01158905029296875, 0.0313720703125, 0.03399658203125, 0.005374908447265625, 0.0182952880859375, 0.0011968612670898438, -0.036712646484375, -0.032470703125, -0.0255126953125, 0.00438690185546875, -0.004108428955078125, -0.03179931640625, 0.02093505859375, 0.03790283203125, -0.0279541015625, 0.0299224853515625, 0.0193939208984375, -0.02056884765625, -0.051025390625, -0.0220794677734375, -0.0028514862060546875, -0.006351470947265625, -0.0290374755859375, -0.0014963150024414062, 0.0125579833984375, 0.02691650390625, 0.0008153915405273438, 0.016845703125, 0.0210723876953125, 0.03271484375, -0.0028533935546875, -0.07733154296875, -0.0183563232421875, -0.042266845703125, -0.039703369140625, -0.0011186599731445312, 0.0176239013671875, 0.006710052490234375, 0.1258544921875, 0.045867919921875, 0.003917694091796875, -0.01441192626953125, -0.0207672119140625, -0.0026607513427734375, 0.0164337158203125, -0.004024505615234375, 0.0027065277099609375, -0.048797607421875, 0.001293182373046875, -0.0223236083984375, 0.01056671142578125, -0.006748199462890625, 0.0283660888671875, 0.07781982421875, -0.007335662841796875, 0.02581787109375, -0.0147857666015625, 0.020294189453125, 0.0753173828125, -0.0139923095703125, 0.009246826171875, -0.0280609130859375, -0.0189056396484375, -0.059478759765625, 0.01477813720703125, -0.017242431640625, -0.078369140625, -0.0166015625, 0.000881195068359375, -0.045562744140625, 0.00732421875, 0.0248870849609375, 0.0058135986328125, 0.02593994140625, 0.005031585693359375, -0.01039886474609375, -0.03369140625, -0.011810302734375, -0.019561767578125, 0.03326416015625, 0.01229095458984375, -0.0023651123046875, 0.01209259033203125, 0.060150146484375, 0.07421875, 0.05950927734375, 0.00435638427734375, -0.010040283203125, -0.0014905929565429688, -0.0286102294921875, -0.04693603515625, -0.035186767578125, 0.00785064697265625, -0.0265960693359375, 0.0404052734375, 0.0306854248046875, -0.0174407958984375, -0.0301666259765625, -0.0183563232421875, 0.01375579833984375, 0.0693359375, 0.018890380859375, 0.03594970703125, 0.01849365234375, 0.01282501220703125, -0.03118896484375, 0.017120361328125, 0.0082550048828125, 0.01517486572265625, 0.0086517333984375, 0.01409149169921875, 0.019317626953125, -0.0219268798828125, -0.00797271728515625, 0.033416748046875, -0.0211181640625, -0.016571044921875, 0.0313720703125, -0.039306640625, 0.01371002197265625, -0.01666259765625, -0.0007023811340332031, -0.04486083984375, 0.0194244384765625, -0.0235443115234375, 0.006008148193359375, 0.0198211669921875, -0.0145721435546875, -0.0020389556884765625, -0.0167999267578125, 0.05157470703125, -0.04705810546875, 0.01151275634765625, 0.06036376953125, -0.0034389495849609375, -0.06805419921875, 0.004863739013671875, 0.023162841796875, 0.026641845703125, 0.01641845703125, 0.006740570068359375, -0.00841522216796875, 0.0283355712890625, -0.01499176025390625, -0.02691650390625, 0.048980712890625, -0.01197052001953125, 0.034027099609375, 0.0248870849609375, 0.048248291015625, 0.007354736328125, -0.0178680419921875, -0.004581451416015625, -0.0401611328125, 0.0021228790283203125, 0.0247650146484375, -0.0223541259765625, -0.02008056640625, 0.0579833984375, -0.0009570121765136719, -0.03961181640625, -0.0026092529296875, -0.005107879638671875, -0.01544952392578125, -0.0194549560546875, 0.01392364501953125, -0.0039825439453125, 0.06768798828125, -0.006626129150390625, 0.0257415771484375, -0.01445770263671875, -0.019805908203125, -0.0218353271484375, -0.039398193359375, 0.01751708984375, 0.0394287109375, 0.0251617431640625, -0.0167999267578125, -0.019317626953125, -0.0518798828125, -0.026702880859375, 0.0068511962890625, -0.0291900634765625, 0.00018906593322753906, -0.017181396484375, 0.01360321044921875, -0.004970550537109375, -0.037322998046875, 0.01458740234375, -0.00884246826171875, 0.041046142578125, 0.00710296630859375, 0.017791748046875, -0.0152740478515625, 0.0289154052734375, -0.01137542724609375, -0.0176544189453125, 0.034271240234375, 0.0245819091796875, 0.016387939453125, 0.0137786865234375, -0.051849365234375, -0.021575927734375, -0.01348114013671875, 0.037841796875, -0.035369873046875, -0.0139923095703125, 0.045928955078125, -0.039215087890625, -0.0654296875, 0.01467132568359375, -0.0161590576171875, 0.041595458984375, -0.01317596435546875, -0.0142822265625, -0.0192718505859375, -0.00572967529296875, -0.0213623046875, 0.011871337890625, 0.025726318359375, -0.00473785400390625, -0.0188140869140625, 0.0101165771484375, 0.03631591796875, -0.040771484375, -0.033782958984375, 0.00498199462890625, 0.0249786376953125, 0.0209503173828125, 0.01123809814453125, -0.00934600830078125, -0.007183074951171875, 0.018890380859375, 0.033294677734375, -0.024749755859375, 0.012451171875, 0.048980712890625, 0.02044677734375, -0.00548553466796875, -0.00408172607421875, 0.00595855712890625, 0.0215606689453125, -0.041259765625, -0.0150146484375, 0.0051727294921875, -0.029296875, 0.0108489990234375, 0.0208740234375, -0.007389068603515625, 0.005466461181640625, -0.0241851806640625, 0.019866943359375, -0.01995849609375, 0.01335906982421875, -0.003383636474609375, 0.001789093017578125, 0.024871826171875, 0.005340576171875, 0.0016880035400390625, -0.003246307373046875, 0.0161895751953125, 0.0008058547973632812, -0.05682373046875, -0.0003190040588378906, -0.0220489501953125, 0.050750732421875, -0.019134521484375, 0.01611328125, 0.0225372314453125, -0.01291656494140625, -0.1832275390625, 0.024322509765625, -0.0036258697509765625, -0.020233154296875, 0.0021381378173828125, -0.01336669921875, -0.0201568603515625, -0.007965087890625, 0.005916595458984375, -0.037872314453125, -0.02337646484375, -0.0282135009765625, -0.001556396484375, 0.024017333984375, 0.00310516357421875, -0.01474761962890625, 0.03515625, -0.032501220703125, 0.018524169921875, -0.07659912109375, 0.041015625, -0.00949859619140625, 0.042388916015625, -0.0252532958984375, -0.0171966552734375, 0.023956298828125, 0.012939453125, -0.0006246566772460938, -0.03155517578125, -0.0183563232421875, 0.00791168212890625, 0.031707763671875, -0.0257568359375, 0.003749847412109375, 0.040191650390625, 0.0123291015625, 0.0125579833984375, -0.0214080810546875, -0.05487060546875, 0.0176544189453125, -0.004924774169921875, 0.0292816162109375, -0.03204345703125, 0.052490234375, 0.01629638671875, -0.035064697265625, -0.0004096031188964844, -0.0110321044921875, 0.027557373046875, -0.00476837158203125, 0.0118560791015625, 0.0253753662109375, 0.034912109375, 0.006488800048828125, -0.038421630859375, 0.031097412109375, -0.02001953125, 0.053466796875, -0.03399658203125, 0.0282135009765625, -0.05145263671875, -0.036102294921875, 0.0230255126953125, 0.0299530029296875, 0.01092529296875, 0.029754638671875, 0.0185394287109375, 0.0236053466796875, 0.023162841796875, -0.032745361328125, 0.007427215576171875, 0.0167083740234375, -0.026458740234375, -0.038360595703125, 0.0419921875, 0.041107177734375, -0.02227783203125, -0.037017822265625, -0.0164642333984375, -0.11956787109375, 0.00489044189453125, -0.0186767578125, 0.01043701171875, -0.0225067138671875, -0.0236358642578125, -0.0419921875, 0.0214691162109375, 0.0269317626953125, 0.039703369140625, 0.255615234375, 0.0218505859375, 0.01059722900390625, -0.025787353515625, 0.03277587890625, -0.034271240234375, -0.0127716064453125, -0.00890350341796875, 0.003208160400390625, -0.052764892578125, -0.0238800048828125, -0.01107025146484375, -0.026885986328125, 0.013916015625, -0.017303466796875, 0.00527191162109375, -0.026947021484375, -0.0128326416015625, 0.039581298828125, 0.0025119781494140625, 0.0009703636169433594, 0.002872467041015625, 0.0109710693359375, -0.010894775390625, -0.03289794921875, -0.06390380859375, 0.018829345703125, 0.0294342041015625, 0.034393310546875, -0.008514404296875, -0.0157623291015625, 0.0180511474609375, -0.0029163360595703125, -0.0190277099609375, -0.00897216796875, 0.01045989990234375, -0.0020046234130859375, -0.0015077590942382812, 0.00768280029296875, 0.01238250732421875, 0.002597808837890625, -0.0177154541015625, 0.04241943359375, -0.008544921875, 0.031982421875, -0.009124755859375, 0.0027904510498046875, -0.0372314453125, -0.0391845703125, -0.0253753662109375, -0.02276611328125, -0.0180206298828125, -0.049652099609375, 0.02642822265625, -0.0172882080078125, -0.039154052734375, -0.02020263671875, -0.0195770263671875, 0.045562744140625, 0.0118408203125, -0.027984619140625, 0.0196533203125, -0.0005540847778320312, -0.040740966796875, 0.031494140625, 0.03228759765625, 0.00884246826171875, -0.03216552734375, 0.00788116455078125, -0.0151519775390625, -0.00295257568359375, -0.0239410400390625, -0.0247955322265625, 0.027130126953125, 0.0017690658569335938, -0.002704620361328125, -0.01293182373046875, 0.04779052734375, -0.0009331703186035156, 0.059295654296875, -0.0081939697265625, -0.0030498504638671875, -0.05511474609375, 0.0195465087890625, -0.003490447998046875, -0.015655517578125, 0.05548095703125, 0.042510986328125, 0.05322265625, -0.0511474609375, 0.10284423828125, 0.0193939208984375, -0.04229736328125, 0.0183868408203125, 0.02105712890625, -0.05401611328125, 0.0174102783203125, -0.003551483154296875, 0.0107574462890625, 0.0153656005859375, -0.03082275390625, -0.0036163330078125, 0.02374267578125, -0.003841400146484375, 0.0255279541015625, -0.0006742477416992188, 0.0023097991943359375, -0.015960693359375, 0.01611328125, 0.0095367431640625, -0.01161956787109375, 0.00274658203125, -0.01560211181640625, 0.012237548828125, 0.028472900390625, 0.054351806640625, 0.02056884765625, 0.0055389404296875, -0.007419586181640625, -0.0002682209014892578, -0.0264434814453125, -0.0153045654296875, 0.03155517578125, -0.0185089111328125, 0.01541900634765625, -0.004100799560546875, 0.007843017578125, 0.020294189453125, -0.015625, 0.0479736328125, -0.02001953125, -0.017181396484375, -0.029266357421875, 0.006313323974609375, 0.0555419921875, -0.0013027191162109375, 0.06134033203125, 0.0347900390625, -0.033935546875, 0.09393310546875, 0.031768798828125, -0.046783447265625, -0.01488494873046875, -0.03155517578125, 0.007568359375, 0.0082855224609375, 0.006805419921875, 2.3066997528076172e-05, -0.05157470703125, -0.039215087890625, 0.004619598388671875, 0.0117340087890625, 0.032684326171875, -0.026031494140625, -0.00139617919921875, -0.036590576171875, -0.02532958984375, -0.04632568359375, -0.0042724609375, -0.0198516845703125, -0.01311492919921875, 0.0117034912109375, 0.0245513916015625, 0.1156005859375, 0.045989990234375, 0.0149993896484375, -0.012298583984375, 0.06298828125, 0.03271484375, -0.020599365234375, 0.01273345947265625, 0.0167694091796875, -0.0287322998046875, 0.00940704345703125, -0.00830078125, -0.0001074075698852539, 0.0118560791015625, -0.0189208984375, -0.03375244140625, 0.038421630859375, 0.037933349609375, -0.015869140625, 0.0079803466796875, 0.05950927734375, 0.00199127197265625, 0.0303497314453125, -0.0112152099609375, -0.0203857421875, 0.03759765625, -0.01146697998046875, -0.0200958251953125, 0.07568359375, 0.0288238525390625, 0.0084381103515625, 0.053741455078125, 0.042816162109375, 0.0012493133544921875, 0.0255889892578125, -0.009063720703125, -0.055755615234375, -0.01476287841796875, -0.0322265625, -0.0014667510986328125, 0.0071563720703125, 0.0162506103515625, -0.03411865234375, -0.0082244873046875, -0.0176239013671875, 0.003326416015625, 0.017608642578125, 0.00039887428283691406, -0.053680419921875, -0.01561737060546875, -0.0181121826171875, -0.03863525390625, 0.02081298828125, -0.015472412109375, 0.0117340087890625, -0.00760650634765625, 0.00835418701171875, -0.0256195068359375, -0.0005774497985839844, 0.09393310546875, -0.04156494140625, 0.011871337890625, 0.036102294921875, -0.035888671875, -0.00839996337890625, -0.0216522216796875, 0.03179931640625, 0.00446319580078125, 0.0188751220703125, -0.00533294677734375, -0.00438690185546875, 0.007602691650390625, 0.0093994140625, -0.00667572021484375, 0.03375244140625, -0.036529541015625, 0.0262908935546875, 0.003108978271484375, -0.0007534027099609375, 0.0472412109375, 0.044219970703125, 0.0132904052734375, 0.04345703125, -0.035552978515625, 0.037139892578125, 0.00567626953125, 0.032135009765625, -0.021697998046875, 0.031524658203125, 0.0372314453125, 0.021270751953125, -0.03594970703125, 0.0382080078125, 0.006237030029296875, 0.043426513671875, -0.0250091552734375, -0.01213836669921875, -0.0117645263671875, 0.06097412109375, 0.0027923583984375, 0.03277587890625, -0.01056671142578125, -0.0596923828125, 0.0277252197265625, -0.007122039794921875, -0.049591064453125, -0.019073486328125, -0.013153076171875, 0.0007843971252441406, -0.0202789306640625, -0.017242431640625, -0.052978515625, 0.034759521484375, -0.0240478515625, 0.0599365234375, -0.02978515625, 0.027618408203125, -0.049163818359375, 0.0638427734375, -0.021148681640625, 0.029266357421875, -0.042022705078125, 0.01003265380859375, -0.0166778564453125, -0.01509857177734375, 0.01425933837890625, -0.0038356781005859375, 0.01392364501953125, -0.0174407958984375, -0.034271240234375, -0.0013513565063476562, 0.01177978515625, 0.01666259765625, -0.0254364013671875, 0.041259765625, -0.0274810791015625, 0.0309906005859375, -0.04345703125, 0.0267333984375, -0.0274200439453125, 0.01050567626953125, -0.019683837890625, 0.01885986328125, 0.008148193359375, 0.01751708984375, 0.03546142578125, -0.0175933837890625, 0.01275634765625, -0.0158538818359375, -0.0220794677734375, -0.0165863037109375, 0.01361846923828125, -0.0210723876953125, 0.041717529296875, -0.053131103515625, -0.06512451171875, -0.0008492469787597656, 0.02044677734375, 0.00811004638671875, 0.00572967529296875, -0.0230712890625, -0.0280609130859375, -0.03411865234375, -0.036834716796875, 0.0033054351806640625, -0.046905517578125, -0.0088348388671875, -0.046844482421875, 0.0022258758544921875, -0.0116424560546875, -0.0277862548828125, -0.00025963783264160156, -0.042388916015625, 0.0215606689453125, 0.0155181884765625, 0.057373046875, -0.06341552734375, -0.0198822021484375, 0.08282470703125, -0.0207061767578125, -0.055572509765625, 0.0282745361328125, -0.040252685546875, -0.00269317626953125, 0.0042266845703125, 0.00079345703125, 0.01435089111328125, 0.006916046142578125, 0.026214599609375, -0.0494384765625, -0.0232391357421875, 0.0109100341796875, 0.014923095703125, -0.02764892578125, -0.0062713623046875, 0.046539306640625, 0.0238037109375, -0.035919189453125, 0.054473876953125, -0.01467132568359375, 0.018218994140625, 0.0024929046630859375, 0.0165252685546875, -0.0374755859375, -0.012542724609375, 0.01708984375, 0.0247955322265625, -0.044281005859375, 0.0771484375, 0.0254058837890625, -0.003955841064453125, -0.0312042236328125, 0.0264892578125, -0.0007429122924804688, -0.0117645263671875, -0.0245513916015625, 0.06414794921875, -0.01151275634765625, -0.007602691650390625, -0.0175018310546875, -0.019378662109375, -0.0153045654296875, -0.00719451904296875, -0.00495147705078125, 0.0019178390502929688, 0.0230255126953125, -0.0263214111328125, -0.06048583984375, -0.00400543212890625, -0.05596923828125, -0.00972747802734375, -0.171875, 0.06939697265625, 0.0113372802734375, -0.0181884765625, -0.017974853515625, 0.03900146484375, -0.07781982421875, 0.0242462158203125, -0.0151519775390625, -0.042449951171875, -0.02545166015625, 0.0072174072265625, 0.00223541259765625, -0.0223388671875, 0.0002415180206298828, 0.0086669921875, -0.006351470947265625, -0.00966644287109375, 0.01155853271484375, 0.048553466796875, -0.00969696044921875, -0.017059326171875, 0.008758544921875, -0.005817413330078125, -0.028839111328125, -0.020721435546875, -0.0125274658203125, 0.0292510986328125, -0.0285491943359375, -0.0068511962890625, 0.0244140625, -0.06756591796875, 0.017730712890625, 0.0265045166015625, 0.0162353515625, -0.002307891845703125, -0.006977081298828125, -0.03204345703125, 0.0234222412109375, 0.0006399154663085938, -0.0171966552734375, 0.024017333984375, -0.03594970703125, 0.019866943359375, -0.0148468017578125, 0.042510986328125, -0.020172119140625, -0.032958984375, -0.04632568359375, 0.0123748779296875, -0.04229736328125, 0.005725860595703125, -0.006103515625, 0.0191497802734375, 0.005886077880859375, 0.006999969482421875, -0.0338134765625, 0.02630615234375, 0.0258331298828125, -0.0007495880126953125, -0.0198516845703125, 0.018585205078125, -0.045074462890625, -0.0301666259765625, -0.0689697265625, 0.00890350341796875, -0.093017578125, 0.006084442138671875, 0.0181884765625, -0.0085601806640625, -0.04608154296875, -0.043426513671875, 0.00707244873046875, 0.05023193359375, -0.004985809326171875, 0.005847930908203125, 0.00415802001953125, -0.0438232421875, -0.03668212890625, 0.0010824203491210938, -0.01169586181640625, 0.046478271484375, -0.07177734375, -0.005828857421875, -0.01294708251953125, -0.017669677734375, -0.005802154541015625, -0.049652099609375, -0.031494140625, -0.0131378173828125, -0.059967041015625, -0.023681640625, -0.041412353515625, 0.0272064208984375, -0.042755126953125, 0.009307861328125, -0.01544189453125, -0.00862884521484375, -0.01268768310546875, 0.00890350341796875, 0.003856658935546875, -0.01502227783203125, -0.0167236328125, 0.0009589195251464844, -0.0116729736328125, 0.0008640289306640625, -0.00965118408203125, 0.004512786865234375, 0.0161285400390625, 0.03033447265625, -0.007083892822265625, -0.0286865234375, -0.016387939453125, 0.019500732421875, -0.0169525146484375, 8.809566497802734e-05, 0.0119781494140625, -0.0226898193359375, 0.01155853271484375, 0.04705810546875, -0.025604248046875, 0.025543212890625, 0.012908935546875, -0.01544189453125, 0.0272369384765625, 0.005340576171875, 0.03485107421875, 0.037139892578125, 0.0026607513427734375, 0.016998291015625, 0.009613037109375, 0.005779266357421875, 0.035247802734375, 0.023162841796875, 0.0263671875, 0.02752685546875, -0.046966552734375, 0.01247406005859375, -0.01526641845703125, -0.055267333984375, -0.00621795654296875, 0.01290130615234375, -0.00841522216796875, -0.034576416015625, -0.034759521484375, 0.01226806640625, 0.0158538818359375, -0.0236053466796875, -0.019317626953125, -0.04046630859375, 0.033935546875, -0.016143798828125, -0.0175323486328125, 0.0328369140625, -0.002605438232421875, -0.0192718505859375, -0.00907135009765625, -0.0443115234375, -0.0034656524658203125, -0.0003261566162109375, -0.0078582763671875, -0.0177001953125, -0.023101806640625, -0.025360107421875, 0.0014486312866210938, 0.044647216796875, 0.00418853759765625, -0.0267791748046875, 0.005588531494140625, 0.029205322265625, -0.01428985595703125, -0.00943756103515625, -0.0445556640625, -0.00662994384765625, 0.047332763671875, 0.0241851806640625, 0.027069091796875, 0.0145721435546875, 0.0162353515625, 5.2869319915771484e-05, 0.0364990234375, 0.02825927734375, 0.07586669921875, 0.0023708343505859375, 0.004131317138671875, 0.013397216796875, 0.0181121826171875, -0.02130126953125, 0.043975830078125, -0.021697998046875, -0.01229095458984375, 0.01520538330078125, -0.0138092041015625, -0.0249481201171875, 0.06268310546875, 0.004150390625, 0.0161590576171875, 0.04498291015625, -0.0092926025390625, 0.0156707763671875, -0.022430419921875, -0.012481689453125, 0.04217529296875, -0.01473236083984375, -0.005138397216796875, -0.0199432373046875, -0.017974853515625, 0.03411865234375, -0.037506103515625, 0.01404571533203125, -0.006366729736328125, -0.0067901611328125, -0.0004639625549316406, 0.059844970703125, -0.0270843505859375, 0.005657196044921875, -0.0180511474609375, -0.02801513671875, 0.0225372314453125, -0.0114898681640625, -0.0352783203125, 0.0003943443298339844, -0.0244140625, -0.02001953125, 0.0135650634765625, -0.0552978515625, -0.0338134765625, 0.04449462890625, 0.0078887939453125, 0.01873779296875, -0.02783203125, -0.00897979736328125, -0.0340576171875, 0.032073974609375, 0.02532958984375, -0.002941131591796875, 0.039581298828125, 0.04534912109375, 0.00899505615234375, -0.039764404296875, 0.0033779144287109375, -0.0008459091186523438, -0.013702392578125, -0.037200927734375]; #[rustfmt::skip] -static NAVER_SPLADE_WEATHER_EMB: &'static [f32] = &[-0.0302734375, 0.038116455078125, -0.043975830078125, -0.0220489501953125, -0.01222991943359375, -0.08197021484375, 0.00858306884765625, 0.0128631591796875, 0.015777587890625, -0.0178680419921875, -0.024383544921875, 0.0139312744140625, 0.01702880859375, -0.00618743896484375, -0.005901336669921875, 0.0037975311279296875, 0.04437255859375, -0.01349639892578125, -0.005107879638671875, -0.056182861328125, 0.00760650634765625, -0.003814697265625, -0.051849365234375, 0.004695892333984375, 0.03424072265625, 0.00885009765625, -0.037506103515625, 0.01158905029296875, 0.0313720703125, 0.03399658203125, 0.005374908447265625, 0.0182952880859375, 0.0011968612670898438, -0.036712646484375, -0.032470703125, -0.0255126953125, 0.00438690185546875, -0.004108428955078125, -0.03179931640625, 0.02093505859375, 0.03790283203125, -0.0279541015625, 0.0299224853515625, 0.0193939208984375, -0.02056884765625, -0.051025390625, -0.0220794677734375, -0.0028514862060546875, -0.006351470947265625, -0.0290374755859375, -0.0014963150024414062, 0.0125579833984375, 0.02691650390625, 0.0008153915405273438, 0.016845703125, 0.0210723876953125, 0.03271484375, -0.0028533935546875, -0.07733154296875, -0.0183563232421875, -0.042266845703125, -0.039703369140625, -0.0011186599731445312, 0.0176239013671875, 0.006710052490234375, 0.1258544921875, 0.045867919921875, 0.003917694091796875, -0.01441192626953125, -0.0207672119140625, -0.0026607513427734375, 0.0164337158203125, -0.004024505615234375, 0.0027065277099609375, -0.048797607421875, 0.001293182373046875, -0.0223236083984375, 0.01056671142578125, -0.006748199462890625, 0.0283660888671875, 0.07781982421875, -0.007335662841796875, 0.02581787109375, -0.0147857666015625, 0.020294189453125, 0.0753173828125, -0.0139923095703125, 0.009246826171875, -0.0280609130859375, -0.0189056396484375, -0.059478759765625, 0.01477813720703125, -0.017242431640625, -0.078369140625, -0.0166015625, 0.000881195068359375, -0.045562744140625, 0.00732421875, 0.0248870849609375, 0.0058135986328125, 0.02593994140625, 0.005031585693359375, -0.01039886474609375, -0.03369140625, -0.011810302734375, -0.019561767578125, 0.03326416015625, 0.01229095458984375, -0.0023651123046875, 0.01209259033203125, 0.060150146484375, 0.07421875, 0.05950927734375, 0.00435638427734375, -0.010040283203125, -0.0014905929565429688, -0.0286102294921875, -0.04693603515625, -0.035186767578125, 0.00785064697265625, -0.0265960693359375, 0.0404052734375, 0.0306854248046875, -0.0174407958984375, -0.0301666259765625, -0.0183563232421875, 0.01375579833984375, 0.0693359375, 0.018890380859375, 0.03594970703125, 0.01849365234375, 0.01282501220703125, -0.03118896484375, 0.017120361328125, 0.0082550048828125, 0.01517486572265625, 0.0086517333984375, 0.01409149169921875, 0.019317626953125, -0.0219268798828125, -0.00797271728515625, 0.033416748046875, -0.0211181640625, -0.016571044921875, 0.0313720703125, -0.039306640625, 0.01371002197265625, -0.01666259765625, -0.0007023811340332031, -0.04486083984375, 0.0194244384765625, -0.0235443115234375, 0.006008148193359375, 0.0198211669921875, -0.0145721435546875, -0.0020389556884765625, -0.0167999267578125, 0.05157470703125, -0.04705810546875, 0.01151275634765625, 0.06036376953125, -0.0034389495849609375, -0.06805419921875, 0.004863739013671875, 0.023162841796875, 0.026641845703125, 0.01641845703125, 0.006740570068359375, -0.00841522216796875, 0.0283355712890625, -0.01499176025390625, -0.02691650390625, 0.048980712890625, -0.01197052001953125, 0.034027099609375, 0.0248870849609375, 0.048248291015625, 0.007354736328125, -0.0178680419921875, -0.004581451416015625, -0.0401611328125, 0.0021228790283203125, 0.0247650146484375, -0.0223541259765625, -0.02008056640625, 0.0579833984375, -0.0009570121765136719, -0.03961181640625, -0.0026092529296875, -0.005107879638671875, -0.01544952392578125, -0.0194549560546875, 0.01392364501953125, -0.0039825439453125, 0.06768798828125, -0.006626129150390625, 0.0257415771484375, -0.01445770263671875, -0.019805908203125, -0.0218353271484375, -0.039398193359375, 0.01751708984375, 0.0394287109375, 0.0251617431640625, -0.0167999267578125, -0.019317626953125, -0.0518798828125, -0.026702880859375, 0.0068511962890625, -0.0291900634765625, 0.00018906593322753906, -0.017181396484375, 0.01360321044921875, -0.004970550537109375, -0.037322998046875, 0.01458740234375, -0.00884246826171875, 0.041046142578125, 0.00710296630859375, 0.017791748046875, -0.0152740478515625, 0.0289154052734375, -0.01137542724609375, -0.0176544189453125, 0.034271240234375, 0.0245819091796875, 0.016387939453125, 0.0137786865234375, -0.051849365234375, -0.021575927734375, -0.01348114013671875, 0.037841796875, -0.035369873046875, -0.0139923095703125, 0.045928955078125, -0.039215087890625, -0.0654296875, 0.01467132568359375, -0.0161590576171875, 0.041595458984375, -0.01317596435546875, -0.0142822265625, -0.0192718505859375, -0.00572967529296875, -0.0213623046875, 0.011871337890625, 0.025726318359375, -0.00473785400390625, -0.0188140869140625, 0.0101165771484375, 0.03631591796875, -0.040771484375, -0.033782958984375, 0.00498199462890625, 0.0249786376953125, 0.0209503173828125, 0.01123809814453125, -0.00934600830078125, -0.007183074951171875, 0.018890380859375, 0.033294677734375, -0.024749755859375, 0.012451171875, 0.048980712890625, 0.02044677734375, -0.00548553466796875, -0.00408172607421875, 0.00595855712890625, 0.0215606689453125, -0.041259765625, -0.0150146484375, 0.0051727294921875, -0.029296875, 0.0108489990234375, 0.0208740234375, -0.007389068603515625, 0.005466461181640625, -0.0241851806640625, 0.019866943359375, -0.01995849609375, 0.01335906982421875, -0.003383636474609375, 0.001789093017578125, 0.024871826171875, 0.005340576171875, 0.0016880035400390625, -0.003246307373046875, 0.0161895751953125, 0.0008058547973632812, -0.05682373046875, -0.0003190040588378906, -0.0220489501953125, 0.050750732421875, -0.019134521484375, 0.01611328125, 0.0225372314453125, -0.01291656494140625, -0.1832275390625, 0.024322509765625, -0.0036258697509765625, -0.020233154296875, 0.0021381378173828125, -0.01336669921875, -0.0201568603515625, -0.007965087890625, 0.005916595458984375, -0.037872314453125, -0.02337646484375, -0.0282135009765625, -0.001556396484375, 0.024017333984375, 0.00310516357421875, -0.01474761962890625, 0.03515625, -0.032501220703125, 0.018524169921875, -0.07659912109375, 0.041015625, -0.00949859619140625, 0.042388916015625, -0.0252532958984375, -0.0171966552734375, 0.023956298828125, 0.012939453125, -0.0006246566772460938, -0.03155517578125, -0.0183563232421875, 0.00791168212890625, 0.031707763671875, -0.0257568359375, 0.003749847412109375, 0.040191650390625, 0.0123291015625, 0.0125579833984375, -0.0214080810546875, -0.05487060546875, 0.0176544189453125, -0.004924774169921875, 0.0292816162109375, -0.03204345703125, 0.052490234375, 0.01629638671875, -0.035064697265625, -0.0004096031188964844, -0.0110321044921875, 0.027557373046875, -0.00476837158203125, 0.0118560791015625, 0.0253753662109375, 0.034912109375, 0.006488800048828125, -0.038421630859375, 0.031097412109375, -0.02001953125, 0.053466796875, -0.03399658203125, 0.0282135009765625, -0.05145263671875, -0.036102294921875, 0.0230255126953125, 0.0299530029296875, 0.01092529296875, 0.029754638671875, 0.0185394287109375, 0.0236053466796875, 0.023162841796875, -0.032745361328125, 0.007427215576171875, 0.0167083740234375, -0.026458740234375, -0.038360595703125, 0.0419921875, 0.041107177734375, -0.02227783203125, -0.037017822265625, -0.0164642333984375, -0.11956787109375, 0.00489044189453125, -0.0186767578125, 0.01043701171875, -0.0225067138671875, -0.0236358642578125, -0.0419921875, 0.0214691162109375, 0.0269317626953125, 0.039703369140625, 0.255615234375, 0.0218505859375, 0.01059722900390625, -0.025787353515625, 0.03277587890625, -0.034271240234375, -0.0127716064453125, -0.00890350341796875, 0.003208160400390625, -0.052764892578125, -0.0238800048828125, -0.01107025146484375, -0.026885986328125, 0.013916015625, -0.017303466796875, 0.00527191162109375, -0.026947021484375, -0.0128326416015625, 0.039581298828125, 0.0025119781494140625, 0.0009703636169433594, 0.002872467041015625, 0.0109710693359375, -0.010894775390625, -0.03289794921875, -0.06390380859375, 0.018829345703125, 0.0294342041015625, 0.034393310546875, -0.008514404296875, -0.0157623291015625, 0.0180511474609375, -0.0029163360595703125, -0.0190277099609375, -0.00897216796875, 0.01045989990234375, -0.0020046234130859375, -0.0015077590942382812, 0.00768280029296875, 0.01238250732421875, 0.002597808837890625, -0.0177154541015625, 0.04241943359375, -0.008544921875, 0.031982421875, -0.009124755859375, 0.0027904510498046875, -0.0372314453125, -0.0391845703125, -0.0253753662109375, -0.02276611328125, -0.0180206298828125, -0.049652099609375, 0.02642822265625, -0.0172882080078125, -0.039154052734375, -0.02020263671875, -0.0195770263671875, 0.045562744140625, 0.0118408203125, -0.027984619140625, 0.0196533203125, -0.0005540847778320312, -0.040740966796875, 0.031494140625, 0.03228759765625, 0.00884246826171875, -0.03216552734375, 0.00788116455078125, -0.0151519775390625, -0.00295257568359375, -0.0239410400390625, -0.0247955322265625, 0.027130126953125, 0.0017690658569335938, -0.002704620361328125, -0.01293182373046875, 0.04779052734375, -0.0009331703186035156, 0.059295654296875, -0.0081939697265625, -0.0030498504638671875, -0.05511474609375, 0.0195465087890625, -0.003490447998046875, -0.015655517578125, 0.05548095703125, 0.042510986328125, 0.05322265625, -0.0511474609375, 0.10284423828125, 0.0193939208984375, -0.04229736328125, 0.0183868408203125, 0.02105712890625, -0.05401611328125, 0.0174102783203125, -0.003551483154296875, 0.0107574462890625, 0.0153656005859375, -0.03082275390625, -0.0036163330078125, 0.02374267578125, -0.003841400146484375, 0.0255279541015625, -0.0006742477416992188, 0.0023097991943359375, -0.015960693359375, 0.01611328125, 0.0095367431640625, -0.01161956787109375, 0.00274658203125, -0.01560211181640625, 0.012237548828125, 0.028472900390625, 0.054351806640625, 0.02056884765625, 0.0055389404296875, -0.007419586181640625, -0.0002682209014892578, -0.0264434814453125, -0.0153045654296875, 0.03155517578125, -0.0185089111328125, 0.01541900634765625, -0.004100799560546875, 0.007843017578125, 0.020294189453125, -0.015625, 0.0479736328125, -0.02001953125, -0.017181396484375, -0.029266357421875, 0.006313323974609375, 0.0555419921875, -0.0013027191162109375, 0.06134033203125, 0.0347900390625, -0.033935546875, 0.09393310546875, 0.031768798828125, -0.046783447265625, -0.01488494873046875, -0.03155517578125, 0.007568359375, 0.0082855224609375, 0.006805419921875, 2.3066997528076172e-05, -0.05157470703125, -0.039215087890625, 0.004619598388671875, 0.0117340087890625, 0.032684326171875, -0.026031494140625, -0.00139617919921875, -0.036590576171875, -0.02532958984375, -0.04632568359375, -0.0042724609375, -0.0198516845703125, -0.01311492919921875, 0.0117034912109375, 0.0245513916015625, 0.1156005859375, 0.045989990234375, 0.0149993896484375, -0.012298583984375, 0.06298828125, 0.03271484375, -0.020599365234375, 0.01273345947265625, 0.0167694091796875, -0.0287322998046875, 0.00940704345703125, -0.00830078125, -0.0001074075698852539, 0.0118560791015625, -0.0189208984375, -0.03375244140625, 0.038421630859375, 0.037933349609375, -0.015869140625, 0.0079803466796875, 0.05950927734375, 0.00199127197265625, 0.0303497314453125, -0.0112152099609375, -0.0203857421875, 0.03759765625, -0.01146697998046875, -0.0200958251953125, 0.07568359375, 0.0288238525390625, 0.0084381103515625, 0.053741455078125, 0.042816162109375, 0.0012493133544921875, 0.0255889892578125, -0.009063720703125, -0.055755615234375, -0.01476287841796875, -0.0322265625, -0.0014667510986328125, 0.0071563720703125, 0.0162506103515625, -0.03411865234375, -0.0082244873046875, -0.0176239013671875, 0.003326416015625, 0.017608642578125, 0.00039887428283691406, -0.053680419921875, -0.01561737060546875, -0.0181121826171875, -0.03863525390625, 0.02081298828125, -0.015472412109375, 0.0117340087890625, -0.00760650634765625, 0.00835418701171875, -0.0256195068359375, -0.0005774497985839844, 0.09393310546875, -0.04156494140625, 0.011871337890625, 0.036102294921875, -0.035888671875, -0.00839996337890625, -0.0216522216796875, 0.03179931640625, 0.00446319580078125, 0.0188751220703125, -0.00533294677734375, -0.00438690185546875, 0.007602691650390625, 0.0093994140625, -0.00667572021484375, 0.03375244140625, -0.036529541015625, 0.0262908935546875, 0.003108978271484375, -0.0007534027099609375, 0.0472412109375, 0.044219970703125, 0.0132904052734375, 0.04345703125, -0.035552978515625, 0.037139892578125, 0.00567626953125, 0.032135009765625, -0.021697998046875, 0.031524658203125, 0.0372314453125, 0.021270751953125, -0.03594970703125, 0.0382080078125, 0.006237030029296875, 0.043426513671875, -0.0250091552734375, -0.01213836669921875, -0.0117645263671875, 0.06097412109375, 0.0027923583984375, 0.03277587890625, -0.01056671142578125, -0.0596923828125, 0.0277252197265625, -0.007122039794921875, -0.049591064453125, -0.019073486328125, -0.013153076171875, 0.0007843971252441406, -0.0202789306640625, -0.017242431640625, -0.052978515625, 0.034759521484375, -0.0240478515625, 0.0599365234375, -0.02978515625, 0.027618408203125, -0.049163818359375, 0.0638427734375, -0.021148681640625, 0.029266357421875, -0.042022705078125, 0.01003265380859375, -0.0166778564453125, -0.01509857177734375, 0.01425933837890625, -0.0038356781005859375, 0.01392364501953125, -0.0174407958984375, -0.034271240234375, -0.0013513565063476562, 0.01177978515625, 0.01666259765625, -0.0254364013671875, 0.041259765625, -0.0274810791015625, 0.0309906005859375, -0.04345703125, 0.0267333984375, -0.0274200439453125, 0.01050567626953125, -0.019683837890625, 0.01885986328125, 0.008148193359375, 0.01751708984375, 0.03546142578125, -0.0175933837890625, 0.01275634765625, -0.0158538818359375, -0.0220794677734375, -0.0165863037109375, 0.01361846923828125, -0.0210723876953125, 0.041717529296875, -0.053131103515625, -0.06512451171875, -0.0008492469787597656, 0.02044677734375, 0.00811004638671875, 0.00572967529296875, -0.0230712890625, -0.0280609130859375, -0.03411865234375, -0.036834716796875, 0.0033054351806640625, -0.046905517578125, -0.0088348388671875, -0.046844482421875, 0.0022258758544921875, -0.0116424560546875, -0.0277862548828125, -0.00025963783264160156, -0.042388916015625, 0.0215606689453125, 0.0155181884765625, 0.057373046875, -0.06341552734375, -0.0198822021484375, 0.08282470703125, -0.0207061767578125, -0.055572509765625, 0.0282745361328125, -0.040252685546875, -0.00269317626953125, 0.0042266845703125, 0.00079345703125, 0.01435089111328125, 0.006916046142578125, 0.026214599609375, -0.0494384765625, -0.0232391357421875, 0.0109100341796875, 0.014923095703125, -0.02764892578125, -0.0062713623046875, 0.046539306640625, 0.0238037109375, -0.035919189453125, 0.054473876953125, -0.01467132568359375, 0.018218994140625, 0.0024929046630859375, 0.0165252685546875, -0.0374755859375, -0.012542724609375, 0.01708984375, 0.0247955322265625, -0.044281005859375, 0.0771484375, 0.0254058837890625, -0.003955841064453125, -0.0312042236328125, 0.0264892578125, -0.0007429122924804688, -0.0117645263671875, -0.0245513916015625, 0.06414794921875, -0.01151275634765625, -0.007602691650390625, -0.0175018310546875, -0.019378662109375, -0.0153045654296875, -0.00719451904296875, -0.00495147705078125, 0.0019178390502929688, 0.0230255126953125, -0.0263214111328125, -0.06048583984375, -0.00400543212890625, -0.05596923828125, -0.00972747802734375, -0.171875, 0.06939697265625, 0.0113372802734375, -0.0181884765625, -0.017974853515625, 0.03900146484375, -0.07781982421875, 0.0242462158203125, -0.0151519775390625, -0.042449951171875, -0.02545166015625, 0.0072174072265625, 0.00223541259765625, -0.0223388671875, 0.0002415180206298828, 0.0086669921875, -0.006351470947265625, -0.00966644287109375, 0.01155853271484375, 0.048553466796875, -0.00969696044921875, -0.017059326171875, 0.008758544921875, -0.005817413330078125, -0.028839111328125, -0.020721435546875, -0.0125274658203125, 0.0292510986328125, -0.0285491943359375, -0.0068511962890625, 0.0244140625, -0.06756591796875, 0.017730712890625, 0.0265045166015625, 0.0162353515625, -0.002307891845703125, -0.006977081298828125, -0.03204345703125, 0.0234222412109375, 0.0006399154663085938, -0.0171966552734375, 0.024017333984375, -0.03594970703125, 0.019866943359375, -0.0148468017578125, 0.042510986328125, -0.020172119140625, -0.032958984375, -0.04632568359375, 0.0123748779296875, -0.04229736328125, 0.005725860595703125, -0.006103515625, 0.0191497802734375, 0.005886077880859375, 0.006999969482421875, -0.0338134765625, 0.02630615234375, 0.0258331298828125, -0.0007495880126953125, -0.0198516845703125, 0.018585205078125, -0.045074462890625, -0.0301666259765625, -0.0689697265625, 0.00890350341796875, -0.093017578125, 0.006084442138671875, 0.0181884765625, -0.0085601806640625, -0.04608154296875, -0.043426513671875, 0.00707244873046875, 0.05023193359375, -0.004985809326171875, 0.005847930908203125, 0.00415802001953125, -0.0438232421875, -0.03668212890625, 0.0010824203491210938, -0.01169586181640625, 0.046478271484375, -0.07177734375, -0.005828857421875, -0.01294708251953125, -0.017669677734375, -0.005802154541015625, -0.049652099609375, -0.031494140625, -0.0131378173828125, -0.059967041015625, -0.023681640625, -0.041412353515625, 0.0272064208984375, -0.042755126953125, 0.009307861328125, -0.01544189453125, -0.00862884521484375, -0.01268768310546875, 0.00890350341796875, 0.003856658935546875, -0.01502227783203125, -0.0167236328125, 0.0009589195251464844, -0.0116729736328125, 0.0008640289306640625, -0.00965118408203125, 0.004512786865234375, 0.0161285400390625, 0.03033447265625, -0.007083892822265625, -0.0286865234375, -0.016387939453125, 0.019500732421875, -0.0169525146484375, 8.809566497802734e-05, 0.0119781494140625, -0.0226898193359375, 0.01155853271484375, 0.04705810546875, -0.025604248046875, 0.025543212890625, 0.012908935546875, -0.01544189453125, 0.0272369384765625, 0.005340576171875, 0.03485107421875, 0.037139892578125, 0.0026607513427734375, 0.016998291015625, 0.009613037109375, 0.005779266357421875, 0.035247802734375, 0.023162841796875, 0.0263671875, 0.02752685546875, -0.046966552734375, 0.01247406005859375, -0.01526641845703125, -0.055267333984375, -0.00621795654296875, 0.01290130615234375, -0.00841522216796875, -0.034576416015625, -0.034759521484375, 0.01226806640625, 0.0158538818359375, -0.0236053466796875, -0.019317626953125, -0.04046630859375, 0.033935546875, -0.016143798828125, -0.0175323486328125, 0.0328369140625, -0.002605438232421875, -0.0192718505859375, -0.00907135009765625, -0.0443115234375, -0.0034656524658203125, -0.0003261566162109375, -0.0078582763671875, -0.0177001953125, -0.023101806640625, -0.025360107421875, 0.0014486312866210938, 0.044647216796875, 0.00418853759765625, -0.0267791748046875, 0.005588531494140625, 0.029205322265625, -0.01428985595703125, -0.00943756103515625, -0.0445556640625, -0.00662994384765625, 0.047332763671875, 0.0241851806640625, 0.027069091796875, 0.0145721435546875, 0.0162353515625, 5.2869319915771484e-05, 0.0364990234375, 0.02825927734375, 0.07586669921875, 0.0023708343505859375, 0.004131317138671875, 0.013397216796875, 0.0181121826171875, -0.02130126953125, 0.043975830078125, -0.021697998046875, -0.01229095458984375, 0.01520538330078125, -0.0138092041015625, -0.0249481201171875, 0.06268310546875, 0.004150390625, 0.0161590576171875, 0.04498291015625, -0.0092926025390625, 0.0156707763671875, -0.022430419921875, -0.012481689453125, 0.04217529296875, -0.01473236083984375, -0.005138397216796875, -0.0199432373046875, -0.017974853515625, 0.03411865234375, -0.037506103515625, 0.01404571533203125, -0.006366729736328125, -0.0067901611328125, -0.0004639625549316406, 0.059844970703125, -0.0270843505859375, 0.005657196044921875, -0.0180511474609375, -0.02801513671875, 0.0225372314453125, -0.0114898681640625, -0.0352783203125, 0.0003943443298339844, -0.0244140625, -0.02001953125, 0.0135650634765625, -0.0552978515625, -0.0338134765625, 0.04449462890625, 0.0078887939453125, 0.01873779296875, -0.02783203125, -0.00897979736328125, -0.0340576171875, 0.032073974609375, 0.02532958984375, -0.002941131591796875, 0.039581298828125, 0.04534912109375, 0.00899505615234375, -0.039764404296875, 0.0033779144287109375, -0.0008459091186523438, -0.013702392578125, -0.037200927734375]; +static NAVER_SPLADE_WEATHER_SPARSE_EMB: &'static [(usize, f32)] = &[(2088, 0.28771225), (2129, 0.9312368), (2190, 0.28448454), (2256, 0.5041775), (2651, 2.7279792), (2739, 0.032302722), (2747, 1.7856611), (3011, 0.31048822), (3235, 0.20604336), (3267, 0.11327132), (3533, 0.20181733), (3673, 0.26471457), (4040, 0.058463056), (4633, 2.827633), (4658, 1.6096209), (4785, 0.4811845), (5584, 0.047277514), (6426, 1.0341775), (6798, 0.22048862), (7150, 0.46029332), (7216, 0.2927392), (7483, 0.82230353), (8404, 0.5025483), (9274, 0.6042912), (9401, 0.6061753), (12609, 0.051170446), (19939, 0.102231756)]; +#[rustfmt::skip] +static NAVER_SPLADE_PATIENT_SPARSE_EMB: &'static [(usize, f32)] = &[(1020, 0.041309584), (1040, 1.5417866), (1048, 1.3557662), (1049, 0.3775021), (1051, 0.89734447), (1999, 2.0451355), (2002, 0.17984374), (2012, 1.073997), (2014, 1.4994998), (2016, 2.08151), (2018, 0.9145711), (2046, 0.9706971), (2053, 0.056598417), (2099, 1.5206765), (2132, 0.43383548), (2138, 0.12806885), (2152, 0.11314986), (2157, 1.2825925), (2181, 0.23048699), (2185, 1.0739967), (2187, 1.5742918), (2213, 1.3249351), (2217, 1.0920199), (2232, 0.7768289), (2312, 1.4103423), (2322, 0.45585966), (2331, 1.1580951), (2351, 1.255407), (2363, 0.09213605), (2389, 0.0042046006), (2443, 0.53870404), (2450, 0.15875669), (2497, 1.2879237), (2504, 0.6794201), (2522, 1.1683196), (2539, 1.7450188), (2540, 1.5145847), (2555, 1.5113934), (2648, 0.26690102), (2666, 1.3343524), (2668, 0.4144269), (2684, 0.6269125), (2752, 0.06628819), (2756, 0.6236148), (2771, 0.011420707), (2777, 0.09874316), (2792, 0.1436687), (2819, 0.6217213), (2852, 1.162901), (2860, 1.9258868), (2890, 0.5510644), (2902, 1.6880273), (2922, 0.47709396), (2966, 0.6718608), (2979, 0.6218683), (3025, 0.20729996), (3086, 1.2316883), (3231, 0.33621803), (3255, 0.24191417), (3280, 1.0911756), (3295, 0.41381595), (3303, 0.90596426), (3378, 0.23599426), (3401, 0.8878892), (3406, 1.1184609), (3413, 0.13064817), (3424, 0.99557996), (3426, 0.78298295), (3439, 0.49302888), (3446, 0.59279966), (3466, 0.32299122), (3508, 0.52924377), (3522, 0.18705243), (3597, 0.62955135), (3637, 1.4933461), (3728, 1.2340063), (3798, 0.9520479), (3814, 0.46391538), (3870, 0.07335934), (3883, 0.25344864), (3949, 1.6461214), (4028, 0.04367159), (4098, 0.55171466), (4167, 1.4930902), (4265, 0.9929553), (4295, 0.9682118), (4297, 0.8515034), (4330, 0.87209713), (4432, 0.053165164), (4458, 1.0299637), (4540, 0.2270346), (4544, 0.6987088), (4574, 0.8326699), (4634, 0.23642962), (4655, 1.0767487), (4698, 0.27318498), (4850, 0.19189483), (4914, 1.7846932), (5022, 1.093754), (5032, 0.16179664), (5043, 0.3922801), (5057, 0.41142985), (5175, 0.17926498), (5213, 0.97530216), (5256, 0.043337405), (5294, 0.3132897), (5358, 0.012236524), (5360, 0.1916735), (5400, 0.48401824), (5432, 1.4293725), (5457, 1.6345547), (5458, 0.61136776), (5505, 0.78658783), (5736, 0.30055565), (5776, 1.4092501), (5790, 0.17843717), (5845, 0.7908384), (5970, 0.70940226), (6073, 0.07253249), (6253, 0.10365032), (6327, 1.7519335), (6330, 0.41181213), (6423, 0.2170124), (6535, 0.4154059), (6593, 0.6151579), (6615, 0.41167715), (6678, 0.76947063), (6724, 1.9677677), (6757, 1.5301301), (6874, 0.13556015), (6909, 2.3402507), (6954, 0.030338654), (7077, 0.18032046), (7233, 0.9798352), (7242, 0.6998478), (7277, 0.75431246), (7354, 0.004628184), (7393, 1.2923343), (7438, 1.0372545), (7628, 0.32868323), (7673, 0.5024982), (7709, 0.5117906), (7710, 0.15253112), (7859, 0.075344376), (7865, 0.39351076), (7934, 0.9386492), (8015, 0.52813447), (8030, 1.6422433), (8072, 0.4290198), (8292, 0.8721977), (8319, 1.3865776), (8323, 1.2063395), (8490, 1.4040864), (8571, 0.17623426), (8657, 0.0053368006), (8715, 1.0177497), (8755, 0.11181828), (8764, 0.56292474), (8778, 0.35673863), (8805, 0.045057587), (8830, 0.7558736), (8940, 0.26758552), (8948, 0.026373712), (8980, 1.5163237), (9113, 0.31280112), (9318, 0.27384886), (9342, 0.74288166), (9423, 0.33516476), (9468, 0.48588187), (9513, 1.097622), (9524, 0.3809803), (9606, 0.2675795), (9634, 1.2116815), (9740, 0.30335796), (9851, 0.042954464), (9869, 0.45898816), (9961, 1.330059), (10012, 0.19604073), (10047, 0.6881188), (10089, 0.0070818835), (10148, 0.5758423), (10254, 0.044571213), (10360, 0.06501511), (10611, 0.045851555), (10771, 0.29407746), (10882, 1.5643686), (10941, 0.23341057), (11192, 0.51246506), (11199, 0.13835645), (11236, 0.49782053), (11325, 1.9039752), (11425, 0.07187426), (11556, 0.5331669), (11616, 0.5376696), (11792, 0.39309195), (11889, 0.45735893), (11968, 1.6334108), (11987, 1.8925784), (12475, 1.2467035), (12609, 0.44208318), (12657, 0.00933402), (12818, 0.47628683), (13004, 0.7425836), (13112, 0.018361827), (13158, 0.022297863), (13226, 0.07201338), (13341, 0.005630586), (13441, 1.3256856), (13614, 0.3182399), (13656, 0.0147532895), (13692, 1.9425251), (13800, 0.5091878), (14072, 0.08704364), (14332, 1.2272519), (14374, 0.21606566), (14412, 0.01901657), (14482, 1.6318302), (14652, 0.697061), (14667, 0.91734934), (14693, 1.6455672), (14849, 1.2026675), (14942, 0.54393), (14956, 0.40959123), (14971, 2.0475144), (15035, 0.50855315), (15050, 0.58802366), (15301, 0.14068563), (15321, 0.6142908), (15568, 1.7563155), (15575, 0.25764084), (15935, 0.51003236), (16147, 1.0881017), (16464, 0.73331034), (16506, 1.7604095), (16571, 0.4838466), (16675, 0.69926816), (17056, 1.2809677), (17080, 0.150894), (17119, 0.10398171), (17132, 0.67962474), (17258, 2.3221157), (17261, 1.3571649), (17327, 1.7082412), (17404, 0.7076204), (17623, 0.20189136), (18020, 0.085387684), (18439, 0.94607544), (18479, 1.615265), (18490, 0.22143397), (18583, 1.9848719), (18609, 0.2705029), (18634, 0.89279324), (18714, 0.07363569), (18834, 1.2752538), (18979, 1.3809063), (19029, 0.42363095), (19458, 0.12099789), (19857, 0.08728674), (19960, 0.7136091), (20111, 0.043510903), (20207, 0.12250601), (20310, 7.188062e-05), (20382, 1.7504561), (20536, 0.024032824), (20992, 0.016757438), (21325, 0.36605594), (21683, 0.12094148), (21700, 1.3879802), (21833, 0.21840249), (21887, 1.0367882), (21890, 0.9655698), (21901, 0.5432414), (21908, 0.12249789), (22084, 0.59794855), (22935, 0.9143078), (23270, 1.409052), (23332, 0.14446634), (23350, 1.0437652), (23736, 1.13134), (24054, 0.61954427), (24117, 0.019038325), (24735, 0.13828315), (24848, 0.42456576), (25032, 0.094976686), (26204, 0.77807146), (26641, 0.3490585), (27144, 0.34857348), (27211, 2.5081944), (27339, 0.80834943), (27532, 0.8641034), (27843, 0.17690799), (28697, 1.104347)]; + +fn create_sparse_vector(base: &[(usize, f32)], dim: usize) -> Vec { + let mut result = Vec::with_capacity(dim); + for i in 0..dim { + let entry = base.iter().find(|&x| x.0 == i); + if let Some(val) = entry { + result.push(val.1); + } else { + result.push(0.0); + } + } + + result +} fn cosine_similarity(v1: &[f32], v2: &[f32]) -> f32 { // Check if the vectors have the same length @@ -58,7 +74,7 @@ macro_rules! text_embedding_test { #[test] fn $name() { let runtime = get_runtime(&Runtime::Ort, None, r#"{"data_path": "/tmp/lantern-embeddings-core-test"}"#).unwrap(); - let (model, input, expected, batch_size, token_count) = $value; + let (model, input, expected, batch_size, token_count, tolerance) = $value; let inputs = itertools::repeat_n(input, batch_size).collect(); let output = runtime.process( model, @@ -72,7 +88,7 @@ macro_rules! text_embedding_test { assert_eq!(output.processed_tokens, token_count); for i in 0..expected_output.len() { let distance = 1.0 - cosine_similarity(&embeddings[i], &expected_output[i]); - assert!(distance < 0.01); + assert!(distance < tolerance); } } )* @@ -85,7 +101,7 @@ macro_rules! text_embedding_test_multiple { #[test] fn $name() { let runtime = get_runtime(&Runtime::Ort, None, r#"{"data_path": "/tmp/lantern-embeddings-core-test"}"#).unwrap(); - let (model, input1, input2, expected1, expected2, batch_size, token_count) = $value; + let (model, input1, input2, expected1, expected2, batch_size, token_count, tolerance) = $value; let mut inputs = Vec::with_capacity(batch_size); let mut expected_output = Vec::with_capacity(batch_size); @@ -109,7 +125,7 @@ macro_rules! text_embedding_test_multiple { assert_eq!(output.processed_tokens, token_count); for i in 0..expected_output.len() { let distance = 1.0 - cosine_similarity(&embeddings[i], &expected_output[i]); - assert!(distance < 0.01); + assert!(distance < tolerance); } } )* @@ -117,22 +133,26 @@ macro_rules! text_embedding_test_multiple { } text_embedding_test! { - generate_clip_embeddings_small_text_single: ("clip/ViT-B-32-textual", HELLO_WORLD_TEXT, HELLO_WORLD_CLIP_EMB.to_vec(), 1, 77), - generate_clip_embeddings_small_text_batch: ("clip/ViT-B-32-textual", HELLO_WORLD_TEXT, HELLO_WORLD_CLIP_EMB.to_vec(), 10, 770), - generate_clip_embeddings_large_text_single: ("clip/ViT-B-32-textual", LOREM_TEXT, LOREM_CLIP_EMB.to_vec(), 1, 77), - generate_clip_embeddings_large_text_batch: ("clip/ViT-B-32-textual", LOREM_TEXT, LOREM_CLIP_EMB.to_vec(), 50, 3850), - generate_bge_embeddings_small_text_single: ("BAAI/bge-small-en", HELLO_WORLD_TEXT, HELLO_WORLD_BGE_SMALL_EMB.to_vec(), 1, 5), - generate_bge_embeddings_small_text_batch: ("BAAI/bge-small-en", HELLO_WORLD_TEXT, HELLO_WORLD_BGE_SMALL_EMB.to_vec(), 100, 500), - generate_bge_embeddings_large_text_single: ("BAAI/bge-small-en", LOREM_TEXT, LOREM_BGE_SMALL_EMB.to_vec(), 1, 439), - generate_bge_embeddings_large_text_batch: ("BAAI/bge-small-en", LOREM_TEXT, LOREM_BGE_SMALL_EMB.to_vec(), 100, 43900), - generate_bge_embeddings_m3_text_single: ("BAAI/bge-m3", BGE_M3_TEXT, BGE_M3_EMB.to_vec(), 1, 31), - generate_jina_small_embeddings_small_text_single: ("jinaai/jina-embeddings-v2-small-en", WEATHER_TEXT, WEATHER_JINA_SMALL_EMB.to_vec(), 1, 8), - generate_jina_base_embeddings_small_text_single: ("jinaai/jina-embeddings-v2-base-en", WEATHER_TEXT, WEATHER_JINA_BASE_EMB.to_vec(), 1, 8), - generate_jina_base_embeddings_small_text_batch: ("jinaai/jina-embeddings-v2-base-en", WEATHER_TEXT, WEATHER_JINA_BASE_EMB.to_vec(), 30, 240), - generate_naver_spladev3_embeddings_small_text_single: ("naver/splade-v3", WEATHER_TEXT, WEATHER_JINA_BASE_EMB.to_vec(), 1, 8), + generate_clip_embeddings_small_text_single: ("clip/ViT-B-32-textual", HELLO_WORLD_TEXT, HELLO_WORLD_CLIP_EMB.to_vec(), 1, 77, 0.01), + generate_clip_embeddings_small_text_batch: ("clip/ViT-B-32-textual", HELLO_WORLD_TEXT, HELLO_WORLD_CLIP_EMB.to_vec(), 10, 770, 0.01), + generate_clip_embeddings_large_text_single: ("clip/ViT-B-32-textual", LOREM_TEXT, LOREM_CLIP_EMB.to_vec(), 1, 77, 0.01), + generate_clip_embeddings_large_text_batch: ("clip/ViT-B-32-textual", LOREM_TEXT, LOREM_CLIP_EMB.to_vec(), 50, 3850, 0.01), + generate_bge_embeddings_small_text_single: ("BAAI/bge-small-en", HELLO_WORLD_TEXT, HELLO_WORLD_BGE_SMALL_EMB.to_vec(), 1, 5, 0.01), + generate_bge_embeddings_small_text_batch: ("BAAI/bge-small-en", HELLO_WORLD_TEXT, HELLO_WORLD_BGE_SMALL_EMB.to_vec(), 100, 500, 0.01), + generate_bge_embeddings_large_text_single: ("BAAI/bge-small-en", LOREM_TEXT, LOREM_BGE_SMALL_EMB.to_vec(), 1, 439, 0.01), + generate_bge_embeddings_large_text_batch: ("BAAI/bge-small-en", LOREM_TEXT, LOREM_BGE_SMALL_EMB.to_vec(), 100, 43900, 0.01), + generate_bge_embeddings_m3_text_single: ("BAAI/bge-m3", BGE_M3_TEXT, BGE_M3_EMB.to_vec(), 1, 31, 0.01), + generate_jina_small_embeddings_small_text_single: ("jinaai/jina-embeddings-v2-small-en", WEATHER_TEXT, WEATHER_JINA_SMALL_EMB.to_vec(), 1, 8, 0.01), + generate_jina_base_embeddings_small_text_single: ("jinaai/jina-embeddings-v2-base-en", WEATHER_TEXT, WEATHER_JINA_BASE_EMB.to_vec(), 1, 8, 0.01), + generate_jina_base_embeddings_small_text_batch: ("jinaai/jina-embeddings-v2-base-en", WEATHER_TEXT, WEATHER_JINA_BASE_EMB.to_vec(), 30, 240, 0.01), + generate_naver_spladev3_embeddings_small_text_single: ("naver/splade-v3", WEATHER_TEXT, create_sparse_vector(NAVER_SPLADE_WEATHER_SPARSE_EMB, 30522), 1, 8, 0.03), + generate_naver_spladev3_embeddings_small_text_batch: ("naver/splade-v3", WEATHER_TEXT, create_sparse_vector(NAVER_SPLADE_WEATHER_SPARSE_EMB, 30522), 30, 240, 0.03), + generate_naver_spladev3_embeddings_large_text_single: ("naver/splade-v3", PATIENT_EMB_TEXT, create_sparse_vector(NAVER_SPLADE_PATIENT_SPARSE_EMB, 30522), 1, 128, 0.03), + generate_naver_spladev3_embeddings_large_text_batch: ("naver/splade-v3", PATIENT_EMB_TEXT, create_sparse_vector(NAVER_SPLADE_PATIENT_SPARSE_EMB, 30522), 30, 3840, 0.03), } text_embedding_test_multiple! { - generate_jina_base_embeddings_large_text_batch_multiple: ("jinaai/jina-embeddings-v2-base-en", PATIENT_EMB_TEXT, WEATHER_TEXT, PATIENT_JINA_BASE_EMB.to_vec(), WEATHER_JINA_BASE_EMB.to_vec(), 10, 1380), - generate_bge_m3_embeddings_large_text_batch_multiple: ("BAAI/bge-m3", PATIENT_EMB_TEXT, WEATHER_TEXT, PATIENT_BGE_M3_EMB.to_vec(), BGE_M3_WEATHER_EMB.to_vec(), 10, 1430), + generate_jina_base_embeddings_large_text_batch_multiple: ("jinaai/jina-embeddings-v2-base-en", PATIENT_EMB_TEXT, WEATHER_TEXT, PATIENT_JINA_BASE_EMB.to_vec(), WEATHER_JINA_BASE_EMB.to_vec(), 10, 1380, 0.01), + generate_bge_m3_embeddings_large_text_batch_multiple: ("BAAI/bge-m3", PATIENT_EMB_TEXT, WEATHER_TEXT, PATIENT_BGE_M3_EMB.to_vec(), BGE_M3_WEATHER_EMB.to_vec(), 10, 1430, 0.01), + generate_naver_spladev3_embeddings_large_text_batch_multiple: ("naver/splade-v3", PATIENT_EMB_TEXT, WEATHER_TEXT, create_sparse_vector(NAVER_SPLADE_PATIENT_SPARSE_EMB, 30522), create_sparse_vector(NAVER_SPLADE_WEATHER_SPARSE_EMB, 30522), 10, 1280, 0.03), } diff --git a/lantern_extras/Cargo.toml b/lantern_extras/Cargo.toml index 85cb4ca..43b1a71 100644 --- a/lantern_extras/Cargo.toml +++ b/lantern_extras/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lantern_extras" -version = "0.2.0" +version = "0.2.1" edition = "2021" [lib]