Deploying sentence transformer model as provided in this blog, using eland on Elasticsearch returns only the embedding corresponding to the first token. However, while using the python implementation to encode the text returns the pooled mean embeddings.
embeddings for paytm by python library is average of this token embeddings as a single array:
tensor([[-0.5932, 0.2360, 0.9183, ..., -0.6631, -0.1304, 0.5950],
[-0.6218, -0.5103, 0.9183, ..., -0.3577, 0.1628, 0.5489],
[-0.7060, 0.8069, 0.5988, ..., -0.8209, -0.0161, 0.3651],
[-0.5804, -0.1383, 1.1632, ..., -0.4210, -0.2995, 0.3780]])
embeddings for paytm by Elasticsearch:
{
"inference_results": [
{
"predicted_value": [
0.22763113677501678,
-0.14426757395267487,
-0.5313942432403564,
0.38780003786087036,
0.23178794980049133,
0.2520352303981781,
-0.1310071498155594,
0.1372310221195221,
0.8867185115814209,
0.28502148389816284,
-0.34933239221572876,
-0.048524804413318634,
-0.030298544093966484,
0.3023957908153534,
0.16458909213542938,
-0.22286038100719452,
-0.4322550594806671,
-0.17900292575359344,
0.41147494316101074,
0.5585047602653503,
0.3104747235774994,
-0.6178449392318726,
-0.10300447046756744,
-0.21040283143520355,
-0.18054519593715668,
0.37258920073509216,
-0.06892939656972885,
0.4433431029319763,
-0.49753281474113464,
-0.6661249995231628,
0.4594205617904663,
0.1055305227637291,
-0.04052606597542763,
0.6544049382209778,
-0.00035589560866355896,
0.5667051672935486,
-0.14461682736873627,
0.3525410294532776,
-0.05935198441147804,
-0.11387929320335388,
0.04457880184054375,
-0.19744209945201874,
-0.2772529125213623,
-0.21505369246006012,
0.07984670996665955,
-0.5984102487564087,
0.648749053478241,
0.03957577049732208,
-0.2774036228656769,
-0.43836915493011475,
-0.13032186031341553,
-0.04730977490544319,
0.13484464585781097,
0.38720041513442993,
0.3711908161640167,
-0.6393144726753235,
0.5307539105415344,
-0.4074456989765167,
-0.17671692371368408,
0.04556211456656456,
-0.4378435015678406,
-0.5093674063682556,
-0.41535666584968567,
-0.14222007989883423,
0.32243072986602783,
-0.035575903952121735,
-0.8241013288497925,
0.35598224401474,
-0.1930820792913437,
0.10115426033735275,
-0.18606221675872803,
-0.2894442677497864,
0.014790929853916168,
-0.46368759870529175,
-0.1974625289440155,
0.2996467649936676,
0.13894493877887726,
-0.13177761435508728,
0.210512176156044,
-0.07767431437969208,
-0.1655813753604889,
0.451304167509079,
0.5005711913108826,
-0.03761318698525429,
0.13771039247512817,
0.4428074359893799,
0.3595246970653534,
0.10929585248231888,
0.39517447352409363,
-0.12278398871421814,
0.40418583154678345,
0.2836850881576538,
0.7709897756576538,
0.35056984424591064,
0.5010964870452881,
-0.2106258124113083,
0.3735590875148773,
-0.2123080939054489,
-0.23633287847042084,
4.190859794616699,
0.9373717904090881,
0.26693618297576904,
-0.4606470763683319,
0.16023531556129456,
0.11719824373722076,
-0.1723480224609375,
0.001891970168799162,
0.32362309098243713,
-0.2978127896785736,
0.8658319711685181,
0.12660570442676544,
0.07594136148691177,
0.1375199258327484,
0.35534992814064026,
-0.5539746284484863,
0.15599387884140015,
-0.13606874644756317,
-0.47219544649124146,
-0.11688024550676346,
0.04422470182180405,
-0.5628999471664429,
0.5157653093338013,
0.0003223186358809471,
-0.7226400375366211,
-0.230352520942688,
-0.8993479013442993,
0.15943549573421478,
-0.14756599068641663,
-0.12611696124076843,
-0.05348636955022812,
-0.06012176722288132,
-0.3392755389213562,
-0.670730710029602,
-0.19131512939929962,
0.540212094783783,
0.4702330231666565,
0.3174777030944824,
0.10704193264245987,
0.27343031764030457,
-0.024485638365149498,
0.29616883397102356,
-0.2712949812412262,
-0.40323683619499207,
-0.1152970939874649,
-0.6109105944633484,
0.0476105697453022,
0.3698404133319855,
0.10193509608507156,
0.20707038044929504,
0.08452828228473663,
-0.5184361934661865,
-0.3315282464027405,
-0.015834353864192963,
-0.05709962919354439,
-0.1773345172405243,
-0.12852440774440765,
0.4265013337135315,
-0.7410590052604675,
0.18239693343639374,
0.2447529435157776,
-0.5534960627555847,
-0.25594016909599304,
0.19369451701641083,
-0.4599858224391937,
0.39168205857276917,
-0.3994428813457489,
-0.03455989435315132,
-0.7195948362350464,
-0.05066046491265297,
-0.649211585521698,
-0.4032367467880249,
0.3060555160045624,
-0.508898913860321,
0.3905222713947296,
-0.2485397756099701,
-0.11877850443124771,
0.023775644600391388,
-0.5504740476608276,
-0.2715173363685608,
0.03782191500067711,
0.051315758377313614,
0.35944855213165283,
-0.14557619392871857,
-0.9205848574638367,
-0.15760433673858643,
0.03252140060067177,
0.04119274020195007,
-0.07748888432979584,
0.1008782759308815,
-0.8629116415977478,
-0.1624283492565155,
-0.7425805926322937,
-0.35126468539237976,
0.10007870942354202,
-0.33232635259628296,
-0.051030684262514114,
0.31561392545700073,
0.10930152982473373,
0.4459870159626007,
0.15022096037864685,
0.42052289843559265,
0.49589547514915466,
0.03847932070493698,
-0.039301712065935135,
0.13951952755451202,
-0.0566532164812088,
0.12938320636749268,
0.7096655368804932,
-0.1356537938117981,
0.014559656381607056,
-0.3189936578273773,
0.0051023634150624275,
-0.045201703906059265,
-0.37529733777046204,
0.047298870980739594,
-0.29170912504196167,
-0.16526596248149872,
-0.33550798892974854,
-0.25210806727409363,
-0.20536242425441742,
-0.13906940817832947,
0.11860240250825882,
-0.04340652376413345,
-0.7233018279075623,
-0.1331174224615097,
-0.07978124916553497,
-0.06738846749067307,
0.6278455853462219,
0.5404669642448425,
-0.13116887211799622,
0.12284678965806961,
-0.46880680322647095,
0.04024381563067436,
0.5078399777412415,
0.04804232716560364,
-0.05504803732037544,
-0.369282603263855,
-0.2652692496776581,
0.12957318127155304,
0.6614379286766052,
-0.11627178639173508,
0.12523607909679413,
0.5214363932609558,
0.04885203391313553,
0.0536777563393116,
-0.31201857328414917,
0.07515550404787064,
0.6545552015304565,
-0.31832942366600037,
0.6508542895317078,
0.0718972235918045,
-0.618195652961731,
0.5038871765136719,
0.008811783976852894,
0.4164590537548065,
-0.15855854749679565,
-0.5688043236732483,
0.4058866798877716,
-0.3939337134361267,
-0.18349924683570862,
-0.22742922604084015,
0.11201909184455872,
-0.27650734782218933,
-0.10007217526435852,
-0.07031919807195663,
-0.04137275367975235,
0.20231564342975616,
0.7155093550682068,
0.881754994392395,
-0.7824999094009399,
-0.00576990470290184,
-0.1560748666524887,
0.3927711546421051,
-0.3355693221092224,
0.21854330599308014,
-0.12200477719306946,
-0.389082133769989,
-0.022180264815688133,
0.13669267296791077,
-0.3045346140861511,
0.6712400317192078,
0.08850947767496109,
0.08425739407539368,
0.036125488579273224,
0.09147649258375168,
-0.36862194538116455,
0.28320005536079407,
0.5554841756820679,
-0.26776692271232605,
-0.32163357734680176,
0.7347353100776672,
0.23886728286743164,
0.1397193968296051,
0.05582265183329582,
-0.15992748737335205,
0.1794859617948532,
-0.16006292402744293,
0.3651401400566101,
0.2118891328573227,
1.1367347240447998,
0.29052412509918213,
-0.6307929158210754,
-0.24623067677021027,
-0.006436658091843128,
0.31232452392578125,
0.10544918477535248,
-0.006761192809790373,
0.32247036695480347,
-0.3944847583770752,
0.7537521719932556,
-0.10560796409845352,
0.06467892229557037,
-0.33669328689575195,
0.2395411729812622,
-0.20653904974460602,
-0.0971890389919281,
-0.03428728133440018,
0.03297343850135803,
-0.1080745980143547,
-1.0874756574630737,
-0.18504175543785095,
-0.5369579792022705,
0.5190311670303345,
0.26966139674186707,
-0.35968539118766785,
0.060317639261484146,
-0.17809531092643738,
0.13922858238220215,
0.356803834438324,
0.08462706953287125,
0.21717974543571472,
-0.22614267468452454,
0.47436395287513733,
0.7518540024757385,
0.09135100990533829,
-0.007415523752570152,
0.12765496969223022,
0.2695424258708954,
0.08344051241874695,
-0.3245477080345154,
0.1493050903081894,
0.2552494704723358,
0.3694363534450531,
-0.2119334638118744,
-0.5604385733604431,
0.11661115288734436,
-0.5152119994163513,
0.5081479549407959,
-0.017947545275092125,
-0.25604650378227234,
-0.45127663016319275,
0.05397222563624382,
-0.043777838349342346,
-0.29821574687957764,
-0.6421034336090088,
0.0829707607626915,
0.7568528652191162,
-0.39516523480415344,
-0.6443259119987488,
0.1516796052455902,
-0.6404282450675964,
-0.5156242251396179,
-0.4068266451358795,
-0.4147300720214844,
-0.028562845662236214,
0.09917867183685303,
-0.30183061957359314,
0.23182949423789978,
-0.1346864402294159,
-0.4248684048652649,
0.7310291528701782,
-0.08360954374074936,
0.045938946306705475,
0.24128252267837524,
-0.2900591790676117,
-0.1171850860118866,
-0.8898353576660156,
-0.4099249541759491,
0.5582566857337952,
-0.3977157175540924,
-0.12525013089179993,
-0.13443447649478912,
0.24326668679714203,
0.08908563107252121
]
}
]
}
I want the embeddings from Elasticsearch same as python library returns. Can someone please help me to understand this.