嵌入向量生成与查询

嵌入向量生成与查询

文本嵌入模型

  • M3E 是 Moka Massive Mixed Embedding 的缩写

    • Moka,此模型由 MokaAI 训练,开源和评测,训练脚本使用 uniem,评测 BenchMark 使用 MTEB-zh

      Massive,此模型通过千万级 (2200w+) 的中文句对数据集进行训练

      Mixed,此模型支持中英双语的同质文本相似度计算,异质文本检索等功能,未来还会支持代码检索

      Embedding,此模型是文本嵌入模型,可以将自然语言转换成稠密的向量

使用M3E

  • 为了方便快速调试,建议直接将相关的内容下载至本地

  • git clone https://huggingface.co/moka-ai/m3e-base
    
  • 在这里插入图片描述

  • pip install -U sentence-transformersfrom sentence_transformers import SentenceTransformer
    import numpy as np
    model = SentenceTransformer("D:\\gospace\\shua\\m3e-base")
    texts = ["老王爱写代码"]
    embeddings = model.encode(texts)
    for text, embedding in zip(texts, embeddings):    print(f"Text: {text}")    # print(f"Embedding: {embedding}")    print(np.array2string(embedding, separator=', '))
    
  • 对于m3e-base版本,生成的嵌入向量通常是768维的

  • [ 7.59560585e-01, -1.27109140e-01,  5.14054596e-02, -1.59693062e-01, -4.17063087e-02, -8.19702983e-01,  2.41449431e-01,  1.33715153e-01, -1.03617609e+00, -2.28319705e-01,  6.17243648e-01, -5.24424016e-01,  1.80304646e-01, -8.68997991e-01, -4.62767482e-01, -1.98709533e-01,  5.47812641e-01,  9.67402101e-01, -6.81963444e-01, -3.16316262e-03,  3.28954935e-01,  2.92346120e-01, -4.04711217e-01,  5.90863824e-01, -5.51401138e-01, -4.15514529e-01, -5.02967536e-02, -5.48850775e-01,  1.71392083e-01, -3.95615220e-01,  1.63737941e+00, -7.76524067e-01, -6.15127012e-02,  2.51650959e-01,  3.76678944e-01,  1.65224802e-02,  5.55427015e-01, -1.07243016e-01,  7.81503201e-01,  4.54563320e-01,  8.13240632e-02,  2.48942882e-01,  3.32837075e-01, -3.30844522e-03,  2.85081953e-01,  6.52864814e-01, -1.77730799e-01, -1.86786592e-01, -1.19947433e+00,  3.59263033e-01,  3.06981385e-01,  6.67714453e+00, -8.61118436e-01, -6.59109000e-03, -1.59015369e+00,  1.00160849e+00, -9.57870841e-01,  1.28927857e-01, -5.81352055e-01,  3.86609472e-02,  1.29876643e-01, -4.77568775e-01,  1.63034528e-01, -5.18439829e-01,  1.48755103e-01,  1.29043326e-01,  3.16139519e-01,  3.20954382e-01,  4.15887743e-01, -8.86846662e-01,  4.58009601e-01, -8.47651720e-01, -3.94439220e-01, -2.18782693e-01,  3.68612200e-01,  2.94382125e-02,  3.30451459e-01,  2.67671227e-01,  3.67975801e-01, -4.38472450e-01,  6.25256062e-01,  1.34776592e-01, -1.41976073e-01,  1.92134783e-01, -2.18996853e-01, -3.41829687e-01, -1.87255695e-01, -1.71571851e-01,  1.01223254e+00,  6.13354325e-01, -1.41107845e+00,  1.39829889e-01, -4.25042689e-01,  4.70361635e-02, -6.58033252e-01,  2.33138055e-01,  3.01239669e-01, -1.00470805e+00, -4.89165574e-01, -1.02200963e-01,  1.02289163e-01, -1.42863184e-01, -9.79841352e-02, -4.12617832e-01,  8.39702964e-01,  1.32274532e+00, -9.45372462e-01,  8.20253640e-02,  3.01673234e-01, -1.21201307e-01,  2.79277682e-01, -1.15093338e+00, -5.73418975e-01,  5.75947762e-01, -1.74676076e-01, -3.59989926e-02, -2.45318599e-02,  4.47047085e-01,  3.44157889e-02, -3.95211458e-01,  5.85954450e-03,  4.04485404e-01,  1.90305263e-01, -1.00965261e+00, -7.10118562e-02, -2.32678965e-01, -7.37744719e-02,  5.08088946e-01, -6.53338075e-01,  1.19432044e+00, -5.16369700e-01,  1.22984111e-01, -6.55934036e-01, -5.52078784e-01,  2.12076426e-01, -9.62440372e-02, -2.25091249e-01, -2.57290483e-01, -1.55814445e+00, -3.92937481e-01,  1.97502041e+00,  2.88003266e-01,  3.64899725e-01, -2.91331321e-01, -4.12321925e-01,  2.03414634e-01, -1.91754445e-01,  3.66561532e-01,  1.09342627e-01, -2.96878479e-02, -1.77043572e-01, -7.04252958e-01,  3.78284574e-01,  5.88100553e-01,  2.94542938e-01, -4.53098804e-01, -1.35240722e+00,  6.66298717e-02, -1.18963647e+00, -5.60218394e-01, -9.98719037e-02, -5.41272998e-01, -5.11893511e-01,  1.13323182e-01, -3.41559052e-01,  1.27054405e+00,  3.10296893e-01, -3.91244650e-01, -5.92112660e-01,  3.81372511e-01, -7.09137559e-01, -5.72127700e-01, -6.75038695e-01, -1.27276570e-01,  5.50326467e-01,  1.70973629e-01, -7.06340492e-01,  1.09366155e+00, -2.62876391e-01, -1.71785370e-01, -1.27242553e+00, -3.32011551e-01, -3.68874252e-01, -2.70302027e-01, -6.39186054e-02,  2.25251857e-02, -1.21960545e+00, -2.92267725e-02,  2.19343245e-01,  9.03854549e-01, -1.61024642e+00, -1.19817674e+00, -2.43373215e-01,  1.97811037e-01,  6.99667692e-01,  1.08220398e+00, -1.42966902e+00, -6.23148620e-01, -1.14598131e+00,  3.03221524e-01,  1.35328427e-01, -5.62619567e-01,  5.68072855e-01,  1.00827527e+00, -1.42113477e-01,  8.93693328e-01, -7.74117466e-03,  3.73539865e-01,  7.99027622e-01,  1.09404874e+00, -1.18285084e+00, -1.23149085e+00, -8.11075494e-02, -6.34984076e-02,  1.34655863e-01,  2.48995468e-01, -4.60455269e-01,  1.62918717e-01, -7.58928180e-01, -6.69559538e-01,  1.34634882e-01,  1.34181201e-01, -3.73341367e-02, -8.89802575e-01, -9.93391454e-01, -4.52038705e-01, -4.21833605e-01, -4.91406843e-02,  3.05946171e-01, -3.07202816e-01,  7.82340109e-01, -1.00563467e+00, -1.00400865e-01, -2.64248490e-01,  4.65716511e-01,  4.17140901e-01, -3.88314426e-01,  9.80030656e-01, -3.96880955e-01, -7.87510350e-03, -4.28324640e-02,  1.10107791e+00,  1.79232597e-01, -1.29689205e+00, -3.90284508e-01,  1.02558434e+00,  6.04968727e-01, -6.81580603e-01, -8.27678978e-01, -4.23272520e-01, -5.92301935e-02,  3.44731659e-01,  2.54145443e-01, -1.15404820e+00, -1.03138164e-01,  5.55383801e-01,  3.37476492e-01, -5.15083194e-01,  6.99012876e-01, -1.58016816e-01, -3.40833396e-01,  3.49915504e-01,  1.39090860e+00,  4.58933473e-01,  4.26962338e-02, -3.71650428e-01, -1.68823689e-01, -1.08074808e+00, -9.05070901e-01, -5.02089858e-01,  4.17415679e-01,  6.67661846e-01, -9.61706638e-02,  2.11916063e-02,  5.62160134e-01, -6.44293189e-01,  3.17710936e-01, -3.41923118e-01, -8.82506490e-01, -1.07720530e+00, -3.00090283e-01,  9.13380504e-01,  9.57989216e-01,  3.72398585e-01, -9.98427093e-01, -6.91964507e-01,  5.92603028e-01,  7.90655553e-01, -1.06618869e+00, -1.30195391e+00, -1.20785582e+00, -2.04321653e-01, -3.76093715e-01,  1.33960694e-01,  2.50592518e+00, -5.28230846e-01, -6.59069419e-01,  7.36321807e-01,  7.97808111e-01, -1.06570244e+00, -1.43543527e-01, -6.55247211e-01, -7.19331861e-01,  8.15252602e-01, -8.67068917e-02,  1.07031262e+00,  3.90325516e-01,  9.45663303e-02, -8.35210085e-01, -1.21028841e-01, -1.61372471e+00,  1.09380625e-01, -1.59053236e-01, -2.58469820e-01, -5.18571377e-01,  3.15038502e-01, -6.21809185e-01,  1.38990045e-01,  1.67350203e-01,  3.30487221e-01,  7.23021626e-01,  2.61946917e-02,  1.08872366e+00,  3.58943760e-01,  8.15560222e-02, -1.10836700e-01,  1.13304579e+00,  1.04639006e+00, -4.26227301e-01,  1.05273044e+00,  6.38412178e-01, -6.83263779e-01, -7.28904009e-02,  8.67998898e-01,  9.42042649e-01,  1.05305696e+00, -5.23684144e-01, -1.82113022e-01, -1.05253243e+00, -7.09312260e-02,  1.22970134e-01,  6.60896778e-01,  9.44130838e-01, -1.19117057e+00, -4.81023014e-01, -1.17151785e+00,  2.22483501e-01, -1.77511990e+00, -3.02142978e-01, -7.96750426e-01, -1.64792848e+00, -4.40994382e-01, -1.09868455e+00, -5.65342665e-01,  3.71169806e-01,  6.77822471e-01,  7.26896048e-01,  5.60501277e-01, -2.84232572e-03,  1.48416114e+00, -2.80948758e-01,  1.86195932e-02, -1.25779772e+00,  1.01117504e+00,  3.95043612e-01, -1.06091559e+00,  4.55376178e-01,  5.90852499e-01, -3.76404703e-01, -1.27505803e+00,  8.27442050e-01,  3.85000587e-01,  1.18777728e+00,  1.92020565e-01,  8.64256859e-01,  1.10247850e+00, -4.77612466e-01, -4.49791044e-01,  4.36293602e-01, -2.63684958e-01,  4.44416553e-01, -4.19982970e-01,  5.77375650e-01, -3.79977077e-01,  3.84563029e-01, -5.36517262e-01, -5.43187335e-02, -1.10158217e+00, -5.05689621e-01, -1.06836462e+00, -9.12110388e-01, -2.28145525e-01,  6.85708761e-01, -1.44891381e-01,  7.85060003e-02,  1.71833351e-01,  2.17102796e-01,  8.75280976e-01,  5.29666305e-01,  2.00214505e-01,  3.49758655e-01, -8.35674644e-01,  9.26342085e-02,  1.84430435e-01,  3.72666001e-01, -2.19136089e-01,  5.18518388e-01, -6.22629523e-02,  7.33491540e-01, -2.63249248e-01, -2.67214417e-01,  7.73090571e-02, -6.45493627e-01, -3.19644272e-01, -2.89276928e-01,  3.45991284e-01,  5.67886233e-03, -2.49789566e-01,  1.04345548e+00, -8.97620797e-01,  2.59745389e-01, -2.35038638e-01,  9.35924470e-01,  1.03495073e+00,  9.25333023e-01,  2.22500831e-01,  2.08737642e-01,  3.27550352e-01, -6.99261762e-03, -3.94405961e-01,  2.15240449e-01, -4.14843351e-01,  6.27586007e-01,  3.00344199e-01,  1.09458768e+00,  7.59830773e-02, -6.83943391e-01,  1.67123511e-01, -5.07802606e-01, -2.70432144e-01, -6.21037364e-01,  9.64937747e-01,  1.25556087e+00, -3.15922976e-01, -5.63388944e-01, -1.46975935e-01,  1.02344620e+00, -4.48462069e-01,  9.04044926e-01, -2.81636208e-01,  1.05440784e+00,  2.14560971e-01,  7.86892548e-02, -1.28740996e-01, -5.30646369e-02, -7.13777184e-01, -3.04264992e-01, -5.53258777e-01,  4.91248667e-01, -5.39805472e-01, -8.68568122e-01,  8.64456892e-01, -9.18175802e-02,  4.13068295e-01, -2.08863601e-01,  4.28583443e-01,  1.23620534e+00, -8.92189264e-01,  1.37983215e+00,  4.38869357e-01, -3.87700319e-01,  1.12864268e+00, -5.82494810e-02,  1.43608093e-01, -5.40578723e-01,  1.17179848e-01,  2.51674443e-01, -1.42769992e-01, -1.31010675e+00, -8.51148784e-01, -1.48061931e-01,  2.58323908e-01,  3.67341787e-02, -7.23920584e-01, -9.88820434e-01, -1.39375091e-01, -1.14198053e+00, -7.28593171e-02, -1.04956701e-01, -5.85499108e-01, -6.31171286e-01, -5.10103285e-01,  1.05367959e+00, -6.68842137e-01,  4.63386625e-02, -9.96850908e-01, -9.28651869e-01,  7.93903470e-01, -8.99808407e-01,  8.27691436e-01,  9.12066579e-01, -4.78461653e-01,  8.14078569e-01,  6.02525920e-02,  5.26673317e-01, -5.26469648e-01, -7.05779612e-01, -1.71829477e-01,  1.62325189e-01,  2.85767645e-01,  5.12952507e-01, -1.45051509e-01,  1.37109146e-01,  1.83014393e-01, -1.55559137e-01,  2.12739974e-01, -9.23290730e-01, -1.19877413e-01,  2.81804621e-01,  3.34185094e-01,  1.39511657e+00, -5.90442002e-01,  5.74788213e-01,  1.24385524e+00, -7.21555293e-01,  8.28844130e-01, -8.85802656e-02, -4.08442408e-01,  6.71276212e-01,  1.09820986e+00, -3.75631481e-01, -1.33836254e-01,  6.32796347e-01, -2.02802300e-01,  6.25178933e-01,  6.77876830e-01, -2.75646240e-01, -5.96459627e-01, -2.86792219e-01, -8.54366064e-01,  8.39510620e-01, -1.31479844e-01,  3.25115770e-01, -4.99351650e-01,  2.03135818e-01, -1.43900430e+00, -2.20209926e-01, -2.65229672e-01,  7.82352269e-01, -5.65962434e-01, -3.06415796e-01,  1.99779794e-01, -8.66775632e-01,  4.85115051e-01,  1.44741565e-01, -6.92898750e-01, -2.17116451e+00, -4.12736893e-01,  3.95528555e-01, -1.70124784e-01,  1.67738914e-01,  1.08319551e-01, -8.58196616e-01, -7.99020886e-01, -1.58257377e+00,  7.09277153e-01, -6.97348595e-01, -3.49428415e-01, -1.84181049e-01, -1.62712783e-01,  3.94277692e-01,  7.23135471e-01,  9.47946787e-01,  5.40045500e-01, -8.75189006e-01, -1.86740071e-01, -3.83477867e-01, -3.24022211e-02,  8.44550133e-01,  5.08218348e-01,  1.74616441e-01,  9.65049744e-01,  1.43482059e-01, -4.31216598e-01, -2.10186943e-01, -5.37824035e-01, -3.14835757e-01, -1.09177876e+00,  1.27525091e+00, -7.89696574e-01, -7.59191632e-01,  1.91085026e-01, -2.13713408e-01,  9.87634897e-01,  7.08811343e-01,  1.55087793e+00,  2.73356378e-01,  6.54023588e-01, -8.55911076e-01,  1.92686439e-01, -1.50089972e-02,  2.38779679e-01,  1.49614379e-01,  3.62314701e-01,  6.94537103e-01, -3.87004137e-01,  2.10883880e+00, -3.75697196e-01, -1.82452798e-01, -3.22899401e-01, -8.25561047e-01,  1.80501044e+00,  5.33488870e-01,  2.24471204e-02,  6.21750236e-01,  1.03810385e-01, -9.79628026e-01,  9.70385015e-01, -7.47687459e-01, -4.07829493e-01,  1.48922369e-01, -1.19734859e+00, -3.71993333e-01,  4.34708387e-01, -8.65958393e-01, -5.35230339e-01,  1.72286785e+00,  2.20375031e-01,  5.11880279e-01, -7.53360510e-01,  1.08028436e+00, -4.57028896e-01, -1.50861815e-02,  7.17765152e-01,  4.38092917e-01,  3.15289497e-01,  2.67259568e-01,  6.93954825e-02,  3.62798750e-01,  1.36038041e+00,  1.30169702e+00, -4.57468122e-01, -4.37783718e-01, -5.08757949e-01,  8.63207519e-01, -2.89590597e-01,  1.10191441e+00,  1.98435009e-01,  3.19641560e-01, -1.21980719e-01,  1.29272318e+00,  1.45268068e-01,  1.14542401e+00, -4.47698474e-01,  5.11548400e-01, -2.13712007e-01,  7.16760218e-01,  3.56799394e-01, -8.98992419e-01,  2.53364801e-01,  2.46685684e-01,  2.20981494e-01,  2.45370770e+00, -1.58328819e+00, -4.75152791e-01, -6.23002470e-01,  6.19043648e-01,  7.42533743e-01,  9.58551466e-01, -2.75623322e-01, -4.63303924e-01, -1.89976543e-01, -7.62300074e-01, -2.44294450e-01, -1.18391609e+00, -3.18642884e-01,  2.10066810e-01,  1.68145791e-01, -6.57323003e-03,  6.80729449e-01,  1.39025539e-01,  3.32543373e-01, -4.70169991e-01,  2.51329923e+00,  5.39556563e-01,  6.31205678e-01,  3.46641839e-01, -1.85673684e-02, -2.24657819e-01,  8.87112379e-01, -3.31156075e-01, -6.33936048e-01, -7.78989196e-01, -7.24589527e-01, -8.97557616e-01, -1.19332623e+00,  9.22472417e-01, -7.65920877e-01,  3.12098682e-01, -1.39098316e-02, -8.49792808e-02,  1.01152039e+00,  2.23431200e-01, -1.90913692e-01,  2.77387857e-01, -1.03543140e-02, -7.31578097e-03,  2.77540356e-01,  6.14465535e-01,  1.22704911e+00, -1.18605226e-01,  4.48604554e-01, -8.49792808e-02,  1.01152039e+00,  2.23431200e-01, -1.90913692e-01,  2.77387857e-01, -1.03543140e-02, -7.31578097e-03,  2.77540356e-01,  6.14465535e-01,  1.22704911e+00, -1.18605226e-01,  4.48604554e-01,  2.77387857e-01, -1.03543140e-02, -7.31578097e-03,  2.77540356e-01,  6.14465535e-01,  1.22704911e+00, -1.18605226e-01,  4.48604554e-01,  3.99403453e-01,  9.76211205e-02, -2.72304147e-01, -6.34450793e-01,  6.14465535e-01,  1.22704911e+00, -1.18605226e-01,  4.48604554e-01,  3.99403453e-01,  9.76211205e-02, -2.72304147e-01, -6.34450793e-01,  3.99403453e-01,  9.76211205e-02, -2.72304147e-01, -6.34450793e-01, -8.57364178e-01, -6.94554448e-01, -3.04330140e-01,  1.05320036e-01, -8.57364178e-01, -6.94554448e-01, -3.04330140e-01,  1.05320036e-01,  1.73476115e-01,  1.00599945e+00,  3.46087098e-01,  3.30770224e-01, -2.74857372e-01, -2.06077129e-01,  7.10511386e-01,  1.58540100e-01, -5.68631530e-01, -3.54029030e-01, -1.38866380e-01, -1.23456165e-01,  5.68514943e-01,  2.85906672e-01, -1.28487337e+00, -9.45348591e-02,  4.24727708e-01,  3.99977595e-01,  2.40924731e-01, -4.46219951e-01,  8.51806283e-01,  1.41895026e-01, -5.66927195e-01, -1.45217299e-01,  4.25449193e-01, -3.61947298e-01,  7.06071258e-01, -5.11380136e-01, -6.05433211e-02, -9.70409751e-01, -4.07448590e-01, -1.02107680e+00]
    

