diff --git a/.github/workflows/publish-cli-docker.yaml b/.github/workflows/publish-cli-docker.yaml index 2d5f9b7..59e7c7b 100644 --- a/.github/workflows/publish-cli-docker.yaml +++ b/.github/workflows/publish-cli-docker.yaml @@ -11,7 +11,7 @@ on: type: string description: "CLI version" required: true - default: "0.3.1" + default: "0.3.2" IMAGE_NAME: type: string description: "Container image name to tag" diff --git a/README.md b/README.md index 613b86f..6d35ba4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Lantern Extras +[![build](https://github.com/lanterndata/lantern_extras/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/lanterndata/lantern_extras/actions/workflows/build.yaml) +[![test](https://github.com/lanterndata/lantern_extras/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/lanterndata/lantern_extras/actions/workflows/test.yaml) +[![codecov](https://codecov.io/github/lanterndata/lantern_extras/branch/main/graph/badge.svg)](https://codecov.io/github/lanterndata/lantern_extras) + This extension makes it easy to experiment with embeddings from inside a Postgres database. We use this extension along with [Lantern](https://github.com/lanterndata/lantern) to make vector operations performant. But all the helpers here are standalone and may be used without the main database. **NOTE**: Functions defined in this extension use Postgres in ways Postgres is usually not used. 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 48d5347..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()), @@ -258,7 +305,8 @@ lazy_static! { ("microsoft/all-mpnet-base-v2", ModelInfoBuilder::new("https://huggingface.co/varik77/onnx-models/resolve/main/microsoft/all-mpnet-base-v2").with_tokenizer(true).build()), ("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()) + ("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).with_pooling_strategy(PoolingStrategy::ReluLogMaxPooling).build()) ])); } @@ -722,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(", ") ) } @@ -743,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"); @@ -773,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, @@ -787,7 +837,6 @@ impl<'a> OrtRuntime<'a> { match encoder { Ok(enc) => model_info.encoder = Some(enc), Err(err) => { - drop(map_write); anyhow::bail!(err) } } @@ -891,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; @@ -978,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; } @@ -995,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/src/embeddings/mod.rs b/lantern_cli/src/embeddings/mod.rs index f81bf7c..edbe49f 100644 --- a/lantern_cli/src/embeddings/mod.rs +++ b/lantern_cli/src/embeddings/mod.rs @@ -440,6 +440,7 @@ pub fn get_default_batch_size(model: &str) -> usize { "thenlper/gte-base" => 1000, "thenlper/gte-large" => 800, "microsoft/all-MiniLM-L12-v2" => 1000, + "naver/splade-v3" => 1000, "microsoft/all-mpnet-base-v2" => 400, "transformers/multi-qa-mpnet-base-dot-v1" => 300, "openai/text-embedding-ada-002" => 500, diff --git a/lantern_cli/tests/text_embedding_test.rs b/lantern_cli/tests/text_embedding_test.rs index 888abc9..23b01d1 100644 --- a/lantern_cli/tests/text_embedding_test.rs +++ b/lantern_cli/tests/text_embedding_test.rs @@ -29,6 +29,24 @@ static BGE_M3_TEXT: &'static str = "BGE M3 is an embedding model supporting dens static BGE_M3_EMB: &'static [f32] = &[-0.00014090538024902344, -0.06671142578125, -4.8160552978515625e-05, -0.02728271484375, -0.00983428955078125, -0.048553466796875, 0.03125, -0.003574371337890625, -0.00585174560546875, -0.011077880859375, -0.0540771484375, -0.003131866455078125, 0.0400390625, 0.0152435302734375, -0.0012798309326171875, -0.0305633544921875, -0.0146331787109375, -0.038543701171875, 0.0295867919921875, -0.0108642578125, -0.03125, -0.00815582275390625, 0.03155517578125, -0.01221466064453125, 0.0157470703125, 0.0175018310546875, -0.0007448196411132812, 0.01230621337890625, -0.018646240234375, 0.001117706298828125, -0.00766754150390625, 0.02264404296875, 0.035888671875, -0.0166015625, -0.0028896331787109375, -0.0187530517578125, 0.0162506103515625, 0.00838470458984375, -0.0390625, 0.00931549072265625, -0.01415252685546875, 0.0282745361328125, 0.027557373046875, 0.00887298583984375, -0.0273895263671875, -0.035736083984375, -0.005523681640625, -0.0199432373046875, -0.0149078369140625, -0.03973388671875, 0.0009469985961914062, 0.00525665283203125, -0.0017766952514648438, 0.0235748291015625, -0.0247039794921875, 0.0306549072265625, -0.047576904296875, 0.020416259765625, -0.049957275390625, -0.0477294921875, -0.012298583984375, 0.061676025390625, 0.003261566162109375, 0.0012292861938476562, 0.0017557144165039062, 0.0394287109375, -0.03460693359375, 0.050811767578125, -0.019989013671875, -0.03680419921875, -0.01187896728515625, 0.0240936279296875, -0.042877197265625, 0.00666046142578125, -0.0875244140625, 0.033935546875, 0.0044403076171875, -0.0007991790771484375, -0.0204315185546875, 0.0008831024169921875, -0.00823974609375, -0.0401611328125, -0.0003116130828857422, -0.007587432861328125, -0.03759765625, 0.040374755859375, -0.0099945068359375, 0.0024871826171875, -0.01451873779296875, 0.005954742431640625, -0.02593994140625, 0.04229736328125, -0.0191650390625, -0.071044921875, -0.050628662109375, 0.0467529296875, -0.011322021484375, 0.0164947509765625, 0.034088134765625, 0.03082275390625, -0.0123291015625, 0.017608642578125, 0.019805908203125, 0.045654296875, 9.02414321899414e-05, -0.034149169921875, 0.025970458984375, 0.034027099609375, -0.02667236328125, -0.0274658203125, 0.0077667236328125, -0.0250396728515625, 0.01244354248046875, 0.0135345458984375, -0.01195526123046875, -0.043731689453125, -0.06378173828125, 0.00469207763671875, -4.607439041137695e-05, 0.0124359130859375, 0.02880859375, 0.004985809326171875, 0.0496826171875, -0.039154052734375, -0.0180206298828125, -0.05517578125, 0.0241546630859375, 0.0418701171875, 0.043731689453125, -0.0271453857421875, -0.0269317626953125, 0.033172607421875, -0.0443115234375, -0.03533935546875, -1.7940998077392578e-05, -0.06451416015625, -0.00909423828125, 0.0311431884765625, 0.0234375, -0.03955078125, 0.0237579345703125, 0.037109375, -0.0229949951171875, -0.034088134765625, 0.0447998046875, -0.0203704833984375, 0.01044464111328125, -0.0004706382751464844, -0.00974273681640625, -0.043731689453125, -0.0080413818359375, 0.0033397674560546875, -0.057281494140625, 0.02960205078125, 0.0211029052734375, -0.0256195068359375, -0.01349639892578125, 0.018829345703125, -0.0249786376953125, 0.03802490234375, -0.0190582275390625, -0.01432037353515625, -0.01508331298828125, -0.0418701171875, 0.0286865234375, 0.0286407470703125, 0.029052734375, 0.07275390625, 0.016265869140625, -0.04705810546875, 0.0269622802734375, 0.016143798828125, 0.048614501953125, 0.0272216796875, 0.044708251953125, 0.014373779296875, 0.06976318359375, 0.0005822181701660156, 0.0209503173828125, -0.022247314453125, -0.0149993896484375, -0.006000518798828125, -0.0008802413940429688, -0.04827880859375, -0.006649017333984375, 0.037841796875, -0.050048828125, -0.058502197265625, 0.00797271728515625, 0.031463623046875, -0.028289794921875, -0.01078033447265625, 0.05535888671875, -0.001903533935546875, 0.04705810546875, -0.004486083984375, -0.003337860107421875, -0.042327880859375, 0.033477783203125, -0.029510498046875, 0.0212554931640625, 0.017913818359375, 0.0214385986328125, -0.027557373046875, -0.0161590576171875, -0.00022995471954345703, -0.0190582275390625, -0.040313720703125, -0.008636474609375, -0.0699462890625, -0.0167083740234375, 0.039337158203125, 0.0079498291015625, 0.0228424072265625, -0.031341552734375, -0.0152435302734375, 0.0174102783203125, 0.0241851806640625, -0.00527191162109375, -0.0162200927734375, -0.0264434814453125, 0.0082550048828125, 0.037872314453125, 0.01444244384765625, -0.0301055908203125, -0.0465087890625, 0.0250396728515625, 0.010467529296875, 0.005748748779296875, -0.03997802734375, -0.0194854736328125, 0.0032978057861328125, -0.0297393798828125, -0.0116424560546875, 0.037078857421875, -0.0223388671875, 0.004108428955078125, 0.00695037841796875, 0.040374755859375, -0.004993438720703125, -0.0274658203125, -0.0282440185546875, -0.0030059814453125, -0.01837158203125, -0.02301025390625, 0.0073699951171875, -0.004085540771484375, 0.05230712890625, -0.0202789306640625, -0.0231781005859375, 3.731250762939453e-05, -0.0164794921875, -0.05035400390625, -0.0117034912109375, 0.019989013671875, -0.020111083984375, -0.01421356201171875, 0.01375579833984375, 0.0079193115234375, -0.00887298583984375, 0.03924560546875, 0.0043487548828125, 0.00785064697265625, 0.0281219482421875, 0.0101165771484375, -0.0247650146484375, 0.025177001953125, -0.028472900390625, -0.02301025390625, 0.0350341796875, -0.0216217041015625, -0.0261993408203125, 0.0172119140625, -0.006389617919921875, 0.004901885986328125, 0.03082275390625, -0.02728271484375, -0.0496826171875, 0.039154052734375, -0.005474090576171875, -0.03216552734375, 0.0045318603515625, -0.01708984375, -0.007259368896484375, 0.041473388671875, -0.032257080078125, -0.01788330078125, -0.029937744140625, -0.004138946533203125, -0.0792236328125, -0.0005354881286621094, 0.0180511474609375, 0.029937744140625, -0.01465606689453125, -0.02935791015625, 0.0225067138671875, -0.0250701904296875, -0.1417236328125, 0.004711151123046875, -0.0109405517578125, -0.023345947265625, 0.021148681640625, -0.013275146484375, -0.056610107421875, 0.0223541259765625, -0.043365478515625, 0.038848876953125, -0.01861572265625, -0.046112060546875, -0.0087738037109375, -0.01485443115234375, 0.0211639404296875, 0.0045928955078125, 0.02679443359375, 0.03363037109375, -0.0246734619140625, -0.012176513671875, -0.0259246826171875, -0.04803466796875, 0.053619384765625, 0.03253173828125, -0.004207611083984375, -0.02313232421875, 0.0302734375, 0.015869140625, 0.00438690185546875, -0.0122528076171875, -0.01532745361328125, 0.048309326171875, 0.00656890869140625, 0.048095703125, -0.0111541748046875, 0.037689208984375, -0.0298614501953125, -0.0071563720703125, -0.01067352294921875, -0.0008864402770996094, -0.00572967529296875, 0.0242462158203125, -0.0275726318359375, 0.082763671875, -0.02374267578125, -0.03375244140625, 0.030364990234375, 0.03564453125, -0.05328369140625, -0.01180267333984375, -0.025421142578125, 0.00421905517578125, 0.01132965087890625, -0.01371002197265625, -0.0517578125, 0.00026297569274902344, 0.006626129150390625, 0.03082275390625, 0.022247314453125, -0.003673553466796875, -0.0032196044921875, 0.0166015625, 0.0304718017578125, 0.0284576416015625, -0.060516357421875, -0.037017822265625, 0.07611083984375, -0.040679931640625, 0.0081939697265625, -0.03857421875, 0.043914794921875, -0.0019521713256835938, -0.0125732421875, -0.022674560546875, 0.01456451416015625, 0.053863525390625, -0.05535888671875, -0.01059722900390625, 0.010772705078125, -0.07135009765625, -0.023223876953125, -0.01471710205078125, -0.002346038818359375, 0.006343841552734375, 0.0253753662109375, 0.0214691162109375, 0.00627899169921875, 0.0106201171875, 0.00487518310546875, 0.2152099609375, 0.05511474609375, -0.0007410049438476562, -0.0179443359375, 0.0142974853515625, 0.020416259765625, 0.0062103271484375, 0.025421142578125, 0.026702880859375, -0.0206451416015625, 0.012481689453125, -0.0094451904296875, 0.030548095703125, 0.01303863525390625, -0.034698486328125, 0.052337646484375, -0.0272369384765625, -0.00875091552734375, 0.056671142578125, -0.0154571533203125, -0.015625, 0.0196990966796875, -0.0120697021484375, 0.048980712890625, -0.0170135498046875, -0.0211029052734375, 0.0396728515625, 0.0296783447265625, -0.0162353515625, 0.051116943359375, -0.01535797119140625, -0.01187896728515625, 0.02459716796875, 0.0165252685546875, -0.017303466796875, -0.0245361328125, -0.03936767578125, 0.0050201416015625, 0.007282257080078125, 0.094482421875, -0.00972747802734375, 0.00632476806640625, -0.037078857421875, 0.055877685546875, -0.0272369384765625, -0.025390625, 0.0182037353515625, -0.03955078125, 0.01401519775390625, 0.01047515869140625, -0.00905609130859375, -0.031280517578125, 0.05078125, 0.01274871826171875, 0.006130218505859375, 0.058837890625, -0.055633544921875, 0.0190277099609375, -7.295608520507812e-05, 0.0311279296875, 0.03411865234375, -0.0020809173583984375, -0.06719970703125, -0.00658416748046875, -0.0005335807800292969, -0.019622802734375, 0.06744384765625, 0.049896240234375, 0.066650390625, 0.031402587890625, 0.01418304443359375, 0.064208984375, -0.0237274169921875, 0.027374267578125, 0.04345703125, 0.018463134765625, 0.0132598876953125, -0.00994873046875, -0.00775146484375, 0.03668212890625, -0.007732391357421875, -0.05438232421875, -0.003570556640625, 0.0007047653198242188, -0.0012378692626953125, -0.032501220703125, -0.033477783203125, 0.0191802978515625, -0.002834320068359375, -0.0352783203125, -0.0162353515625, -0.0033397674560546875, -0.006748199462890625, -0.0096435546875, 0.00283050537109375, -0.01102447509765625, -0.01015472412109375, -0.0201263427734375, -0.017364501953125, 0.0099945068359375, -0.01141357421875, -0.052337646484375, 0.049346923828125, -0.033355712890625, 0.0003802776336669922, 0.010284423828125, -0.00036215782165527344, -0.027130126953125, 0.004222869873046875, 0.006195068359375, 0.01174163818359375, 0.038055419921875, -0.00197601318359375, -0.005069732666015625, -0.00498199462890625, 0.01326751708984375, -0.049041748046875, -0.004909515380859375, 0.004302978515625, -0.0215911865234375, 0.0177154541015625, -0.004055023193359375, -0.045135498046875, 0.0017061233520507812, -0.006366729736328125, -0.02178955078125, 0.0269622802734375, 0.0235137939453125, 0.01044464111328125, 0.02740478515625, 0.02203369140625, -0.01067352294921875, 0.025543212890625, -0.0018949508666992188, 0.036163330078125, 0.0129547119140625, -0.026153564453125, -0.00618743896484375, 0.0161895751953125, 0.00299835205078125, -0.0182342529296875, 0.0170135498046875, -0.01313018798828125, 0.01178741455078125, -0.04522705078125, 0.017181396484375, 0.005802154541015625, 0.0228118896484375, -0.015777587890625, 0.0236053466796875, -0.00495147705078125, 0.03857421875, 0.02093505859375, -0.040557861328125, -0.0162506103515625, -0.0379638671875, -0.022125244140625, -0.0215301513671875, 0.0341796875, -0.01259613037109375, -0.00021910667419433594, -0.005146026611328125, 0.005039215087890625, 0.04779052734375, -0.05548095703125, 0.0460205078125, 0.0276641845703125, 0.030914306640625, 0.022918701171875, -0.04571533203125, -0.0013074874877929688, -0.00246429443359375, -0.0117034912109375, 0.047393798828125, -0.02142333984375, 0.00460052490234375, 0.00240325927734375, -0.0261077880859375, 0.0182647705078125, 0.0161285400390625, 0.0202484130859375, -0.020904541015625, -0.0013723373413085938, 0.0283355712890625, -0.01432037353515625, 0.0197906494140625, -0.0027027130126953125, 0.00335693359375, 0.043121337890625, -0.0048980712890625, 0.01458740234375, 0.0748291015625, -0.0509033203125, 0.0106353759765625, 0.0245819091796875, -0.006809234619140625, 0.01360321044921875, -0.031341552734375, 0.0003108978271484375, -0.0416259765625, 0.0289459228515625, -0.027313232421875, 0.029815673828125, -0.0187225341796875, 0.03314208984375, -0.0278472900390625, -0.046630859375, -0.006557464599609375, 0.02301025390625, -0.0133819580078125, 0.00878143310546875, -0.008331298828125, -0.06854248046875, 0.0248870849609375, -0.020416259765625, -0.035491943359375, -0.003978729248046875, -0.03717041015625, -0.024658203125, 0.0003123283386230469, 0.0372314453125, 0.005428314208984375, 0.006458282470703125, -0.0270843505859375, -0.0268096923828125, -0.0112457275390625, 0.01806640625, -0.038543701171875, -0.0362548828125, 0.06396484375, 0.00016319751739501953, 0.01515960693359375, -0.0465087890625, -0.037506103515625, 0.0065155029296875, 0.04229736328125, -0.01515960693359375, 0.034027099609375, -0.038665771484375, -0.01312255859375, 0.0059661865234375, -0.0091552734375, 0.003864288330078125, 0.0679931640625, -0.00943756103515625, -0.020416259765625, -0.027069091796875, 0.038055419921875, 0.072021484375, -0.03411865234375, -0.008026123046875, -0.01128387451171875, 0.044464111328125, -0.031646728515625, 0.022674560546875, -0.007293701171875, -0.0050048828125, 0.0177001953125, 0.00513458251953125, -0.0106048583984375, -0.00714874267578125, 0.0106201171875, -0.00925445556640625, 0.0174713134765625, -0.0214691162109375, -0.025054931640625, 0.015106201171875, -0.0140380859375, -0.01345062255859375, -0.031280517578125, -0.0192413330078125, -0.060546875, -0.031829833984375, -0.06451416015625, 0.029083251953125, -0.0285186767578125, -0.002826690673828125, 0.0106658935546875, 0.004566192626953125, 0.057586669921875, -0.042938232421875, 0.037109375, -0.004322052001953125, -0.01003265380859375, -0.041778564453125, -0.03387451171875, 0.00492095947265625, -0.005382537841796875, 0.033233642578125, -0.04669189453125, 0.043792724609375, 0.0256500244140625, -0.0343017578125, -0.035125732421875, -0.031585693359375, 0.029754638671875, -0.047332763671875, 0.059661865234375, -0.0298309326171875, -0.05816650390625, -0.035003662109375, 0.0223541259765625, 0.00687408447265625, 0.036651611328125, -0.009246826171875, -0.01441192626953125, -0.0005908012390136719, -0.0169219970703125, 0.062469482421875, 0.035430908203125, 0.00011718273162841797, 0.0214996337890625, -0.0196990966796875, -0.00728607177734375, 0.0099029541015625, 0.02362060546875, 0.0242156982421875, -0.018829345703125, -0.01123809814453125, 0.0092010498046875, 0.006198883056640625, 0.03643798828125, -0.0207366943359375, -0.004123687744140625, -0.0160064697265625, -0.040496826171875, -0.01348876953125, -0.0025959014892578125, -0.020050048828125, -0.033966064453125, -0.0226898193359375, -0.0718994140625, -0.0294036865234375, -0.005321502685546875, 0.0156707763671875, 0.028350830078125, 0.0213623046875, 0.009857177734375, 0.035736083984375, 0.0157623291015625, 0.004314422607421875, -0.0066680908203125, 0.065673828125, -0.0301666259765625, 0.01497650146484375, -0.0127410888671875, 0.00330352783203125, -0.006298065185546875, 0.01512908935546875, -0.05328369140625, 0.011810302734375, 0.030059814453125, 0.001384735107421875, -0.041656494140625, -0.00555419921875, -0.031158447265625, -0.017913818359375, 0.07391357421875, 0.05841064453125, -0.0102996826171875, -0.016265869140625, 0.0181427001953125, 0.004840850830078125, 0.031280517578125, 0.00946044921875, 0.052642822265625, 0.0361328125, -0.054931640625, 0.04498291015625, -0.0775146484375, -0.01213836669921875, 0.005702972412109375, -0.02362060546875, 0.036529541015625, 0.0195159912109375, 0.0215606689453125, 0.0244293212890625, 0.0160369873046875, 0.01342010498046875, 0.02423095703125, 0.006031036376953125, -0.04412841796875, 0.002429962158203125, -0.0243988037109375, 0.01535797119140625, -0.0467529296875, -0.014678955078125, 0.003154754638671875, -0.034271240234375, 0.040283203125, 0.0026073455810546875, 0.04168701171875, -0.037841796875, -0.0166015625, -0.1256103515625, 0.0235443115234375, 0.01409149169921875, 0.0198974609375, -0.059173583984375, -0.01511383056640625, -0.010772705078125, -0.01520538330078125, 0.00479888916015625, -0.03240966796875, -0.0228424072265625, 0.025909423828125, 0.0638427734375, -0.0294189453125, 0.0127410888671875, 0.004512786865234375, 0.0017023086547851562, -0.06884765625, 0.033477783203125, 0.06805419921875, 0.010711669921875, 0.020294189453125, 0.050628662109375, 0.00799560546875, -0.0179290771484375, -0.01690673828125, -0.002681732177734375, 0.027130126953125, -0.035430908203125, 0.005489349365234375, -0.002864837646484375, -0.03509521484375, 0.00891876220703125, 0.058135986328125, 0.041900634765625, 0.00399017333984375, 0.01546478271484375, -0.032379150390625, 0.003765106201171875, 0.021728515625, 0.048004150390625, 0.0134735107421875, 0.013336181640625, 0.0217132568359375, -0.02679443359375, 0.04449462890625, -0.0007519721984863281, -0.0005450248718261719, -0.0259246826171875, 0.024871826171875, 0.019317626953125, 0.034942626953125, -0.0458984375, 0.00768280029296875, -0.0102081298828125, -0.03338623046875, -0.043701171875, -0.0325927734375, -0.00846099853515625, -0.01082611083984375, -0.049835205078125, 0.003398895263671875, -0.0018978118896484375, -0.01215362548828125, -0.04119873046875, 0.00250244140625, -0.00765228271484375, -0.00963592529296875, 0.02215576171875, 0.04779052734375, -0.004192352294921875, 0.0263824462890625, 0.0006999969482421875, -0.06829833984375, -0.01259613037109375, 0.0416259765625, 0.047088623046875, -0.01959228515625, -0.0166778564453125, -0.019805908203125, -0.043487548828125, -0.024444580078125, 0.01447296142578125, 0.0165557861328125, 0.0230865478515625, -0.0404052734375, -0.040435791015625, 0.03656005859375, -0.043365478515625, 0.017120361328125, -0.035125732421875, -0.0255584716796875, 0.000728607177734375, -0.04278564453125, -0.083740234375, 0.0286407470703125, -0.0302886962890625, -0.0210113525390625, -0.0118255615234375, -0.042938232421875, -0.01708984375, 0.00859832763671875, -0.044158935546875, 0.0494384765625, 0.005237579345703125, 0.036346435546875, 0.0225677490234375, -0.023529052734375, 0.06597900390625, 0.03692626953125, 0.0111236572265625, -0.01568603515625, 0.0158538818359375, 0.011810302734375, -0.04046630859375, 0.01776123046875, 0.004756927490234375, 0.0056304931640625, -0.0584716796875, 0.0310516357421875, 0.035400390625, 0.0103607177734375, -0.0290069580078125, -0.038360595703125, -0.0179901123046875, 0.03369140625, 0.013641357421875, -0.01085662841796875, 0.0161895751953125, -0.028106689453125, 0.051788330078125, -0.06524658203125, -0.04058837890625, 0.0404052734375, 0.06414794921875, 0.0069732666015625, -0.0184326171875, 0.034942626953125, -0.0187530517578125, -0.035552978515625, 0.004810333251953125, -0.0369873046875, -0.01483154296875, -0.00466156005859375, -0.00231170654296875, 0.02294921875, -0.061920166015625, -0.0177001953125, -0.0521240234375, -0.01445770263671875, 0.01007080078125, 0.0032863616943359375, -0.0037441253662109375, 0.01421356201171875, 0.0259857177734375, 0.01739501953125, -0.041961669921875, 0.004161834716796875, -0.0694580078125, 0.04571533203125, 0.01151275634765625, -0.03704833984375, -0.0160369873046875, -0.0018663406372070312, -0.05230712890625, -0.0016012191772460938, -0.0008454322814941406, 0.0178375244140625, -0.0017852783203125, -0.006999969482421875, 0.035858154296875, 0.035491943359375, -0.01171875, -0.031890869140625, 0.037017822265625, -0.0137481689453125, -0.0063018798828125, 0.01195526123046875, 0.019989013671875, -0.032257080078125, 0.03997802734375, 0.04656982421875, 0.00415802001953125, 0.037322998046875, 0.0050048828125, 0.04364013671875, -0.01079559326171875, 0.041534423828125, 0.04345703125, 0.0167388916015625, 0.039764404296875, -0.0294342041015625, 0.040283203125, 0.01488494873046875, 0.040863037109375, 0.065185546875, 0.021331787109375, 0.0043182373046875, -0.044586181640625, 0.072021484375, -0.0767822265625, 0.006092071533203125, 0.0011777877807617188, -0.0316162109375, -0.0325927734375, -0.04290771484375, -0.054473876953125, -0.03729248046875, -0.0245361328125, -0.01474761962890625, -0.01001739501953125, 0.0246124267578125, -0.0268707275390625, 0.0274200439453125, 0.033599853515625, -0.0296478271484375, 0.0650634765625, -0.04827880859375, 0.0567626953125, 0.03863525390625, -0.0245819091796875, 0.0163726806640625, 0.0299072265625, 0.0038166046142578125, -0.0474853515625, -0.0116119384765625, 0.01537322998046875, 0.0208587646484375, 0.002048492431640625, -0.01448822021484375, -0.04571533203125, 0.00396728515625, 0.0166778564453125, 0.04278564453125, 0.0005140304565429688, -0.0024738311767578125, 0.0213470458984375, 0.0140838623046875, 0.02191162109375, -0.039581298828125, 0.0159759521484375, 0.0430908203125, -0.0213470458984375, 0.0137481689453125]; #[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_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 @@ -56,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, @@ -70,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); } } )* @@ -83,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); @@ -107,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); } } )* @@ -115,21 +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_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]