diff --git a/Cargo.lock b/Cargo.lock index 22ad1ee7..feac1f6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4481,9 +4481,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokenizers" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e500fad1dd3af3d626327e6a3fe5050e664a6eaa4708b8ca92f1794aaf73e6fd" +checksum = "9ecededfed68a69bc657e486510089e255e53c3d38cc7d4d59c8742668ca2cae" dependencies = [ "aho-corasick", "derive_builder", diff --git a/Cargo.toml b/Cargo.toml index 8c4a4726..84e581c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ hf-hub = { version = "0.3.2", features = ["tokio", "online"], default-features = metrics = "0.23" nohash-hasher = "0.2" num_cpus = "1.16.0" -tokenizers = { version = "0.19.1", default-features = false, features = ["onig", "esaxx_fast"] } +tokenizers = { version = "0.21.0", default-features = false, features = ["onig", "esaxx_fast"] } tokio = { version = "1.25", features = ["rt", "rt-multi-thread", "parking_lot", "sync", "signal"] } tracing = "0.1" serde = { version = "1.0", features = ["serde_derive"] } diff --git a/backends/candle/src/lib.rs b/backends/candle/src/lib.rs index d3c8f831..44566fdb 100644 --- a/backends/candle/src/lib.rs +++ b/backends/candle/src/lib.rs @@ -383,25 +383,6 @@ impl CandleBackend { FlashQwen2Model::load(vb, &config, model_type).s()?, )) } - #[cfg(feature = "cuda")] - (Config::ModernBert(config), Device::Cuda(_)) => { - if cfg!(feature = "flash-attn") - && dtype == DType::F16 - && &std::env::var("USE_FLASH_ATTENTION") - .unwrap_or("True".to_string()) - .to_lowercase() - == "true" - { - return Err(BackendError::Start( - "ModernBert does not support flash attention".to_string(), - )); - } - - tracing::info!("Starting ModernBert model on {:?}", device); - Ok(Box::new( - ModernBERTModel::load(vb, &config, model_type).s()?, - )) - } }; Ok(Self { diff --git a/backends/candle/src/models/modernbert.rs b/backends/candle/src/models/modernbert.rs index 9e1a1f74..afdef81f 100644 --- a/backends/candle/src/models/modernbert.rs +++ b/backends/candle/src/models/modernbert.rs @@ -255,7 +255,6 @@ impl ModernBertAttention { let attn_weights = query_layer.matmul(&key_layer.t()?)?; let attn_weights = (attn_weights * self.softmax_scale)?; let attn_weights = attn_weights.add(attention_mask)?; - let attn_weights = candle_nn::ops::softmax_last_dim(&attn_weights)?; attn_weights.matmul(&value_layer.contiguous()?) }?; @@ -277,7 +276,7 @@ struct ModernBertEncoderLayer { impl ModernBertEncoderLayer { pub fn load(vb: VarBuilder, index: usize, config: &ModernBertConfig) -> Result { - let attn_norm = if index > 0 { + let attn_norm = if index != 0 { Some(LayerNorm::load( vb.pp("attn_norm"), config.hidden_size, @@ -316,20 +315,23 @@ impl ModernBertEncoderLayer { ) -> Result { let _enter = self.span.enter(); - let mut hidden_states = hidden_states.clone(); + let residual = hidden_states.clone(); - if let Some(attn_norm) = &self.attn_norm { - hidden_states = attn_norm.forward(&hidden_states, None)?; - } + let attn_norm = if let Some(attn_norm) = &self.attn_norm { + attn_norm.forward(hidden_states, None)? + } else { + hidden_states.clone() + }; + + let attn_outputs = self.attn.forward(&attn_norm, attention_mask, cos, sin)?; + + let hidden_states = residual.add(&attn_outputs)?; - let hidden_states = self - .attn - .forward(&hidden_states, attention_mask, cos, sin)?; let mlp_output = self .mlp .forward(&self.mlp_norm.forward(&hidden_states, None)?)?; - hidden_states.broadcast_add(&mlp_output) + hidden_states.add(&mlp_output) } } @@ -714,22 +716,17 @@ impl ModernBertModel { }; let pooled_embeddings = match self.pool { - // CLS pooling Pool::Cls => outputs.i((.., 0))?, - // Last token pooling is not supported for this model Pool::LastToken | Pool::Splade => unreachable!(), - // Mean pooling Pool::Mean => { if let Some(ref attention_mask) = attention_mask { let mut attention_mask = attention_mask.clone(); if let Some(pooled_indices) = pooled_indices { - // Select values in the batch attention_mask = attention_mask.index_select(&pooled_indices, 0)?; input_lengths = input_lengths.index_select(&pooled_indices, 0)?; }; - // Mask padded values outputs = outputs.broadcast_mul(&attention_mask)?; } @@ -742,7 +739,6 @@ impl ModernBertModel { }; let raw_embeddings = if has_raw_requests { - // Reshape outputs let (b, l, h) = outputs.shape().dims3()?; let outputs = outputs.reshape((b * l, h))?; diff --git a/backends/candle/tests/common.rs b/backends/candle/tests/common.rs index 0c069a47..71cfdc8b 100644 --- a/backends/candle/tests/common.rs +++ b/backends/candle/tests/common.rs @@ -197,7 +197,7 @@ pub fn load_tokenizer(model_root: &Path) -> Result { // We are forced to clone since `Tokenizer` does not have a `get_mut` for `pre_tokenizer` let mut m = m.clone(); m.set_prepend_scheme(PrependScheme::First); - tokenizer.with_pre_tokenizer(PreTokenizerWrapper::Metaspace(m)); + tokenizer.with_pre_tokenizer(Some(PreTokenizerWrapper::Metaspace(m))); } else if let PreTokenizerWrapper::Sequence(s) = pre_tokenizer { let pre_tokenizers = s.get_pre_tokenizers(); // Check if we have a Metaspace pre tokenizer in the sequence @@ -222,9 +222,9 @@ pub fn load_tokenizer(model_root: &Path) -> Result { } new_pre_tokenizers.push(pre_tokenizer); } - tokenizer.with_pre_tokenizer(PreTokenizerWrapper::Sequence(Sequence::new( + tokenizer.with_pre_tokenizer(Some(PreTokenizerWrapper::Sequence(Sequence::new( new_pre_tokenizers, - ))); + )))); } } } diff --git a/backends/candle/tests/snapshots/test_modernbert__mini_batch.snap b/backends/candle/tests/snapshots/test_modernbert__mini_batch.snap new file mode 100644 index 00000000..2c902545 --- /dev/null +++ b/backends/candle/tests/snapshots/test_modernbert__mini_batch.snap @@ -0,0 +1,2308 @@ +--- +source: backends/candle/tests/test_modernbert.rs +expression: embeddings_batch +--- +- - 0.34938118 + - -0.5106107 + - -0.33724675 + - -0.14377546 + - 0.42295066 + - 0.080605514 + - -0.05870054 + - -0.2533736 + - 0.096805826 + - 0.47147986 + - -0.30220082 + - -0.062287323 + - -0.5335452 + - -0.5569252 + - 0.1152873 + - 0.26499018 + - -0.20333672 + - 0.62200534 + - 0.37650678 + - 0.2355279 + - 0.48994657 + - -0.19641218 + - 0.3926499 + - 0.040974297 + - 0.048504103 + - 0.068754695 + - 0.074077256 + - 0.15591288 + - 0.43299398 + - 0.30289072 + - -0.11739186 + - -1.0685385 + - 0.34381604 + - -0.36778787 + - 0.42416957 + - 0.21277274 + - 0.0031650837 + - 0.03980493 + - -0.2533254 + - 0.08461736 + - 0.093675025 + - -0.11324662 + - 0.06692725 + - 0.55893296 + - -0.22641857 + - 0.022615153 + - 0.15392722 + - 0.5755415 + - 0.011407013 + - 0.35980564 + - 0.21974306 + - -0.09297501 + - 0.4367113 + - -0.23573515 + - 0.07124809 + - 0.15220049 + - 0.15272522 + - -0.17033264 + - -0.2917622 + - -0.4142479 + - -0.1133723 + - 0.058007933 + - 0.18934783 + - -0.25798455 + - -0.28384382 + - -0.21307266 + - -0.18793856 + - 10.099517 + - -0.29333264 + - 0.19593938 + - 0.10462643 + - -0.43937737 + - -0.35579664 + - -0.37670797 + - -0.39402208 + - 0.24991584 + - -0.49762017 + - 0.34469578 + - -0.31670693 + - 0.47948128 + - 0.41520944 + - -0.11301625 + - 0.46423402 + - 0.16219251 + - 0.3933815 + - 0.051284872 + - 0.05781566 + - 0.8832664 + - -0.05080145 + - 0.26123673 + - 0.11678625 + - -0.28066295 + - 0.76156986 + - 0.066791944 + - 0.83562666 + - -0.11197571 + - 0.13488016 + - 0.20096767 + - -0.20980704 + - -0.45928773 + - 0.14732412 + - 0.12771715 + - -0.017773882 + - 0.16395174 + - -0.123419054 + - 0.33333564 + - -0.42703536 + - 0.29838392 + - 0.18779437 + - -0.24272417 + - -0.6565218 + - -0.14446557 + - -0.3998034 + - -0.50993735 + - -0.15560421 + - 0.25184003 + - -0.24832739 + - -0.33523795 + - -0.09398137 + - 0.19548438 + - 0.2580461 + - 0.4457145 + - -0.64801246 + - 0.16456437 + - -0.105191424 + - 0.60747784 + - 0.5990834 + - 0.38340846 + - -0.27597246 + - 0.22335605 + - -0.30548355 + - 0.16201425 + - 0.5177926 + - -0.63812023 + - -0.22941475 + - 0.412911 + - -0.081063874 + - 0.44422537 + - 0.24877977 + - 0.5251326 + - -0.07089625 + - -0.0057357675 + - -1.6791223 + - 0.23042658 + - -0.060608152 + - -0.50519955 + - 0.82898474 + - 0.19553086 + - 0.23088019 + - 0.7794116 + - -0.01638585 + - 0.53862965 + - 0.36200878 + - 0.031350262 + - 0.07245593 + - -0.4799439 + - -0.08725797 + - -0.57107514 + - -0.11494186 + - 0.32031873 + - 0.17155556 + - -0.8416546 + - 1.0503348 + - 0.02812561 + - -0.32251388 + - 0.049411137 + - -0.47582775 + - 0.32229686 + - -0.40941733 + - -0.57846916 + - -0.6903145 + - 0.041375764 + - -0.5212008 + - -0.27806613 + - 0.36441654 + - -0.049604047 + - -0.042339463 + - -0.81961316 + - 0.8854657 + - 0.511798 + - 0.55741614 + - -0.059459846 + - -0.3761615 + - 0.12013974 + - 0.01033246 + - -0.28388098 + - 0.7159401 + - 0.11651326 + - -0.5440888 + - 0.42004067 + - -0.63942534 + - 0.030498711 + - 0.41637993 + - 0.6324795 + - 0.05462823 + - 0.36627182 + - 0.28641716 + - 0.08365602 + - 0.19796936 + - 0.4155474 + - -0.24675235 + - -0.34165946 + - -1.1408305 + - 0.5459657 + - -0.051777266 + - 0.49809122 + - -0.5024681 + - 0.12991397 + - -0.30030754 + - -0.32993302 + - -0.5474323 + - 0.06226304 + - -0.6110137 + - -0.27040514 + - 0.40687135 + - 0.59104645 + - 0.02262819 + - 0.052973587 + - 0.21853103 + - 0.17413764 + - 0.06969698 + - 0.42451033 + - -0.60262376 + - 0.15928052 + - 0.2658704 + - 0.018795839 + - 0.42409608 + - -0.1471951 + - -0.30924115 + - -0.10039016 + - -0.002060557 + - 0.03218183 + - 0.5488419 + - 0.77144593 + - -0.11896841 + - 0.43488654 + - -0.13616154 + - 0.47219867 + - -0.114221156 + - -0.010816251 + - -0.08561314 + - -0.30524844 + - 0.5766301 + - -0.0795128 + - 0.3022596 + - 0.06640264 + - -0.013633816 + - -0.06624731 + - -0.47374073 + - 0.1852819 + - 0.6147972 + - -19.987226 + - 0.25636458 + - -0.7807092 + - -3.5846238 + - -0.05432132 + - -0.10887172 + - -0.3565953 + - -0.21821423 + - 0.77597064 + - -0.17449293 + - -0.3181409 + - 0.27188843 + - 0.12619732 + - 0.5856776 + - -0.53822726 + - -0.13398394 + - 0.17988329 + - -0.22255743 + - 0.42219836 + - 0.24212098 + - -0.44121695 + - -0.4024343 + - 0.7991975 + - -0.038545858 + - 0.0052575087 + - 0.42510065 + - 0.014138841 + - -0.14127852 + - -0.1700249 + - 0.04692119 + - 0.10953789 + - -0.21354803 + - 0.23680206 + - 1.2736107 + - -0.28618956 + - -0.29065016 + - -0.17273872 + - 0.2213783 + - -0.11583165 + - -0.5023595 + - -0.70143414 + - 0.081365995 + - 0.22351064 + - -0.017807793 + - -0.22193705 + - 0.09707199 + - 0.2992851 + - 0.18385038 + - -0.3605939 + - 0.33943543 + - 0.09549754 + - 0.37160823 + - 0.6825976 + - -0.20985527 + - 0.6604706 + - 0.84790426 + - 0.10527216 + - -0.03634956 + - -0.40128633 + - 0.2502716 + - -0.15873171 + - -0.14339831 + - 0.21397479 + - -0.6543829 + - 0.53866136 + - -0.3407975 + - -0.050420683 + - 0.30681756 + - -0.29824996 + - -1.1542789 + - -0.06620971 + - 0.6504389 + - -0.042165253 + - -0.06484562 + - -0.18415153 + - 0.46008238 + - -0.20507146 + - 0.12504397 + - -0.7476157 + - -0.42810655 + - -0.3773162 + - 0.3906973 + - 0.6155185 + - 0.017193332 + - 0.10570256 + - -0.060152177 + - -0.399036 + - 0.79904413 + - 0.28697103 + - 0.9091821 + - -0.59921926 + - -0.1628232 + - -0.90001625 + - -0.35896045 + - 0.27016965 + - 0.103808485 + - 0.6945471 + - 0.2763342 + - -0.1702973 + - 0.44257897 + - -0.36725363 + - 0.03673076 + - -0.07697398 + - 0.09624869 + - -0.4460207 + - 0.8887666 + - 0.1781566 + - -0.17791858 + - -0.39802054 + - 0.5213422 + - -0.19000591 + - 0.35985014 + - -0.17268452 + - 0.29003906 + - -0.08455206 + - 0.29131046 + - 0.24830084 + - 0.5528632 + - 0.05864036 + - -0.7710372 + - 0.3871754 + - 0.53768647 + - -0.25420925 + - -0.34708565 + - 0.057481296 + - -0.13863796 + - -0.33311394 + - -0.06961799 + - 0.51188266 + - -0.12305512 + - 0.02045538 + - -0.59610873 + - -0.30176467 + - -0.30907938 + - -0.40012246 + - 0.6048357 + - 0.19509454 + - 0.086044766 + - 0.04933169 + - 0.2678667 + - -0.14196004 + - 0.3076284 + - 0.6012508 + - -0.421004 + - 0.24541153 + - 0.11258123 + - -0.2125083 + - -0.28483692 + - 0.397754 + - -0.312757 + - 0.38831547 + - -0.09692918 + - 0.75706464 + - 0.36085218 + - 0.23455128 + - 0.5113683 + - -0.06894269 + - -0.01600678 + - 0.7843088 + - 0.09861731 + - -0.25969028 + - 0.0784015 + - -0.35604534 + - -0.13135941 + - 0.13479428 + - -0.124181546 + - -0.71676505 + - 0.18386984 + - 0.19870673 + - 0.2431886 + - 0.13963757 + - 1.0274862 + - -0.23380627 + - 0.5574316 + - -0.74570954 + - 0.8761148 + - -0.7103084 + - 0.3010035 + - 0.40494823 + - -0.15995708 + - 0.18163946 + - -0.13157432 + - -0.13064203 + - -0.047061127 + - -0.42138317 + - -0.013677754 + - 0.30052662 + - -0.22256099 + - -0.57224023 + - -0.010003452 + - 0.28350672 + - 0.5432472 + - 0.5652908 + - -0.81954294 + - -0.021392252 + - -0.13306251 + - -0.19206128 + - 0.34139967 + - 0.444823 + - -0.042298786 + - 0.38794398 + - 0.2673128 + - 0.42635554 + - 0.67965275 + - 0.4300317 + - 0.62833786 + - -0.14469333 + - 0.13309358 + - 0.06059465 + - 0.44551829 + - 0.45627326 + - -0.5199569 + - 0.40342784 + - -0.31848982 + - 0.044651292 + - -0.42732924 + - 0.28373045 + - 0.21714142 + - 0.1448094 + - -0.14638571 + - 0.50290275 + - -0.3438672 + - 0.5840459 + - 0.2601524 + - -0.67418784 + - 0.5373621 + - -0.12545066 + - 1.0906112 + - 0.26692218 + - -0.22478184 + - 0.36817026 + - -0.40673804 + - -0.7309609 + - -0.30309418 + - 0.32768196 + - 0.13767713 + - 0.56073487 + - 0.25593626 + - -0.4209361 + - 0.607189 + - -0.52357334 + - -0.15401863 + - 0.20606396 + - 0.1645447 + - 0.62253225 + - 0.0630601 + - -0.01758799 + - 0.55806553 + - -0.14755407 + - 0.54959476 + - 0.14670031 + - 0.4439455 + - 0.4675572 + - 0.05646679 + - -0.0555495 + - -0.041453514 + - -0.10492195 + - -0.15854429 + - -0.5101398 + - 0.3669673 + - 0.54906726 + - 0.30321106 + - 0.11542117 + - 0.12380533 + - 0.26437837 + - -0.29162103 + - 0.32325092 + - -0.16665533 + - 0.5909973 + - 0.04250509 + - 0.36164066 + - -0.13114546 + - -0.025212262 + - -0.4790531 + - 0.5293778 + - -0.37834212 + - 0.028871285 + - -0.21952064 + - 0.10989284 + - -0.3234742 + - -0.026089933 + - 0.14740874 + - -0.06485848 + - -0.71096295 + - -1.4654349 + - -0.13158312 + - 0.49152407 + - 0.009623888 + - 0.15454943 + - 0.15690231 + - -0.3366948 + - -0.092332944 + - -0.2195935 + - 0.025355592 + - -0.14270267 + - -0.123893835 + - 0.009550363 + - 0.49335307 + - 0.13307992 + - 0.48906693 + - 0.28351146 + - -0.2493592 + - -0.17562775 + - 0.13916744 + - 0.16789684 + - 0.18733343 + - -0.17947194 + - 0.52397245 + - 0.27225366 + - 0.09387612 + - 0.90985477 + - 0.15488343 + - 1.0374448 + - 0.28939614 + - -0.37948802 + - 0.14916803 + - -0.6460858 + - -0.2171144 + - -0.10297281 + - -0.07652064 + - 0.11816683 + - -0.06397329 + - -0.28507218 + - 0.494763 + - 0.2032562 + - -0.09985637 + - -0.6599787 + - -0.1663313 + - -0.439354 + - 0.19193758 + - -0.102282785 + - -0.13468574 + - 0.22745156 + - -0.27961227 + - 0.17719606 + - 0.25270763 + - -0.043502476 + - 0.3512094 + - -0.22702739 + - 0.16744027 + - 0.7090984 + - 0.34810296 + - 0.13033624 + - -0.2028989 + - 0.34289747 + - 0.52960044 + - -0.5264291 + - 0.75653404 + - 0.7847978 + - 0.6126623 + - 0.067826666 + - -0.3428157 + - 0.15940502 + - -0.06764568 + - -0.07195717 + - 0.13306312 + - 0.67086315 + - 0.08180193 + - -0.2720733 + - -0.14427172 + - 0.25154665 + - -0.29464656 + - 0.03424729 + - -0.25294217 + - 0.18158443 + - 0.038542885 + - -0.24986313 + - 0.24797918 + - -0.022259245 + - -0.24221401 + - 0.28994456 + - -0.10076807 + - -0.5543355 + - -0.37688842 + - 0.28897327 + - 0.23776725 + - 0.14170568 + - -0.7512676 + - -0.24916433 + - -0.226486 + - -0.17375162 + - 0.43958607 + - 0.8655924 + - 0.2313802 + - 0.26408678 + - -0.49011254 + - -0.06094396 + - -0.15544629 + - 0.22629511 + - -0.027327746 + - 0.19819821 + - 0.21669795 + - -0.23975836 + - -0.5517177 + - -0.048841305 + - 0.4485917 + - 0.38722828 + - -0.23369716 + - -0.5196006 + - -0.6068903 + - -0.19575705 + - 0.44828698 + - -0.36015075 + - -0.1423914 + - -0.17693207 + - -0.5619168 + - 0.31862172 + - -0.3411282 + - 0.15691637 + - 0.93998814 + - 0.30482954 + - -0.3488545 + - 0.31866828 + - 0.42269877 + - 0.7052697 + - 0.17411038 + - -0.19266228 + - 0.023301067 + - 0.25516593 + - 0.086428 + - -0.60372275 + - 0.05167707 + - 0.01207489 + - 0.76991165 + - 0.50486207 + - 0.13814177 + - -0.15061566 + - -0.35813192 + - 0.27007708 + - 0.45613584 + - -0.045845747 + - 0.39350173 + - -0.1895876 + - -0.03330286 + - 0.18303333 + - -0.28471044 + - 0.056851167 + - 0.23755535 + - -0.22600965 + - 0.3703503 + - -0.15900794 + - 0.18936087 + - -0.07516175 + - 0.3205244 + - 0.14041503 + - -0.77208143 + - 0.547323 + - 0.32161283 + - -0.026504159 + - 0.40092152 + - -0.23700473 + - 0.14004576 + - -0.12637398 + - 0.2154273 + - 0.011353775 + - 0.2538325 + - 0.036679156 + - -0.48862785 + - 0.09410244 + - 0.11608916 + - -0.021461133 + - 0.23351462 + - 0.03785808 + - -0.29443693 + - -0.8383231 + - 0.10595101 + - 0.12326203 + - -0.20413648 + - 0.17045371 + - 0.29786333 + - -0.2519147 + - -0.02092876 + - 0.5629991 + - 0.851184 + - 0.3025756 + - -0.0044959327 + - 0.5584672 + - -0.18084967 + - 0.030940142 + - -0.2331576 + - -0.08313205 + - 0.09860725 + - 0.053446822 + - 0.024625655 + - 0.5226554 + - -0.47625294 + - -0.45393154 + - 0.07795901 + - -0.25724998 + - 0.3787623 + - -0.10943724 + - -0.03690427 + - -0.08656395 + - 0.4076857 + - -0.4381267 + - -0.22672419 + - -0.3695102 + - -0.8890651 + - 0.42467332 + - -0.004685886 + - 0.6506019 + - -0.033665918 + - -0.5856341 + - -0.69820684 + - 0.05872496 + - -0.24768828 + - 0.378814 + - 0.02949277 + - 0.35528043 + - -0.2552964 + - 0.009759119 + - 0.1499362 + - 0.34912968 + - 0.55290455 + - -0.40279657 + - -0.07886551 + - -0.25116703 +- - 0.71351844 + - -0.69304115 + - -0.31468543 + - -0.7612197 + - 0.43930057 + - -0.13514744 + - 0.09391131 + - -0.34735927 + - 0.13186659 + - 0.27708164 + - -0.13273019 + - 0.007706137 + - -0.6495313 + - -0.50645226 + - 0.4597361 + - -0.06806728 + - -0.05166502 + - 0.9077733 + - 0.11433124 + - -0.045912873 + - 0.48912784 + - -0.14133538 + - 0.55322737 + - -0.121039666 + - -0.15763085 + - 0.35974053 + - -0.19700159 + - -0.06719497 + - 0.6052721 + - 0.25276622 + - -0.26644203 + - -2.650609 + - -0.019673198 + - -0.12041715 + - 0.52139574 + - 0.27505162 + - 0.48144963 + - -0.11475588 + - -0.55609876 + - -0.080949105 + - -0.18097354 + - -0.22725171 + - -0.21089934 + - 0.16628061 + - -0.20038296 + - 0.40386447 + - 0.09632001 + - 0.14634904 + - -0.02437059 + - 0.0012526183 + - 0.086132266 + - 0.017713025 + - 0.39896515 + - -0.4845759 + - 0.3474718 + - -0.14015059 + - 0.04850618 + - 0.12094253 + - -0.3518659 + - -0.08193331 + - -0.3047304 + - -0.008040354 + - 0.26541537 + - -0.09144109 + - -0.39703 + - -0.5028992 + - -0.3269808 + - 15.677628 + - 0.28717425 + - 0.58528787 + - -0.0992733 + - -0.67269295 + - 0.2845046 + - -0.2043225 + - -0.32609546 + - 0.06746444 + - 0.06292321 + - -0.1033267 + - -0.10848286 + - 0.8744282 + - 0.2438343 + - -0.2040418 + - 0.62538725 + - 0.30883226 + - 0.8182797 + - 0.10082903 + - 0.23247717 + - 0.9186136 + - -0.27310434 + - 0.4975057 + - 0.5450943 + - -0.20661674 + - 0.55713075 + - 0.44453755 + - 1.1531564 + - 0.6554408 + - 0.62162393 + - 0.19482087 + - 0.45680723 + - -0.6347166 + - -0.30447853 + - -0.009398483 + - 0.23002376 + - 0.34668794 + - -0.3120696 + - 0.4090447 + - -0.11244849 + - 0.17869401 + - 0.058369875 + - -0.30224112 + - -0.44849667 + - -0.17855193 + - -0.48387432 + - -0.5845068 + - -0.09446901 + - 0.32802042 + - 0.04170017 + - -0.15649885 + - 0.0016240539 + - 0.50110596 + - 0.21835554 + - -0.22627728 + - -0.13336144 + - 0.17118059 + - -0.40952995 + - 1.0066745 + - 0.72344774 + - 0.1516942 + - -0.12696464 + - -0.13416165 + - -0.5829673 + - -0.065901175 + - 0.36547938 + - -0.6357002 + - -0.12789585 + - 0.41313592 + - -0.23401867 + - 1.0890821 + - 0.25266048 + - 0.7669018 + - 0.14823343 + - -0.3512553 + - -1.8668109 + - 0.44939947 + - -0.7617731 + - -0.87793875 + - 0.9509797 + - 0.5010424 + - 0.17533255 + - 0.13362281 + - -0.024618505 + - -0.31524357 + - -0.26698902 + - -0.5847171 + - 0.098704986 + - -0.5768069 + - -0.021686709 + - -0.5580101 + - 0.09486651 + - -0.179991 + - -0.08441803 + - -0.5233908 + - 0.9365441 + - 0.30052328 + - -0.85758585 + - -0.09130981 + - -0.48547783 + - 0.0043881037 + - -0.34966478 + - -0.7766502 + - -0.51610106 + - -0.5946461 + - -0.68835837 + - -0.2733182 + - 0.27626097 + - -0.2547351 + - 0.14203985 + - -0.7197657 + - 1.2841367 + - -0.3224014 + - 0.05253217 + - 0.0665517 + - -0.5559856 + - 0.112273596 + - 0.23854773 + - 0.29203215 + - 0.81058604 + - -0.18834348 + - 0.1110814 + - 0.21076106 + - -0.39298496 + - 0.2533862 + - -0.07492665 + - 0.7967424 + - -0.28071997 + - -0.4761205 + - 0.43185022 + - 0.00926564 + - 0.08587354 + - 0.58763963 + - -0.5766639 + - -0.47389355 + - -1.046585 + - 0.20793235 + - -0.27121845 + - 0.8003407 + - -0.16847974 + - 0.048996445 + - -0.16758156 + - -0.21268739 + - -0.72926116 + - 0.2637316 + - -0.45574638 + - -0.14424898 + - 0.5697029 + - 0.42640528 + - -0.38626492 + - -0.087628335 + - 0.16698237 + - -0.035957433 + - 0.00023155163 + - 0.85386056 + - 0.114727534 + - 0.1739171 + - 0.10989932 + - 0.3936261 + - 0.67762464 + - -0.43546113 + - -0.32330918 + - 0.06272247 + - -0.21055706 + - -0.1371548 + - -0.024954325 + - 1.1247648 + - -0.13677414 + - 0.026328566 + - -0.02193023 + - 0.5203397 + - -0.64204544 + - -0.13665932 + - -0.0691131 + - -0.2528467 + - 0.32341173 + - -0.22322379 + - 0.6456209 + - 0.3848218 + - 0.2010305 + - -0.27567893 + - -0.5789784 + - 0.4117541 + - 0.7906248 + - -18.831327 + - 0.15310767 + - -1.0905211 + - -4.9811997 + - 0.3232752 + - -0.36785623 + - -0.47898793 + - -0.3121476 + - 0.791006 + - 0.32002038 + - -0.3773683 + - 0.6285607 + - 0.57842517 + - 0.40512848 + - -0.8620057 + - -0.053921964 + - 0.22399081 + - -0.14458364 + - 1.0589441 + - 0.17771919 + - -0.21706562 + - -0.26365718 + - 1.2838757 + - -0.0539636 + - 0.43068132 + - 0.6894179 + - 0.7211862 + - 0.0056900284 + - -0.8914307 + - 0.31011498 + - -0.038413186 + - -0.29940113 + - 0.15184447 + - 1.3774391 + - -0.6641254 + - -0.25427857 + - -0.14947917 + - 0.3885207 + - 0.2853719 + - -0.5031522 + - -0.7453196 + - -0.27583084 + - 0.49491772 + - 0.77335864 + - -0.64982367 + - 0.2007134 + - 0.5162396 + - 0.15380965 + - -0.53285944 + - 0.44713154 + - -0.52313066 + - 0.61034566 + - 0.6182596 + - -0.029159077 + - 0.52524346 + - 0.8644974 + - 0.01930125 + - 0.183365 + - -0.66278464 + - 0.33494225 + - -0.38698485 + - -0.21994591 + - 0.07645505 + - -0.4974343 + - 0.17904027 + - -0.6437731 + - -0.08809555 + - 0.21026896 + - -0.37988266 + - -2.0028062 + - -0.6206382 + - 0.6981122 + - 0.13488232 + - 0.23916604 + - 0.07322533 + - 0.5014197 + - -0.12511261 + - -0.15900849 + - -1.1383964 + - -0.29455408 + - -0.3659265 + - 0.13819067 + - 0.5165025 + - -0.062155485 + - -0.5635331 + - 0.08555543 + - -0.62499166 + - 0.7289136 + - 0.4134582 + - 0.46754006 + - -0.3894069 + - 0.20206062 + - -0.32964137 + - -0.5358896 + - 0.48837554 + - 0.5603907 + - 1.1617662 + - 0.452639 + - 0.28694376 + - 0.8295381 + - -0.8101724 + - -0.06310008 + - 0.43729344 + - -0.14474325 + - -0.51660544 + - 0.94608134 + - 0.35836384 + - 0.24006481 + - -0.017788768 + - 0.20631148 + - -0.05340987 + - 0.5433422 + - -0.30088422 + - 0.16558595 + - -0.019188736 + - 0.15138857 + - 0.24704401 + - 0.49822935 + - -0.07538187 + - -0.47637406 + - 0.62095475 + - 0.04476859 + - -0.6783643 + - -0.17248851 + - 0.5526289 + - -0.021573832 + - -0.7528395 + - -0.11989141 + - 0.77906775 + - -0.41257775 + - 0.027793622 + - -0.67316794 + - -0.39661404 + - -0.5592558 + - 0.24878687 + - 0.802394 + - 0.49536428 + - 0.2256391 + - -0.26455942 + - 0.06443867 + - -0.15795904 + - 0.18102641 + - 0.6787179 + - -0.74329567 + - 0.00905232 + - 0.13074018 + - -0.005488751 + - -0.4086573 + - 0.112835325 + - -0.76820093 + - 0.4948655 + - -0.78887075 + - 0.8698425 + - 0.29768342 + - -0.04925186 + - -0.05411619 + - 0.7189281 + - 0.007642263 + - 0.7499702 + - 0.2507107 + - -0.4169223 + - -0.037549645 + - -0.9240675 + - -0.39048874 + - 0.35492206 + - -0.3348581 + - -0.3023803 + - -0.2460704 + - -0.14495951 + - 0.22017723 + - 0.47609842 + - 1.1461776 + - 0.13192092 + - 0.102362275 + - 0.14648235 + - 0.9542461 + - -1.3053986 + - 0.2282873 + - 0.45962977 + - -0.4608564 + - -0.08666416 + - -0.24090521 + - -0.31126007 + - -0.7096245 + - 0.05143531 + - 0.17339851 + - 0.15162379 + - -0.11454413 + - -0.4441428 + - 0.02370247 + - 0.4803201 + - 1.5090966 + - 0.5262069 + - -0.9411523 + - -0.092901476 + - -0.54422385 + - -0.28948084 + - 0.28257814 + - 1.0069424 + - -0.039038446 + - 0.17197941 + - 0.504329 + - 0.5346368 + - 0.51059425 + - 0.62896365 + - 0.7387376 + - 0.101329215 + - 0.37479064 + - -0.005106931 + - 0.1447384 + - 0.17245929 + - -0.3163921 + - 0.9703956 + - -0.3958124 + - -0.07213475 + - -0.5965734 + - 0.4028102 + - -0.04238488 + - -0.066139184 + - -0.17901082 + - 0.35739028 + - -0.54254127 + - 0.36888206 + - 0.15519144 + - -0.02506481 + - 0.35025752 + - 0.39333978 + - 1.3588821 + - 0.08483086 + - -0.46402308 + - 0.30829218 + - -0.06829961 + - -0.57901937 + - -0.7164209 + - 0.7434039 + - 0.5356177 + - 0.23473597 + - 0.42909178 + - -0.10936105 + - 0.71036655 + - -0.48575488 + - -0.33966812 + - 0.14878602 + - 0.45460346 + - 0.6654695 + - -0.0020481274 + - -0.26248905 + - 0.49655905 + - -0.02760216 + - 1.2962581 + - 0.15690054 + - 0.034341987 + - 0.5105134 + - 0.52867794 + - 0.31858492 + - -0.44781616 + - 0.24801606 + - -0.0033498306 + - -1.1528525 + - 0.2923728 + - 0.27728897 + - 0.45451936 + - 0.5871751 + - 0.10299409 + - 0.16434965 + - -0.14512388 + - -0.11215654 + - 0.39989552 + - 0.73189497 + - 0.27775887 + - 0.6060371 + - 0.16069742 + - -0.44091097 + - -0.8093562 + - 0.6608481 + - -0.05905122 + - -0.61749715 + - 0.20272714 + - 0.23991299 + - -0.4656125 + - -0.22473483 + - 0.6431083 + - 0.36523136 + - -0.701739 + - -1.2782115 + - -0.1456533 + - 0.9019539 + - 0.26986632 + - 0.24989243 + - 0.12236828 + - -0.61430305 + - -0.3137084 + - -0.6135048 + - 0.6377084 + - 0.008216458 + - -0.15024975 + - 0.42674693 + - 0.3510684 + - -0.29719603 + - 0.4152486 + - 0.18718334 + - -0.5660748 + - -0.45607832 + - 0.358332 + - 0.06742443 + - 0.5221704 + - -0.2873063 + - 0.44024062 + - 0.09714395 + - -0.31825516 + - 0.91384345 + - 0.26681617 + - 0.7110219 + - 0.31536126 + - -0.106210165 + - 0.21036787 + - -0.34387422 + - 0.08028897 + - -0.19421513 + - -0.39791143 + - 0.36117068 + - 0.048434127 + - -0.70501703 + - 0.3751658 + - 0.43117273 + - -0.23656349 + - -1.4066228 + - 0.3698136 + - -0.24832475 + - -0.44506982 + - -0.5751241 + - -0.22781463 + - -0.14320828 + - -0.393761 + - 0.21295702 + - -0.06982907 + - -0.03311387 + - 0.27374798 + - 0.02306599 + - -0.052146062 + - 0.8156562 + - 0.23609062 + - 0.020813847 + - -0.16842896 + - 0.54956764 + - 0.64070034 + - -0.51843536 + - 0.24302232 + - 0.9338536 + - 0.2976511 + - 0.14120528 + - -0.7582829 + - 0.39452055 + - -0.32086477 + - 0.24796665 + - -1.5737561 + - 0.30900484 + - 0.41392446 + - -0.1256241 + - 0.06961077 + - 0.04328716 + - -0.2391494 + - -0.011993309 + - 0.20346223 + - 0.2648768 + - 0.29546383 + - -0.021340163 + - 0.5644713 + - 0.17081712 + - -0.34108683 + - -0.05625518 + - 0.28664628 + - -0.52188367 + - -0.43027413 + - 0.67670864 + - 0.3247466 + - 0.25369948 + - -0.43089402 + - 0.119791485 + - 0.04703635 + - -0.18134695 + - 0.8464158 + - 0.47651017 + - 0.21205844 + - -0.07272791 + - -0.4885453 + - -0.23951046 + - -0.07143624 + - 0.50961137 + - 0.20536388 + - 0.13979307 + - 0.06669537 + - -0.26866308 + - -0.6863248 + - 0.45134982 + - 0.286019 + - 0.57926464 + - -0.38616276 + - -0.10044405 + - -0.3710921 + - 0.005546987 + - 0.5246766 + - -0.45918 + - -0.009210679 + - -0.29775384 + - -0.75135875 + - 0.2639352 + - -1.001977 + - 0.12345695 + - 0.7257471 + - 0.12250935 + - -0.16891116 + - 0.532328 + - 0.3213653 + - 0.06402653 + - -0.1646221 + - -0.58244056 + - 0.15293328 + - 0.32998145 + - 0.6886838 + - -1.0841194 + - 0.32080582 + - 0.48642683 + - -0.15814428 + - 0.18272297 + - 0.5359017 + - -0.11470451 + - -0.5349036 + - 0.31611574 + - 0.8356983 + - -0.04342453 + - 0.70769405 + - -0.3260235 + - -0.08231852 + - 0.3378211 + - -0.5986436 + - -0.12646718 + - -0.32781872 + - -0.10595077 + - 0.14412642 + - 0.0073183286 + - 0.37300435 + - -0.0933379 + - 0.076334395 + - 0.18921326 + - -0.78336173 + - 0.35516262 + - 0.19864644 + - 0.32511666 + - 0.33997038 + - -0.048473094 + - 0.4049115 + - -0.2668064 + - 0.31510764 + - 0.10422307 + - 0.05899781 + - 0.029617228 + - -0.37098244 + - -0.10036389 + - -0.28689668 + - 0.104000114 + - 0.22811621 + - 0.43467832 + - -0.2898691 + - -1.1797757 + - 0.12164108 + - 0.028120235 + - 0.1531489 + - -0.12351632 + - 0.21482968 + - -0.31962943 + - -0.36818275 + - 0.5100445 + - 0.8780865 + - 0.13454668 + - 0.15648971 + - 0.3774084 + - 0.036748175 + - 0.13718756 + - 0.0910249 + - -0.26597062 + - -0.3220383 + - 0.18494509 + - 0.057167713 + - 0.60963386 + - -0.17712252 + - -0.61140114 + - 0.027101919 + - -0.7007988 + - 0.28416857 + - -0.5284049 + - -0.2854854 + - -0.52368826 + - -0.2776362 + - -0.28421322 + - 0.21072458 + - -0.2990034 + - -1.1549343 + - 0.7430124 + - 0.42349735 + - 0.39669904 + - 0.20978172 + - -0.3973565 + - -0.67204934 + - 0.17520116 + - -0.7985479 + - 0.15287898 + - -0.2220524 + - 0.878087 + - -0.25449196 + - -0.39145458 + - -0.011332832 + - 0.38514617 + - 0.4915339 + - -0.85784084 + - 0.29650143 + - -0.46230838 +- - 0.34938118 + - -0.5106107 + - -0.33724675 + - -0.14377546 + - 0.42295066 + - 0.080605514 + - -0.05870054 + - -0.2533736 + - 0.096805826 + - 0.47147986 + - -0.30220082 + - -0.062287323 + - -0.5335452 + - -0.5569252 + - 0.1152873 + - 0.26499018 + - -0.20333672 + - 0.62200534 + - 0.37650678 + - 0.2355279 + - 0.48994657 + - -0.19641218 + - 0.3926499 + - 0.040974297 + - 0.048504103 + - 0.068754695 + - 0.074077256 + - 0.15591288 + - 0.43299398 + - 0.30289072 + - -0.11739186 + - -1.0685385 + - 0.34381604 + - -0.36778787 + - 0.42416957 + - 0.21277274 + - 0.0031650837 + - 0.03980493 + - -0.2533254 + - 0.08461736 + - 0.093675025 + - -0.11324662 + - 0.06692725 + - 0.55893296 + - -0.22641857 + - 0.022615153 + - 0.15392722 + - 0.5755415 + - 0.011407013 + - 0.35980564 + - 0.21974306 + - -0.09297501 + - 0.4367113 + - -0.23573515 + - 0.07124809 + - 0.15220049 + - 0.15272522 + - -0.17033264 + - -0.2917622 + - -0.4142479 + - -0.1133723 + - 0.058007933 + - 0.18934783 + - -0.25798455 + - -0.28384382 + - -0.21307266 + - -0.18793856 + - 10.099517 + - -0.29333264 + - 0.19593938 + - 0.10462643 + - -0.43937737 + - -0.35579664 + - -0.37670797 + - -0.39402208 + - 0.24991584 + - -0.49762017 + - 0.34469578 + - -0.31670693 + - 0.47948128 + - 0.41520944 + - -0.11301625 + - 0.46423402 + - 0.16219251 + - 0.3933815 + - 0.051284872 + - 0.05781566 + - 0.8832664 + - -0.05080145 + - 0.26123673 + - 0.11678625 + - -0.28066295 + - 0.76156986 + - 0.066791944 + - 0.83562666 + - -0.11197571 + - 0.13488016 + - 0.20096767 + - -0.20980704 + - -0.45928773 + - 0.14732412 + - 0.12771715 + - -0.017773882 + - 0.16395174 + - -0.123419054 + - 0.33333564 + - -0.42703536 + - 0.29838392 + - 0.18779437 + - -0.24272417 + - -0.6565218 + - -0.14446557 + - -0.3998034 + - -0.50993735 + - -0.15560421 + - 0.25184003 + - -0.24832739 + - -0.33523795 + - -0.09398137 + - 0.19548438 + - 0.2580461 + - 0.4457145 + - -0.64801246 + - 0.16456437 + - -0.105191424 + - 0.60747784 + - 0.5990834 + - 0.38340846 + - -0.27597246 + - 0.22335605 + - -0.30548355 + - 0.16201425 + - 0.5177926 + - -0.63812023 + - -0.22941475 + - 0.412911 + - -0.081063874 + - 0.44422537 + - 0.24877977 + - 0.5251326 + - -0.07089625 + - -0.0057357675 + - -1.6791223 + - 0.23042658 + - -0.060608152 + - -0.50519955 + - 0.82898474 + - 0.19553086 + - 0.23088019 + - 0.7794116 + - -0.01638585 + - 0.53862965 + - 0.36200878 + - 0.031350262 + - 0.07245593 + - -0.4799439 + - -0.08725797 + - -0.57107514 + - -0.11494186 + - 0.32031873 + - 0.17155556 + - -0.8416546 + - 1.0503348 + - 0.02812561 + - -0.32251388 + - 0.049411137 + - -0.47582775 + - 0.32229686 + - -0.40941733 + - -0.57846916 + - -0.6903145 + - 0.041375764 + - -0.5212008 + - -0.27806613 + - 0.36441654 + - -0.049604047 + - -0.042339463 + - -0.81961316 + - 0.8854657 + - 0.511798 + - 0.55741614 + - -0.059459846 + - -0.3761615 + - 0.12013974 + - 0.01033246 + - -0.28388098 + - 0.7159401 + - 0.11651326 + - -0.5440888 + - 0.42004067 + - -0.63942534 + - 0.030498711 + - 0.41637993 + - 0.6324795 + - 0.05462823 + - 0.36627182 + - 0.28641716 + - 0.08365602 + - 0.19796936 + - 0.4155474 + - -0.24675235 + - -0.34165946 + - -1.1408305 + - 0.5459657 + - -0.051777266 + - 0.49809122 + - -0.5024681 + - 0.12991397 + - -0.30030754 + - -0.32993302 + - -0.5474323 + - 0.06226304 + - -0.6110137 + - -0.27040514 + - 0.40687135 + - 0.59104645 + - 0.02262819 + - 0.052973587 + - 0.21853103 + - 0.17413764 + - 0.06969698 + - 0.42451033 + - -0.60262376 + - 0.15928052 + - 0.2658704 + - 0.018795839 + - 0.42409608 + - -0.1471951 + - -0.30924115 + - -0.10039016 + - -0.002060557 + - 0.03218183 + - 0.5488419 + - 0.77144593 + - -0.11896841 + - 0.43488654 + - -0.13616154 + - 0.47219867 + - -0.114221156 + - -0.010816251 + - -0.08561314 + - -0.30524844 + - 0.5766301 + - -0.0795128 + - 0.3022596 + - 0.06640264 + - -0.013633816 + - -0.06624731 + - -0.47374073 + - 0.1852819 + - 0.6147972 + - -19.987226 + - 0.25636458 + - -0.7807092 + - -3.5846238 + - -0.05432132 + - -0.10887172 + - -0.3565953 + - -0.21821423 + - 0.77597064 + - -0.17449293 + - -0.3181409 + - 0.27188843 + - 0.12619732 + - 0.5856776 + - -0.53822726 + - -0.13398394 + - 0.17988329 + - -0.22255743 + - 0.42219836 + - 0.24212098 + - -0.44121695 + - -0.4024343 + - 0.7991975 + - -0.038545858 + - 0.0052575087 + - 0.42510065 + - 0.014138841 + - -0.14127852 + - -0.1700249 + - 0.04692119 + - 0.10953789 + - -0.21354803 + - 0.23680206 + - 1.2736107 + - -0.28618956 + - -0.29065016 + - -0.17273872 + - 0.2213783 + - -0.11583165 + - -0.5023595 + - -0.70143414 + - 0.081365995 + - 0.22351064 + - -0.017807793 + - -0.22193705 + - 0.09707199 + - 0.2992851 + - 0.18385038 + - -0.3605939 + - 0.33943543 + - 0.09549754 + - 0.37160823 + - 0.6825976 + - -0.20985527 + - 0.6604706 + - 0.84790426 + - 0.10527216 + - -0.03634956 + - -0.40128633 + - 0.2502716 + - -0.15873171 + - -0.14339831 + - 0.21397479 + - -0.6543829 + - 0.53866136 + - -0.3407975 + - -0.050420683 + - 0.30681756 + - -0.29824996 + - -1.1542789 + - -0.06620971 + - 0.6504389 + - -0.042165253 + - -0.06484562 + - -0.18415153 + - 0.46008238 + - -0.20507146 + - 0.12504397 + - -0.7476157 + - -0.42810655 + - -0.3773162 + - 0.3906973 + - 0.6155185 + - 0.017193332 + - 0.10570256 + - -0.060152177 + - -0.399036 + - 0.79904413 + - 0.28697103 + - 0.9091821 + - -0.59921926 + - -0.1628232 + - -0.90001625 + - -0.35896045 + - 0.27016965 + - 0.103808485 + - 0.6945471 + - 0.2763342 + - -0.1702973 + - 0.44257897 + - -0.36725363 + - 0.03673076 + - -0.07697398 + - 0.09624869 + - -0.4460207 + - 0.8887666 + - 0.1781566 + - -0.17791858 + - -0.39802054 + - 0.5213422 + - -0.19000591 + - 0.35985014 + - -0.17268452 + - 0.29003906 + - -0.08455206 + - 0.29131046 + - 0.24830084 + - 0.5528632 + - 0.05864036 + - -0.7710372 + - 0.3871754 + - 0.53768647 + - -0.25420925 + - -0.34708565 + - 0.057481296 + - -0.13863796 + - -0.33311394 + - -0.06961799 + - 0.51188266 + - -0.12305512 + - 0.02045538 + - -0.59610873 + - -0.30176467 + - -0.30907938 + - -0.40012246 + - 0.6048357 + - 0.19509454 + - 0.086044766 + - 0.04933169 + - 0.2678667 + - -0.14196004 + - 0.3076284 + - 0.6012508 + - -0.421004 + - 0.24541153 + - 0.11258123 + - -0.2125083 + - -0.28483692 + - 0.397754 + - -0.312757 + - 0.38831547 + - -0.09692918 + - 0.75706464 + - 0.36085218 + - 0.23455128 + - 0.5113683 + - -0.06894269 + - -0.01600678 + - 0.7843088 + - 0.09861731 + - -0.25969028 + - 0.0784015 + - -0.35604534 + - -0.13135941 + - 0.13479428 + - -0.124181546 + - -0.71676505 + - 0.18386984 + - 0.19870673 + - 0.2431886 + - 0.13963757 + - 1.0274862 + - -0.23380627 + - 0.5574316 + - -0.74570954 + - 0.8761148 + - -0.7103084 + - 0.3010035 + - 0.40494823 + - -0.15995708 + - 0.18163946 + - -0.13157432 + - -0.13064203 + - -0.047061127 + - -0.42138317 + - -0.013677754 + - 0.30052662 + - -0.22256099 + - -0.57224023 + - -0.010003452 + - 0.28350672 + - 0.5432472 + - 0.5652908 + - -0.81954294 + - -0.021392252 + - -0.13306251 + - -0.19206128 + - 0.34139967 + - 0.444823 + - -0.042298786 + - 0.38794398 + - 0.2673128 + - 0.42635554 + - 0.67965275 + - 0.4300317 + - 0.62833786 + - -0.14469333 + - 0.13309358 + - 0.06059465 + - 0.44551829 + - 0.45627326 + - -0.5199569 + - 0.40342784 + - -0.31848982 + - 0.044651292 + - -0.42732924 + - 0.28373045 + - 0.21714142 + - 0.1448094 + - -0.14638571 + - 0.50290275 + - -0.3438672 + - 0.5840459 + - 0.2601524 + - -0.67418784 + - 0.5373621 + - -0.12545066 + - 1.0906112 + - 0.26692218 + - -0.22478184 + - 0.36817026 + - -0.40673804 + - -0.7309609 + - -0.30309418 + - 0.32768196 + - 0.13767713 + - 0.56073487 + - 0.25593626 + - -0.4209361 + - 0.607189 + - -0.52357334 + - -0.15401863 + - 0.20606396 + - 0.1645447 + - 0.62253225 + - 0.0630601 + - -0.01758799 + - 0.55806553 + - -0.14755407 + - 0.54959476 + - 0.14670031 + - 0.4439455 + - 0.4675572 + - 0.05646679 + - -0.0555495 + - -0.041453514 + - -0.10492195 + - -0.15854429 + - -0.5101398 + - 0.3669673 + - 0.54906726 + - 0.30321106 + - 0.11542117 + - 0.12380533 + - 0.26437837 + - -0.29162103 + - 0.32325092 + - -0.16665533 + - 0.5909973 + - 0.04250509 + - 0.36164066 + - -0.13114546 + - -0.025212262 + - -0.4790531 + - 0.5293778 + - -0.37834212 + - 0.028871285 + - -0.21952064 + - 0.10989284 + - -0.3234742 + - -0.026089933 + - 0.14740874 + - -0.06485848 + - -0.71096295 + - -1.4654349 + - -0.13158312 + - 0.49152407 + - 0.009623888 + - 0.15454943 + - 0.15690231 + - -0.3366948 + - -0.092332944 + - -0.2195935 + - 0.025355592 + - -0.14270267 + - -0.123893835 + - 0.009550363 + - 0.49335307 + - 0.13307992 + - 0.48906693 + - 0.28351146 + - -0.2493592 + - -0.17562775 + - 0.13916744 + - 0.16789684 + - 0.18733343 + - -0.17947194 + - 0.52397245 + - 0.27225366 + - 0.09387612 + - 0.90985477 + - 0.15488343 + - 1.0374448 + - 0.28939614 + - -0.37948802 + - 0.14916803 + - -0.6460858 + - -0.2171144 + - -0.10297281 + - -0.07652064 + - 0.11816683 + - -0.06397329 + - -0.28507218 + - 0.494763 + - 0.2032562 + - -0.09985637 + - -0.6599787 + - -0.1663313 + - -0.439354 + - 0.19193758 + - -0.102282785 + - -0.13468574 + - 0.22745156 + - -0.27961227 + - 0.17719606 + - 0.25270763 + - -0.043502476 + - 0.3512094 + - -0.22702739 + - 0.16744027 + - 0.7090984 + - 0.34810296 + - 0.13033624 + - -0.2028989 + - 0.34289747 + - 0.52960044 + - -0.5264291 + - 0.75653404 + - 0.7847978 + - 0.6126623 + - 0.067826666 + - -0.3428157 + - 0.15940502 + - -0.06764568 + - -0.07195717 + - 0.13306312 + - 0.67086315 + - 0.08180193 + - -0.2720733 + - -0.14427172 + - 0.25154665 + - -0.29464656 + - 0.03424729 + - -0.25294217 + - 0.18158443 + - 0.038542885 + - -0.24986313 + - 0.24797918 + - -0.022259245 + - -0.24221401 + - 0.28994456 + - -0.10076807 + - -0.5543355 + - -0.37688842 + - 0.28897327 + - 0.23776725 + - 0.14170568 + - -0.7512676 + - -0.24916433 + - -0.226486 + - -0.17375162 + - 0.43958607 + - 0.8655924 + - 0.2313802 + - 0.26408678 + - -0.49011254 + - -0.06094396 + - -0.15544629 + - 0.22629511 + - -0.027327746 + - 0.19819821 + - 0.21669795 + - -0.23975836 + - -0.5517177 + - -0.048841305 + - 0.4485917 + - 0.38722828 + - -0.23369716 + - -0.5196006 + - -0.6068903 + - -0.19575705 + - 0.44828698 + - -0.36015075 + - -0.1423914 + - -0.17693207 + - -0.5619168 + - 0.31862172 + - -0.3411282 + - 0.15691637 + - 0.93998814 + - 0.30482954 + - -0.3488545 + - 0.31866828 + - 0.42269877 + - 0.7052697 + - 0.17411038 + - -0.19266228 + - 0.023301067 + - 0.25516593 + - 0.086428 + - -0.60372275 + - 0.05167707 + - 0.01207489 + - 0.76991165 + - 0.50486207 + - 0.13814177 + - -0.15061566 + - -0.35813192 + - 0.27007708 + - 0.45613584 + - -0.045845747 + - 0.39350173 + - -0.1895876 + - -0.03330286 + - 0.18303333 + - -0.28471044 + - 0.056851167 + - 0.23755535 + - -0.22600965 + - 0.3703503 + - -0.15900794 + - 0.18936087 + - -0.07516175 + - 0.3205244 + - 0.14041503 + - -0.77208143 + - 0.547323 + - 0.32161283 + - -0.026504159 + - 0.40092152 + - -0.23700473 + - 0.14004576 + - -0.12637398 + - 0.2154273 + - 0.011353775 + - 0.2538325 + - 0.036679156 + - -0.48862785 + - 0.09410244 + - 0.11608916 + - -0.021461133 + - 0.23351462 + - 0.03785808 + - -0.29443693 + - -0.8383231 + - 0.10595101 + - 0.12326203 + - -0.20413648 + - 0.17045371 + - 0.29786333 + - -0.2519147 + - -0.02092876 + - 0.5629991 + - 0.851184 + - 0.3025756 + - -0.0044959327 + - 0.5584672 + - -0.18084967 + - 0.030940142 + - -0.2331576 + - -0.08313205 + - 0.09860725 + - 0.053446822 + - 0.024625655 + - 0.5226554 + - -0.47625294 + - -0.45393154 + - 0.07795901 + - -0.25724998 + - 0.3787623 + - -0.10943724 + - -0.03690427 + - -0.08656395 + - 0.4076857 + - -0.4381267 + - -0.22672419 + - -0.3695102 + - -0.8890651 + - 0.42467332 + - -0.004685886 + - 0.6506019 + - -0.033665918 + - -0.5856341 + - -0.69820684 + - 0.05872496 + - -0.24768828 + - 0.378814 + - 0.02949277 + - 0.35528043 + - -0.2552964 + - 0.009759119 + - 0.1499362 + - 0.34912968 + - 0.55290455 + - -0.40279657 + - -0.07886551 + - -0.25116703 diff --git a/backends/candle/tests/snapshots/test_modernbert__mini_single.snap b/backends/candle/tests/snapshots/test_modernbert__mini_single.snap new file mode 100644 index 00000000..6cce986f --- /dev/null +++ b/backends/candle/tests/snapshots/test_modernbert__mini_single.snap @@ -0,0 +1,772 @@ +--- +source: backends/candle/tests/test_modernbert.rs +expression: embeddings_single +--- +- - 0.34938118 + - -0.5106107 + - -0.33724675 + - -0.14377546 + - 0.42295066 + - 0.080605514 + - -0.05870054 + - -0.2533736 + - 0.096805826 + - 0.47147986 + - -0.30220082 + - -0.062287323 + - -0.5335452 + - -0.5569252 + - 0.1152873 + - 0.26499018 + - -0.20333672 + - 0.62200534 + - 0.37650678 + - 0.2355279 + - 0.48994657 + - -0.19641218 + - 0.3926499 + - 0.040974297 + - 0.048504103 + - 0.068754695 + - 0.074077256 + - 0.15591288 + - 0.43299398 + - 0.30289072 + - -0.11739186 + - -1.0685385 + - 0.34381604 + - -0.36778787 + - 0.42416957 + - 0.21277274 + - 0.0031650837 + - 0.03980493 + - -0.2533254 + - 0.08461736 + - 0.093675025 + - -0.11324662 + - 0.06692725 + - 0.55893296 + - -0.22641857 + - 0.022615153 + - 0.15392722 + - 0.5755415 + - 0.011407013 + - 0.35980564 + - 0.21974306 + - -0.09297501 + - 0.4367113 + - -0.23573515 + - 0.07124809 + - 0.15220049 + - 0.15272522 + - -0.17033264 + - -0.2917622 + - -0.4142479 + - -0.1133723 + - 0.058007933 + - 0.18934783 + - -0.25798455 + - -0.28384382 + - -0.21307266 + - -0.18793856 + - 10.099517 + - -0.29333264 + - 0.19593938 + - 0.10462643 + - -0.43937737 + - -0.35579664 + - -0.37670797 + - -0.39402208 + - 0.24991584 + - -0.49762017 + - 0.34469578 + - -0.31670693 + - 0.47948128 + - 0.41520944 + - -0.11301625 + - 0.46423402 + - 0.16219251 + - 0.3933815 + - 0.051284872 + - 0.05781566 + - 0.8832664 + - -0.05080145 + - 0.26123673 + - 0.11678625 + - -0.28066295 + - 0.76156986 + - 0.066791944 + - 0.83562666 + - -0.11197571 + - 0.13488016 + - 0.20096767 + - -0.20980704 + - -0.45928773 + - 0.14732412 + - 0.12771715 + - -0.017773882 + - 0.16395174 + - -0.123419054 + - 0.33333564 + - -0.42703536 + - 0.29838392 + - 0.18779437 + - -0.24272417 + - -0.6565218 + - -0.14446557 + - -0.3998034 + - -0.50993735 + - -0.15560421 + - 0.25184003 + - -0.24832739 + - -0.33523795 + - -0.09398137 + - 0.19548438 + - 0.2580461 + - 0.4457145 + - -0.64801246 + - 0.16456437 + - -0.105191424 + - 0.60747784 + - 0.5990834 + - 0.38340846 + - -0.27597246 + - 0.22335605 + - -0.30548355 + - 0.16201425 + - 0.5177926 + - -0.63812023 + - -0.22941475 + - 0.412911 + - -0.081063874 + - 0.44422537 + - 0.24877977 + - 0.5251326 + - -0.07089625 + - -0.0057357675 + - -1.6791223 + - 0.23042658 + - -0.060608152 + - -0.50519955 + - 0.82898474 + - 0.19553086 + - 0.23088019 + - 0.7794116 + - -0.01638585 + - 0.53862965 + - 0.36200878 + - 0.031350262 + - 0.07245593 + - -0.4799439 + - -0.08725797 + - -0.57107514 + - -0.11494186 + - 0.32031873 + - 0.17155556 + - -0.8416546 + - 1.0503348 + - 0.02812561 + - -0.32251388 + - 0.049411137 + - -0.47582775 + - 0.32229686 + - -0.40941733 + - -0.57846916 + - -0.6903145 + - 0.041375764 + - -0.5212008 + - -0.27806613 + - 0.36441654 + - -0.049604047 + - -0.042339463 + - -0.81961316 + - 0.8854657 + - 0.511798 + - 0.55741614 + - -0.059459846 + - -0.3761615 + - 0.12013974 + - 0.01033246 + - -0.28388098 + - 0.7159401 + - 0.11651326 + - -0.5440888 + - 0.42004067 + - -0.63942534 + - 0.030498711 + - 0.41637993 + - 0.6324795 + - 0.05462823 + - 0.36627182 + - 0.28641716 + - 0.08365602 + - 0.19796936 + - 0.4155474 + - -0.24675235 + - -0.34165946 + - -1.1408305 + - 0.5459657 + - -0.051777266 + - 0.49809122 + - -0.5024681 + - 0.12991397 + - -0.30030754 + - -0.32993302 + - -0.5474323 + - 0.06226304 + - -0.6110137 + - -0.27040514 + - 0.40687135 + - 0.59104645 + - 0.02262819 + - 0.052973587 + - 0.21853103 + - 0.17413764 + - 0.06969698 + - 0.42451033 + - -0.60262376 + - 0.15928052 + - 0.2658704 + - 0.018795839 + - 0.42409608 + - -0.1471951 + - -0.30924115 + - -0.10039016 + - -0.002060557 + - 0.03218183 + - 0.5488419 + - 0.77144593 + - -0.11896841 + - 0.43488654 + - -0.13616154 + - 0.47219867 + - -0.114221156 + - -0.010816251 + - -0.08561314 + - -0.30524844 + - 0.5766301 + - -0.0795128 + - 0.3022596 + - 0.06640264 + - -0.013633816 + - -0.06624731 + - -0.47374073 + - 0.1852819 + - 0.6147972 + - -19.987226 + - 0.25636458 + - -0.7807092 + - -3.5846238 + - -0.05432132 + - -0.10887172 + - -0.3565953 + - -0.21821423 + - 0.77597064 + - -0.17449293 + - -0.3181409 + - 0.27188843 + - 0.12619732 + - 0.5856776 + - -0.53822726 + - -0.13398394 + - 0.17988329 + - -0.22255743 + - 0.42219836 + - 0.24212098 + - -0.44121695 + - -0.4024343 + - 0.7991975 + - -0.038545858 + - 0.0052575087 + - 0.42510065 + - 0.014138841 + - -0.14127852 + - -0.1700249 + - 0.04692119 + - 0.10953789 + - -0.21354803 + - 0.23680206 + - 1.2736107 + - -0.28618956 + - -0.29065016 + - -0.17273872 + - 0.2213783 + - -0.11583165 + - -0.5023595 + - -0.70143414 + - 0.081365995 + - 0.22351064 + - -0.017807793 + - -0.22193705 + - 0.09707199 + - 0.2992851 + - 0.18385038 + - -0.3605939 + - 0.33943543 + - 0.09549754 + - 0.37160823 + - 0.6825976 + - -0.20985527 + - 0.6604706 + - 0.84790426 + - 0.10527216 + - -0.03634956 + - -0.40128633 + - 0.2502716 + - -0.15873171 + - -0.14339831 + - 0.21397479 + - -0.6543829 + - 0.53866136 + - -0.3407975 + - -0.050420683 + - 0.30681756 + - -0.29824996 + - -1.1542789 + - -0.06620971 + - 0.6504389 + - -0.042165253 + - -0.06484562 + - -0.18415153 + - 0.46008238 + - -0.20507146 + - 0.12504397 + - -0.7476157 + - -0.42810655 + - -0.3773162 + - 0.3906973 + - 0.6155185 + - 0.017193332 + - 0.10570256 + - -0.060152177 + - -0.399036 + - 0.79904413 + - 0.28697103 + - 0.9091821 + - -0.59921926 + - -0.1628232 + - -0.90001625 + - -0.35896045 + - 0.27016965 + - 0.103808485 + - 0.6945471 + - 0.2763342 + - -0.1702973 + - 0.44257897 + - -0.36725363 + - 0.03673076 + - -0.07697398 + - 0.09624869 + - -0.4460207 + - 0.8887666 + - 0.1781566 + - -0.17791858 + - -0.39802054 + - 0.5213422 + - -0.19000591 + - 0.35985014 + - -0.17268452 + - 0.29003906 + - -0.08455206 + - 0.29131046 + - 0.24830084 + - 0.5528632 + - 0.05864036 + - -0.7710372 + - 0.3871754 + - 0.53768647 + - -0.25420925 + - -0.34708565 + - 0.057481296 + - -0.13863796 + - -0.33311394 + - -0.06961799 + - 0.51188266 + - -0.12305512 + - 0.02045538 + - -0.59610873 + - -0.30176467 + - -0.30907938 + - -0.40012246 + - 0.6048357 + - 0.19509454 + - 0.086044766 + - 0.04933169 + - 0.2678667 + - -0.14196004 + - 0.3076284 + - 0.6012508 + - -0.421004 + - 0.24541153 + - 0.11258123 + - -0.2125083 + - -0.28483692 + - 0.397754 + - -0.312757 + - 0.38831547 + - -0.09692918 + - 0.75706464 + - 0.36085218 + - 0.23455128 + - 0.5113683 + - -0.06894269 + - -0.01600678 + - 0.7843088 + - 0.09861731 + - -0.25969028 + - 0.0784015 + - -0.35604534 + - -0.13135941 + - 0.13479428 + - -0.124181546 + - -0.71676505 + - 0.18386984 + - 0.19870673 + - 0.2431886 + - 0.13963757 + - 1.0274862 + - -0.23380627 + - 0.5574316 + - -0.74570954 + - 0.8761148 + - -0.7103084 + - 0.3010035 + - 0.40494823 + - -0.15995708 + - 0.18163946 + - -0.13157432 + - -0.13064203 + - -0.047061127 + - -0.42138317 + - -0.013677754 + - 0.30052662 + - -0.22256099 + - -0.57224023 + - -0.010003452 + - 0.28350672 + - 0.5432472 + - 0.5652908 + - -0.81954294 + - -0.021392252 + - -0.13306251 + - -0.19206128 + - 0.34139967 + - 0.444823 + - -0.042298786 + - 0.38794398 + - 0.2673128 + - 0.42635554 + - 0.67965275 + - 0.4300317 + - 0.62833786 + - -0.14469333 + - 0.13309358 + - 0.06059465 + - 0.44551829 + - 0.45627326 + - -0.5199569 + - 0.40342784 + - -0.31848982 + - 0.044651292 + - -0.42732924 + - 0.28373045 + - 0.21714142 + - 0.1448094 + - -0.14638571 + - 0.50290275 + - -0.3438672 + - 0.5840459 + - 0.2601524 + - -0.67418784 + - 0.5373621 + - -0.12545066 + - 1.0906112 + - 0.26692218 + - -0.22478184 + - 0.36817026 + - -0.40673804 + - -0.7309609 + - -0.30309418 + - 0.32768196 + - 0.13767713 + - 0.56073487 + - 0.25593626 + - -0.4209361 + - 0.607189 + - -0.52357334 + - -0.15401863 + - 0.20606396 + - 0.1645447 + - 0.62253225 + - 0.0630601 + - -0.01758799 + - 0.55806553 + - -0.14755407 + - 0.54959476 + - 0.14670031 + - 0.4439455 + - 0.4675572 + - 0.05646679 + - -0.0555495 + - -0.041453514 + - -0.10492195 + - -0.15854429 + - -0.5101398 + - 0.3669673 + - 0.54906726 + - 0.30321106 + - 0.11542117 + - 0.12380533 + - 0.26437837 + - -0.29162103 + - 0.32325092 + - -0.16665533 + - 0.5909973 + - 0.04250509 + - 0.36164066 + - -0.13114546 + - -0.025212262 + - -0.4790531 + - 0.5293778 + - -0.37834212 + - 0.028871285 + - -0.21952064 + - 0.10989284 + - -0.3234742 + - -0.026089933 + - 0.14740874 + - -0.06485848 + - -0.71096295 + - -1.4654349 + - -0.13158312 + - 0.49152407 + - 0.009623888 + - 0.15454943 + - 0.15690231 + - -0.3366948 + - -0.092332944 + - -0.2195935 + - 0.025355592 + - -0.14270267 + - -0.123893835 + - 0.009550363 + - 0.49335307 + - 0.13307992 + - 0.48906693 + - 0.28351146 + - -0.2493592 + - -0.17562775 + - 0.13916744 + - 0.16789684 + - 0.18733343 + - -0.17947194 + - 0.52397245 + - 0.27225366 + - 0.09387612 + - 0.90985477 + - 0.15488343 + - 1.0374448 + - 0.28939614 + - -0.37948802 + - 0.14916803 + - -0.6460858 + - -0.2171144 + - -0.10297281 + - -0.07652064 + - 0.11816683 + - -0.06397329 + - -0.28507218 + - 0.494763 + - 0.2032562 + - -0.09985637 + - -0.6599787 + - -0.1663313 + - -0.439354 + - 0.19193758 + - -0.102282785 + - -0.13468574 + - 0.22745156 + - -0.27961227 + - 0.17719606 + - 0.25270763 + - -0.043502476 + - 0.3512094 + - -0.22702739 + - 0.16744027 + - 0.7090984 + - 0.34810296 + - 0.13033624 + - -0.2028989 + - 0.34289747 + - 0.52960044 + - -0.5264291 + - 0.75653404 + - 0.7847978 + - 0.6126623 + - 0.067826666 + - -0.3428157 + - 0.15940502 + - -0.06764568 + - -0.07195717 + - 0.13306312 + - 0.67086315 + - 0.08180193 + - -0.2720733 + - -0.14427172 + - 0.25154665 + - -0.29464656 + - 0.03424729 + - -0.25294217 + - 0.18158443 + - 0.038542885 + - -0.24986313 + - 0.24797918 + - -0.022259245 + - -0.24221401 + - 0.28994456 + - -0.10076807 + - -0.5543355 + - -0.37688842 + - 0.28897327 + - 0.23776725 + - 0.14170568 + - -0.7512676 + - -0.24916433 + - -0.226486 + - -0.17375162 + - 0.43958607 + - 0.8655924 + - 0.2313802 + - 0.26408678 + - -0.49011254 + - -0.06094396 + - -0.15544629 + - 0.22629511 + - -0.027327746 + - 0.19819821 + - 0.21669795 + - -0.23975836 + - -0.5517177 + - -0.048841305 + - 0.4485917 + - 0.38722828 + - -0.23369716 + - -0.5196006 + - -0.6068903 + - -0.19575705 + - 0.44828698 + - -0.36015075 + - -0.1423914 + - -0.17693207 + - -0.5619168 + - 0.31862172 + - -0.3411282 + - 0.15691637 + - 0.93998814 + - 0.30482954 + - -0.3488545 + - 0.31866828 + - 0.42269877 + - 0.7052697 + - 0.17411038 + - -0.19266228 + - 0.023301067 + - 0.25516593 + - 0.086428 + - -0.60372275 + - 0.05167707 + - 0.01207489 + - 0.76991165 + - 0.50486207 + - 0.13814177 + - -0.15061566 + - -0.35813192 + - 0.27007708 + - 0.45613584 + - -0.045845747 + - 0.39350173 + - -0.1895876 + - -0.03330286 + - 0.18303333 + - -0.28471044 + - 0.056851167 + - 0.23755535 + - -0.22600965 + - 0.3703503 + - -0.15900794 + - 0.18936087 + - -0.07516175 + - 0.3205244 + - 0.14041503 + - -0.77208143 + - 0.547323 + - 0.32161283 + - -0.026504159 + - 0.40092152 + - -0.23700473 + - 0.14004576 + - -0.12637398 + - 0.2154273 + - 0.011353775 + - 0.2538325 + - 0.036679156 + - -0.48862785 + - 0.09410244 + - 0.11608916 + - -0.021461133 + - 0.23351462 + - 0.03785808 + - -0.29443693 + - -0.8383231 + - 0.10595101 + - 0.12326203 + - -0.20413648 + - 0.17045371 + - 0.29786333 + - -0.2519147 + - -0.02092876 + - 0.5629991 + - 0.851184 + - 0.3025756 + - -0.0044959327 + - 0.5584672 + - -0.18084967 + - 0.030940142 + - -0.2331576 + - -0.08313205 + - 0.09860725 + - 0.053446822 + - 0.024625655 + - 0.5226554 + - -0.47625294 + - -0.45393154 + - 0.07795901 + - -0.25724998 + - 0.3787623 + - -0.10943724 + - -0.03690427 + - -0.08656395 + - 0.4076857 + - -0.4381267 + - -0.22672419 + - -0.3695102 + - -0.8890651 + - 0.42467332 + - -0.004685886 + - 0.6506019 + - -0.033665918 + - -0.5856341 + - -0.69820684 + - 0.05872496 + - -0.24768828 + - 0.378814 + - 0.02949277 + - 0.35528043 + - -0.2552964 + - 0.009759119 + - 0.1499362 + - 0.34912968 + - 0.55290455 + - -0.40279657 + - -0.07886551 + - -0.25116703 diff --git a/backends/candle/tests/test_modernbert.rs b/backends/candle/tests/test_modernbert.rs new file mode 100644 index 00000000..e87796a9 --- /dev/null +++ b/backends/candle/tests/test_modernbert.rs @@ -0,0 +1,137 @@ +mod common; + +use crate::common::{sort_embeddings, SnapshotEmbeddings}; +use anyhow::Result; +use common::{batch, cosine_matcher, download_artifacts, load_tokenizer}; +use text_embeddings_backend_candle::CandleBackend; +use text_embeddings_backend_core::{Backend, ModelType, Pool}; + +#[test] +#[serial_test::serial] +fn test_mini() -> Result<()> { + let model_root = download_artifacts("answerdotai/ModernBERT-base", None)?; + let tokenizer = load_tokenizer(&model_root)?; + + let backend = CandleBackend::new( + &model_root, + "float32".to_string(), + ModelType::Embedding(Pool::Mean), + )?; + + let input_batch = batch( + vec![ + tokenizer.encode("What is Deep Learning?", true).unwrap(), + tokenizer.encode("Deep Learning is...", true).unwrap(), + tokenizer.encode("What is Deep Learning?", true).unwrap(), + ], + [0, 1, 2].to_vec(), + vec![], + ); + + let matcher = cosine_matcher(); + + let (pooled_embeddings, _) = sort_embeddings(backend.embed(input_batch)?); + let embeddings_batch = SnapshotEmbeddings::from(pooled_embeddings); + insta::assert_yaml_snapshot!("mini_batch", embeddings_batch, &matcher); + + let input_single = batch( + vec![tokenizer.encode("What is Deep Learning?", true).unwrap()], + [0].to_vec(), + vec![], + ); + + let (pooled_embeddings, _) = sort_embeddings(backend.embed(input_single)?); + let embeddings_single = SnapshotEmbeddings::from(pooled_embeddings); + + insta::assert_yaml_snapshot!("mini_single", embeddings_single, &matcher); + assert_eq!(embeddings_batch[0], embeddings_single[0]); + assert_eq!(embeddings_batch[2], embeddings_single[0]); + + let input_batch = batch( + vec![ + tokenizer.encode("What is Deep Learning?", true).unwrap(), + tokenizer.encode("Deep Learning is...", true).unwrap(), + ], + [0].to_vec(), + [1].to_vec(), + ); + + let (pooled_embeddings, raw_embeddings) = sort_embeddings(backend.embed(input_batch)?); + let pooled_embeddings = SnapshotEmbeddings::from(pooled_embeddings); + let raw_embeddings = SnapshotEmbeddings::from(raw_embeddings); + + assert_eq!(embeddings_batch[0], pooled_embeddings[0]); + assert_eq!(raw_embeddings.len(), 6); + + Ok(()) +} + +#[test] +#[serial_test::serial] +fn test_mini_pooled_raw() -> Result<()> { + let model_root = download_artifacts("sentence-transformers/all-mpnet-base-v2", None)?; + let tokenizer = load_tokenizer(&model_root)?; + + let backend = CandleBackend::new( + &model_root, + "float32".to_string(), + ModelType::Embedding(Pool::Cls), + )?; + + let input_batch = batch( + vec![ + tokenizer.encode("What is Deep Learning?", true).unwrap(), + tokenizer.encode("What is Deep Learning?", true).unwrap(), + tokenizer.encode("Deep Learning is...", true).unwrap(), + tokenizer.encode("What is Deep Learning?", true).unwrap(), + tokenizer.encode("Deep Learning is...", true).unwrap(), + tokenizer.encode("What is Deep Learning?", true).unwrap(), + ], + [0, 2, 3].to_vec(), + [1, 4, 5].to_vec(), + ); + + let matcher = cosine_matcher(); + + let (pooled_embeddings, raw_embeddings) = sort_embeddings(backend.embed(input_batch)?); + let pooled_embeddings_batch = SnapshotEmbeddings::from(pooled_embeddings); + insta::assert_yaml_snapshot!("mini_batch_pooled", pooled_embeddings_batch, &matcher); + + let raw_embeddings_batch = SnapshotEmbeddings::from(raw_embeddings); + insta::assert_yaml_snapshot!("mini_batch_raw", raw_embeddings_batch, &matcher); + + // Check that the first token of each raw embeddings member is the same as the cls pooling ones + assert_eq!(pooled_embeddings_batch[0], raw_embeddings_batch[0]); + assert_eq!(pooled_embeddings_batch[1], raw_embeddings_batch[7]); + assert_eq!(pooled_embeddings_batch[2], raw_embeddings_batch[15]); + assert_eq!(raw_embeddings_batch.len(), 22); + + let input_single = batch( + vec![tokenizer.encode("What is Deep Learning?", true).unwrap()], + [0].to_vec(), + vec![], + ); + + let (pooled_embeddings, _) = sort_embeddings(backend.embed(input_single)?); + let embeddings_single = SnapshotEmbeddings::from(pooled_embeddings); + insta::assert_yaml_snapshot!("mini_single_pooled", embeddings_single, &matcher); + + assert_eq!(pooled_embeddings_batch[0], embeddings_single[0]); + assert_eq!(pooled_embeddings_batch[2], embeddings_single[0]); + + let input_single = batch( + vec![tokenizer.encode("What is Deep Learning?", true).unwrap()], + vec![], + [0].to_vec(), + ); + + let (_, raw_embeddings) = sort_embeddings(backend.embed(input_single)?); + let embeddings_single = SnapshotEmbeddings::from(raw_embeddings); + insta::assert_yaml_snapshot!("mini_single_raw", embeddings_single, &matcher); + + assert_eq!(raw_embeddings_batch[0], embeddings_single[0]); + assert_eq!(raw_embeddings_batch[15], embeddings_single[0]); + assert_eq!(embeddings_single.len(), 7); + + Ok(()) +} diff --git a/router/src/lib.rs b/router/src/lib.rs index e01ede28..488e78b1 100644 --- a/router/src/lib.rs +++ b/router/src/lib.rs @@ -147,13 +147,13 @@ pub async fn run( .build() .unwrap(); match tokenizer.get_post_processor() { - None => tokenizer.with_post_processor(template), + None => tokenizer.with_post_processor(Some(template)), Some(post_processor) => { let post_processor = Sequence::new(vec![ post_processor.clone(), PostProcessorWrapper::Template(template), ]); - tokenizer.with_post_processor(post_processor) + tokenizer.with_post_processor(Some(post_processor)) } }; }