Qdrant交互

  • 创建m3e_collection

  • {"vectors": {"size": 768,"distance": "Cosine"}
    }
    
  • 存入四条向量数据,由"老王是领导", “老王是研发”, “老王是程序员”, "老王是开发者"生成。我们使用的是cosine, 因此结果中score 越接近1, 表明两者越相似。

使用"老王爱写代码"查询

  • {"vector": [7.59560585e-01, -1.27109140e-01, 5.14054596e-02, -1.59693062e-01, -4.17063087e-02, -8.19702983e-01, 2.41449431e-01, 1.33715153e-01, -1.03617609e+00, -2.28319705e-01, 6.17243648e-01, -5.24424016e-01, 1.80304646e-01, -8.68997991e-01, -4.62767482e-01, -1.98709533e-01, 5.47812641e-01, 9.67402101e-01, -6.81963444e-01, -3.16316262e-03, 3.28954935e-01, 2.92346120e-01, -4.04711217e-01, 5.90863824e-01, -5.51401138e-01, -4.15514529e-01, -5.02967536e-02, -5.48850775e-01, 1.71392083e-01, -3.95615220e-01, 1.63737941e+00, -7.76524067e-01, -6.15127012e-02, 2.51650959e-01, 3.76678944e-01, 1.65224802e-02, 5.55427015e-01, -1.07243016e-01, 7.81503201e-01, 4.54563320e-01, 8.13240632e-02, 2.48942882e-01, 3.32837075e-01, -3.30844522e-03, 2.85081953e-01, 6.52864814e-01, -1.77730799e-01, -1.86786592e-01, -1.19947433e+00, 3.59263033e-01, 3.06981385e-01, 6.67714453e+00, -8.61118436e-01, -6.59109000e-03, -1.59015369e+00, 1.00160849e+00, -9.57870841e-01, 1.28927857e-01, -5.81352055e-01, 3.86609472e-02, 1.29876643e-01, -4.77568775e-01, 1.63034528e-01, -5.18439829e-01, 1.48755103e-01, 1.29043326e-01, 3.16139519e-01, 3.20954382e-01, 4.15887743e-01, -8.86846662e-01, 4.58009601e-01, -8.47651720e-01, -3.94439220e-01, -2.18782693e-01, 3.68612200e-01, 2.94382125e-02, 3.30451459e-01, 2.67671227e-01, 3.67975801e-01, -4.38472450e-01, 6.25256062e-01, 1.34776592e-01, -1.41976073e-01, 1.92134783e-01, -2.18996853e-01, -3.41829687e-01, -1.87255695e-01, -1.71571851e-01, 1.01223254e+00, 6.13354325e-01, -1.41107845e+00, 1.39829889e-01, -4.25042689e-01, 4.70361635e-02, -6.58033252e-01, 2.33138055e-01, 3.01239669e-01, -1.00470805e+00, -4.89165574e-01, -1.02200963e-01, 1.02289163e-01, -1.42863184e-01, -9.79841352e-02, -4.12617832e-01, 8.39702964e-01, 1.32274532e+00, -9.45372462e-01, 8.20253640e-02, 3.01673234e-01, -1.21201307e-01, 2.79277682e-01, -1.15093338e+00, -5.73418975e-01, 5.75947762e-01, -1.74676076e-01, -3.59989926e-02, -2.45318599e-02, 4.47047085e-01, 3.44157889e-02, -3.95211458e-01, 5.85954450e-03, 4.04485404e-01, 1.90305263e-01, -1.00965261e+00, -7.10118562e-02, -2.32678965e-01, -7.37744719e-02, 5.08088946e-01, -6.53338075e-01, 1.19432044e+00, -5.16369700e-01, 1.22984111e-01, -6.55934036e-01, -5.52078784e-01, 2.12076426e-01, -9.62440372e-02, -2.25091249e-01, -2.57290483e-01, -1.55814445e+00, -3.92937481e-01, 1.97502041e+00, 2.88003266e-01, 3.64899725e-01, -2.91331321e-01, -4.12321925e-01, 2.03414634e-01, -1.91754445e-01, 3.66561532e-01, 1.09342627e-01, -2.96878479e-02, -1.77043572e-01, -7.04252958e-01, 3.78284574e-01, 5.88100553e-01, 2.94542938e-01, -4.53098804e-01, -1.35240722e+00, 6.66298717e-02, -1.18963647e+00, -5.60218394e-01, -9.98719037e-02, -5.41272998e-01, -5.11893511e-01, 1.13323182e-01, -3.41559052e-01, 1.27054405e+00, 3.10296893e-01, -3.91244650e-01, -5.92112660e-01, 3.81372511e-01, -7.09137559e-01, -5.72127700e-01, -6.75038695e-01, -1.27276570e-01, 5.50326467e-01, 1.70973629e-01, -7.06340492e-01, 1.09366155e+00, -2.62876391e-01, -1.71785370e-01, -1.27242553e+00, -3.32011551e-01, -3.68874252e-01, -2.70302027e-01, -6.39186054e-02, 2.25251857e-02, -1.21960545e+00, -2.92267725e-02, 2.19343245e-01, 9.03854549e-01, -1.61024642e+00, -1.19817674e+00, -2.43373215e-01, 1.97811037e-01, 6.99667692e-01, 1.08220398e+00, -1.42966902e+00, -6.23148620e-01, -1.14598131e+00, 3.03221524e-01, 1.35328427e-01, -5.62619567e-01, 5.68072855e-01, 1.00827527e+00, -1.42113477e-01, 8.93693328e-01, -7.74117466e-03, 3.73539865e-01, 7.99027622e-01, 1.09404874e+00, -1.18285084e+00, -1.23149085e+00, -8.11075494e-02, -6.34984076e-02, 1.34655863e-01, 2.48995468e-01, -4.60455269e-01, 1.62918717e-01, -7.58928180e-01, -6.69559538e-01, 1.34634882e-01, 1.34181201e-01, -3.73341367e-02, -8.89802575e-01, -9.93391454e-01, -4.52038705e-01, -4.21833605e-01, -4.91406843e-02, 3.05946171e-01, -3.07202816e-01, 7.82340109e-01, -1.00563467e+00, -1.00400865e-01, -2.64248490e-01, 4.65716511e-01, 4.17140901e-01, -3.88314426e-01, 9.80030656e-01, -3.96880955e-01, -7.87510350e-03, -4.28324640e-02, 1.10107791e+00, 1.79232597e-01, -1.29689205e+00, -3.90284508e-01, 1.02558434e+00, 6.04968727e-01, -6.81580603e-01, -8.27678978e-01, -4.23272520e-01, -5.92301935e-02, 3.44731659e-01, 2.54145443e-01, -1.15404820e+00, -1.03138164e-01, 5.55383801e-01, 3.37476492e-01, -5.15083194e-01, 6.99012876e-01, -1.58016816e-01, -3.40833396e-01, 3.49915504e-01, 1.39090860e+00, 4.58933473e-01, 4.26962338e-02, -3.71650428e-01, -1.68823689e-01, -1.08074808e+00, -9.05070901e-01, -5.02089858e-01, 4.17415679e-01, 6.67661846e-01, -9.61706638e-02, 2.11916063e-02, 5.62160134e-01, -6.44293189e-01, 3.17710936e-01, -3.41923118e-01, -8.82506490e-01, -1.07720530e+00, -3.00090283e-01, 9.13380504e-01, 9.57989216e-01, 3.72398585e-01, -9.98427093e-01, -6.91964507e-01, 5.92603028e-01, 7.90655553e-01, -1.06618869e+00, -1.30195391e+00, -1.20785582e+00, -2.04321653e-01, -3.76093715e-01, 1.33960694e-01, 2.50592518e+00, -5.28230846e-01, -6.59069419e-01, 7.36321807e-01, 7.97808111e-01, -1.06570244e+00, -1.43543527e-01, -6.55247211e-01, -7.19331861e-01, 8.15252602e-01, -8.67068917e-02, 1.07031262e+00, 3.90325516e-01, 9.45663303e-02, -8.35210085e-01, -1.21028841e-01, -1.61372471e+00, 1.09380625e-01, -1.59053236e-01, -2.58469820e-01, -5.18571377e-01, 3.15038502e-01, -6.21809185e-01, 1.38990045e-01, 1.67350203e-01, 3.30487221e-01, 7.23021626e-01, 2.61946917e-02, 1.08872366e+00, 3.58943760e-01, 8.15560222e-02, -1.10836700e-01, 1.13304579e+00, 1.04639006e+00, -4.26227301e-01, 1.05273044e+00, 6.38412178e-01, -6.83263779e-01, -7.28904009e-02, 8.67998898e-01, 9.42042649e-01, 1.05305696e+00, -5.23684144e-01, -1.82113022e-01, -1.05253243e+00, -7.09312260e-02, 1.22970134e-01, 6.60896778e-01, 9.44130838e-01, -1.19117057e+00, -4.81023014e-01, -1.17151785e+00, 2.22483501e-01, -1.77511990e+00, -3.02142978e-01, -7.96750426e-01, -1.64792848e+00, -4.40994382e-01, -1.09868455e+00, -5.65342665e-01, 3.71169806e-01, 6.77822471e-01, 7.26896048e-01, 5.60501277e-01, -2.84232572e-03, 1.48416114e+00, -2.80948758e-01, 1.86195932e-02, -1.25779772e+00, 1.01117504e+00, 3.95043612e-01, -1.06091559e+00, 4.55376178e-01, 5.90852499e-01, -3.76404703e-01, -1.27505803e+00, 8.27442050e-01, 3.85000587e-01, 1.18777728e+00, 1.92020565e-01, 8.64256859e-01, 1.10247850e+00, -4.77612466e-01, -4.49791044e-01, 4.36293602e-01, -2.63684958e-01, 4.44416553e-01, -4.19982970e-01, 5.77375650e-01, -3.79977077e-01, 3.84563029e-01, -5.36517262e-01, -5.43187335e-02, -1.10158217e+00, -5.05689621e-01, -1.06836462e+00, -9.12110388e-01, -2.28145525e-01, 6.85708761e-01, -1.44891381e-01, 7.85060003e-02, 1.71833351e-01, 2.17102796e-01, 8.75280976e-01, 5.29666305e-01, 2.00214505e-01, 3.49758655e-01, -8.35674644e-01, 9.26342085e-02, 1.84430435e-01, 3.72666001e-01, -2.19136089e-01, 5.18518388e-01, -6.22629523e-02, 7.33491540e-01, -2.63249248e-01, -2.67214417e-01, 7.73090571e-02, -6.45493627e-01, -3.19644272e-01, -2.89276928e-01, 3.45991284e-01, 5.67886233e-03, -2.49789566e-01, 1.04345548e+00, -8.97620797e-01, 2.59745389e-01, -2.35038638e-01, 9.35924470e-01, 1.03495073e+00, 9.25333023e-01, 2.22500831e-01, 2.08737642e-01, 3.27550352e-01, -6.99261762e-03, -3.94405961e-01, 2.15240449e-01, -4.14843351e-01, 6.27586007e-01, 3.00344199e-01, 1.09458768e+00, 7.59830773e-02, -6.83943391e-01, 1.67123511e-01, -5.07802606e-01, -2.70432144e-01, -6.21037364e-01, 9.64937747e-01, 1.25556087e+00, -3.15922976e-01, -5.63388944e-01, -1.46975935e-01, 1.02344620e+00, -4.48462069e-01, 9.04044926e-01, -2.81636208e-01, 1.05440784e+00, 2.14560971e-01, 7.86892548e-02, -1.28740996e-01, -5.30646369e-02, -7.13777184e-01, -3.04264992e-01, -5.53258777e-01, 4.91248667e-01, -5.39805472e-01, -8.68568122e-01, 8.64456892e-01, -9.18175802e-02, 4.13068295e-01, -2.08863601e-01, 4.28583443e-01, 1.23620534e+00, -8.92189264e-01, 1.37983215e+00, 4.38869357e-01, -3.87700319e-01, 1.12864268e+00, -5.82494810e-02, 1.43608093e-01, -5.40578723e-01, 1.17179848e-01, 2.51674443e-01, -1.42769992e-01, -1.31010675e+00, -8.51148784e-01, -1.48061931e-01, 2.58323908e-01, 3.67341787e-02, -7.23920584e-01, -9.88820434e-01, -1.39375091e-01, -1.14198053e+00, -7.28593171e-02, -1.04956701e-01, -5.85499108e-01, -6.31171286e-01, -5.10103285e-01, 1.05367959e+00, -6.68842137e-01, 4.63386625e-02, -9.96850908e-01, -9.28651869e-01, 7.93903470e-01, -8.99808407e-01, 8.27691436e-01, 9.12066579e-01, -4.78461653e-01, 8.14078569e-01, 6.02525920e-02, 5.26673317e-01, -5.26469648e-01, -7.05779612e-01, -1.71829477e-01, 1.62325189e-01, 2.85767645e-01, 5.12952507e-01, -1.45051509e-01, 1.37109146e-01, 1.83014393e-01, -1.55559137e-01, 2.12739974e-01, -9.23290730e-01, -1.19877413e-01, 2.81804621e-01, 3.34185094e-01, 1.39511657e+00, -5.90442002e-01, 5.74788213e-01, 1.24385524e+00, -7.21555293e-01, 8.28844130e-01, -8.85802656e-02, -4.08442408e-01, 6.71276212e-01, 1.09820986e+00, -3.75631481e-01, -1.33836254e-01, 6.32796347e-01, -2.02802300e-01, 6.25178933e-01, 6.77876830e-01, -2.75646240e-01, -5.96459627e-01, -2.86792219e-01, -8.54366064e-01, 8.39510620e-01, -1.31479844e-01, 3.25115770e-01, -4.99351650e-01, 2.03135818e-01, -1.43900430e+00, -2.20209926e-01, -2.65229672e-01, 7.82352269e-01, -5.65962434e-01, -3.06415796e-01, 1.99779794e-01, -8.66775632e-01, 4.85115051e-01, 1.44741565e-01, -6.92898750e-01, -2.17116451e+00, -4.12736893e-01, 3.95528555e-01, -1.70124784e-01, 1.67738914e-01, 1.08319551e-01, -8.58196616e-01, -7.99020886e-01, -1.58257377e+00, 7.09277153e-01, -6.97348595e-01, -3.49428415e-01, -1.84181049e-01, -1.62712783e-01, 3.94277692e-01, 7.23135471e-01, 9.47946787e-01, 5.40045500e-01, -8.75189006e-01, -1.86740071e-01, -3.83477867e-01, -3.24022211e-02, 8.44550133e-01, 5.08218348e-01, 1.74616441e-01, 9.65049744e-01, 1.43482059e-01, -4.31216598e-01, -2.10186943e-01, -5.37824035e-01, -3.14835757e-01, -1.09177876e+00, 1.27525091e+00, -7.89696574e-01, -7.59191632e-01, 1.91085026e-01, -2.13713408e-01, 9.87634897e-01, 7.08811343e-01, 1.55087793e+00, 2.73356378e-01, 6.54023588e-01, -8.55911076e-01, 1.92686439e-01, -1.50089972e-02, 2.38779679e-01, 1.49614379e-01, 3.62314701e-01, 6.94537103e-01, -3.87004137e-01, 2.10883880e+00, -3.75697196e-01, -1.82452798e-01, -3.22899401e-01, -8.25561047e-01, 1.80501044e+00, 5.33488870e-01, 2.24471204e-02, 6.21750236e-01, 1.03810385e-01, -9.79628026e-01, 9.70385015e-01, -7.47687459e-01, -4.07829493e-01, 1.48922369e-01, -1.19734859e+00, -3.71993333e-01, 4.34708387e-01, -8.65958393e-01, -5.35230339e-01, 1.72286785e+00, 2.20375031e-01, 5.11880279e-01, -7.53360510e-01, 1.08028436e+00, -4.57028896e-01, -1.50861815e-02, 7.17765152e-01, 4.38092917e-01, 3.15289497e-01, 2.67259568e-01, 6.93954825e-02, 3.62798750e-01, 1.36038041e+00, 1.30169702e+00, -4.57468122e-01, -4.37783718e-01, -5.08757949e-01, 8.63207519e-01, -2.89590597e-01, 1.10191441e+00, 1.98435009e-01, 3.19641560e-01, -1.21980719e-01, 1.29272318e+00, 1.45268068e-01, 1.14542401e+00, -4.47698474e-01, 5.11548400e-01, -2.13712007e-01, 7.16760218e-01, 3.56799394e-01, -8.98992419e-01, 2.53364801e-01, 2.46685684e-01, 2.20981494e-01, 2.45370770e+00, -1.58328819e+00, -4.75152791e-01, -6.23002470e-01, 6.19043648e-01, 7.42533743e-01, -4.50964779e-01, 8.05252671e-01, 7.01121390e-02, 1.94267094e-01, 9.58551466e-01, -2.75623322e-01, -4.63303924e-01, -1.89976543e-01, 7.89426208e-01, 5.38144112e-01, 6.55530512e-01, -8.33069980e-01, -7.98664808e-01, 8.72453809e-01, 2.56688178e-01, -1.63096809e+00, -7.62300074e-01, -2.44294450e-01, -1.18391609e+00, -3.18642884e-01, 2.10066810e-01, 1.68145791e-01, -6.57323003e-03, 6.80729449e-01, 1.39025539e-01, 3.32543373e-01, -4.70169991e-01, 2.51329923e+00, -7.84055650e-01, 6.36785984e-01, -2.01801226e-01, -6.74835324e-01, 5.39556563e-01, 6.31205678e-01, 3.46641839e-01, -1.85673684e-02, -2.24657819e-01, 8.87112379e-01, -3.31156075e-01, -6.33936048e-01, -7.78989196e-01, -7.24589527e-01, -8.97557616e-01, -1.19332623e+00, 9.22472417e-01, -7.65920877e-01, 3.12098682e-01, -1.39098316e-02, -8.49792808e-02, 1.01152039e+00, 2.23431200e-01, -1.90913692e-01, 2.77387857e-01, -1.03543140e-02, -7.31578097e-03, 2.77540356e-01, 6.14465535e-01, 1.22704911e+00, -1.18605226e-01, 4.48604554e-01, 3.99403453e-01, 9.76211205e-02, -2.72304147e-01, -6.34450793e-01, -8.57364178e-01, -6.94554448e-01, -3.04330140e-01, 1.05320036e-01, 1.73476115e-01, 1.00599945e+00, 3.46087098e-01, 3.30770224e-01, -2.74857372e-01, -2.06077129e-01, 7.10511386e-01, 1.58540100e-01, -5.68631530e-01, -3.54029030e-01, -1.38866380e-01, -1.23456165e-01, 5.68514943e-01, 2.85906672e-01, -1.28487337e+00, -9.45348591e-02, 4.24727708e-01, 3.99977595e-01, 2.40924731e-01, -4.46219951e-01, 8.51806283e-01, 1.41895026e-01, -5.66927195e-01, -1.45217299e-01, 4.25449193e-01, -3.61947298e-01, 7.06071258e-01, -5.11380136e-01, -6.05433211e-02, -9.70409751e-01, -4.07448590e-01, -1.02107680e+00],"limit": 4,"with_payload": true
    }
    
  • 输出

  • {"result": [{"id": 3,"version": 0,"score": 0.9361942,"payload": {"sentence": "老王是程序员"}}, {"id": 4,"version": 0,"score": 0.9035911,"payload": {"sentence": "老王是开发者"}}, {"id": 2,"version": 0,"score": 0.88393474,"payload": {"sentence": "老王是研发"}}, {"id": 1,"version": 0,"score": 0.8612121,"payload": {"sentence": "老王是领导"}}],"status": "ok","time": 0.000412088
    }
    

使用"老王爱汇报"查询

  • {"result": [{"id": 1,"version": 0,"score": 0.8335363,"payload": {"sentence": "老王是领导"}},{"id": 2,"version": 0,"score": 0.81425905,"payload": {"sentence": "老王是研发"}},{"id": 4,"version": 0,"score": 0.80951333,"payload": {"sentence": "老王是开发者"}},{"id": 3,"version": 0,"score": 0.7966002,"payload": {"sentence": "老王是程序员"}}],"status": "ok","time": 0.000405555
    }
    
  • 使用上述两个示例, 帮助我们更好的感受文本相似度。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/55184.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

用于高频交易预测的最优输出LSTM

用于高频交易预测的最优输出LSTM J.P.Morgan的python教程 Content 本文提出了一种改进的长短期记忆(LSTM)单元,称为最优输出LSTM(OPTM-LSTM),用于实时选择最佳门或状态作为最终输出。这种单元采用浅层拓…

Study-Oracle-10-ORALCE19C-RAC集群搭建(一)

一、硬件信息及配套软件 1、硬件设置 RAC集群虚拟机:CPU:2C、内存:10G、操作系统:50G Openfile数据存储:200G (10G*2) 2、网络设置 主机名公有地址私有地址VIP共享存储(SAN)rac1192.168.49.13110.10.10.20192.168.49.141192.168.49.130rac2192.168.49.13210.10.10.3…

C++继承的默认方式到底是public还是private?

先说结论,C继承的默认方式: 1、对于类(class)来说默认是private 2、对于结构体(struct)来说默认是public [ACCESS] 的默认值 类继承的基本语法: class Rectangle: [ACCESS] Polygon { /* … */ } 冒号(:)后的[ACCES…

WaterCloud:一套基于.NET 8.0 + LayUI的快速开发框架,完全开源免费!

前言 今天大姚给大家分享一套基于.NET 8.0 LayUI的快速开发框架,项目完全开源、免费(MIT License)且开箱即用:WaterCloud。 可完全实现二次开发让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本&…

HTML+CSS 基础第三季课堂笔记

一、CSS基础概念 CSS有两个重要的概念,分别是样式和布局 CSS的样式分为两种,一种是文字的样式,一种是盒模型的样式 CSS的另一个重要的特性就是辅助页面布局,完成HTML不能完成的功能,比如并排显示,比如精…

JAVA全球互联同城速达国际版同城跑腿快递代取帮买帮送一体化服务系统源码

全球互联,便捷生活新篇章! 🌟 开篇:跨越国界的即时服务革命 在这个快节奏的时代,你是否也曾为忙碌的生活而烦恼?购物、取件、送物……这些日常琐事似乎总在不经意间占据了我们宝贵的时间。但现在&#xf…

论文的研究工具有什么?推荐5款AI论文写作网站

在当今的学术研究和写作领域,AI工具已经成为不可或缺的助手。这些工具不仅能够提高写作效率,还能帮助研究者生成高质量的论文。以下是一些值得推荐的AI论文写作工具: 千笔-AIPassPaper 千笔-AIPassPaper是一款基于深度学习和自然语言处理技…

51单片机学习第六课---B站UP主江协科技

DS18B20 1、基本知识讲解 2、DS18B20读取温度值 main.c #include<regx52.h> #include"delay.h" #include"LCD1602.h" #include"key.h" #include"DS18B20.h"float T; void main () {LCD_Init();LCD_ShowString(1,1,"temp…

64 注意力机制_by《李沐:动手学深度学习v2》pytorch版

系列文章目录 文章目录 系列文章目录注意力机制&#xff08;或叫注意力池化&#xff09;[**生成数据集**]平均汇聚非参数注意力汇聚[**带参数注意力汇聚**]批量矩阵乘法定义模型训练 小结练习 注意力机制&#xff08;或叫注意力池化&#xff09; 卷积、全连接、池化层都只考虑…

Mac制作Linux操作系统启动盘

前期准备 一个 Mac 电脑 一个 U 盘&#xff08;8GB 以上&#xff09; 下载好 Linux 系统镜像&#xff08;iso 文件&#xff09; 具体步骤 挂载 U 盘 解挂 U 盘 写系统镜像到 U 盘 完成 一、挂载 U 盘 首先插入 U 盘&#xff0c;打开终端输入下面的命令查看 U 盘是否已经 m…

HarmonyOS NEXT:实现电影列表功能展示界面

时至今日HarmonyOS NEXT早已发布运行了&#xff0c;等其正式推出并大规模商用后&#xff0c;HarmonyOS的历史使命就完成并将退出历史舞台&#xff0c;为用户提供丰富的应用选择。但是Harmony NEXT是在HarmonyOS基础上剔除安卓&#xff08;AOSP&#xff09;后的产品&#xff0c;…

自动驾驶系列—自动驾驶MCU架构全方位解析:从单核到多核的选型指南与应用实例

&#x1f31f;&#x1f31f; 欢迎来到我的技术小筑&#xff0c;一个专为技术探索者打造的交流空间。在这里&#xff0c;我们不仅分享代码的智慧&#xff0c;还探讨技术的深度与广度。无论您是资深开发者还是技术新手&#xff0c;这里都有一片属于您的天空。让我们在知识的海洋中…

工作笔记【四】

对于这种&#xff0c;样式一样&#xff0c;但是图片和字体颜色不一样&#xff0c;动态渲染。 代码&#xff1a; <template><view class"page"><view class"rows" v-for"item in data"><view class"v0"><v…

基于解压缩模块的JPEG同步重压缩检测论文学习

一、论文基本信息&#xff1a; 论文题目&#xff1a;基于解压缩模块的JPEG同步重压缩检测 作者&#xff1a;王金伟1 &#xff0c;胡冰涛1 &#xff0c;张家伟1 &#xff0c;马 宾2 &#xff0c;罗向阳3 &#xff08;1.南京信息工程大学计算机学院、网络空间安全学院&#xf…

Footprint Growthly Quest 工具:赋能 Telegram 社区实现 Web3 飞速增长

作者&#xff1a;Stella L (stellafootprint.network) 在 Web3 的快节奏世界里&#xff0c;社区互动是关键。而众多 Web3 社区之所以能够蓬勃发展&#xff0c;很大程度上得益于 Telegram 平台。正因如此&#xff0c;Footprint Analytics 精心打造了 Growthly —— 一款专为 Tel…

阿里大模型算法岗面试,上来就手撕代码啊

最近已有不少大厂都在秋招宣讲了&#xff0c;也有一些在 Offer 发放阶段。 节前&#xff0c;我们邀请了一些互联网大厂朋友、今年参加社招和校招面试的同学。 针对新手如何入门算法岗、该如何准备面试攻略、面试常考点、大模型技术趋势、算法项目落地经验分享等热门话题进行了…

怎样才能写出好的知识竞赛活动策划方案

好的知识竞赛活动策划方案是抄不会的&#xff0c;尤其是抄一堆烂方案的话&#xff0c;只会让你走偏。首要的是建立策划底层思维&#xff0c;搞清楚如何从策划角度思考问题和解决问题。注意读、思、学&#xff0c;读&#xff1a;大量读策划案例和营销案例&#xff0c;分析总结和…

当贝播放器 1.5.0 畅享原画,支持阿里网盘、杜比视界和8K播放

当贝播放器TV是一款专为智能电视设计的视频播放器&#xff0c;具有强大的解码能力&#xff0c;支持阿里网盘、百度网盘等网盘资源导入。此外&#xff0c;还支持外部设备导入&#xff0c;并能自动匹配电影海报封面、内容介绍和剧照。 大小&#xff1a;47.3M 百度网盘&#xff1…

【ARM】MDK-当选择AC5时每次点击build都会全编译

【更多软件使用问题请点击亿道电子官方网站】 1、 文档目标 解决MDK中选择AC5时每次点击build都会全编译 2、 问题场景 在MDK中点击build时&#xff0c;正常会只进行增量编译&#xff0c;但目前每次点击的时候都会全编译。 3、软硬件环境 1 软件版本&#xff1a;Keil MDK 5.…

html+css+js实现dialog对话框

实现效果 HTML部分 <span class"text">点击打开 Dialog</span><!-- 警告框 --><div class"alert"><div class"header"><i>X</i> </div><div class"content">确认关闭</di…