CoolFace
Modelpublic

oguuzhansahin/bi-encoder-mnrl-dbmdz-bert-base-turkish-cased-margin_3.0-msmarco-tr-10k

sourceHugging Faceupdated 3y agoView on Hugging Face
10likes464downloads
Model Card

oguuzhansahin/bi-encoder-mnrl-dbmdz-bert-base-turkish-cased-margin_3.0-msmarco-tr-10k

This is a sentence-transformers model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.

<!--- Describe your model here -->

Usage (Sentence-Transformers)

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

python
from sentence_transformers import SentenceTransformer, util

model = SentenceTransformer('oguuzhansahin/bi-encoder-mnrl-dbmdz-bert-base-turkish-cased-margin_3.0-msmarco-tr-10k')

query = "İstanbul'un nüfusu kaçtır?"

sentences = ["İstanbul'da yaşayan insan sayısı 15 milyonu geçmiştir",
             "Londra'nın nüfusu yaklaşık 9 milyondur.",
             "İstanbul'da hayat çok zor."]

query_embedding = model.encode(query, convert_to_tensor=True)
sentence_embeddings = model.encode(sentences, show_progress_bar=True)

#Compute dot score between query and all document embeddings
scores = util.dot_score(query_embedding, sentence_embeddings)[0].cpu().tolist()

#Combine docs & scores
doc_score_pairs = list(zip(sentences, scores))

#Sort by decreasing score
doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)

#Output passages & scores
for doc, score in doc_score_pairs:
    print(score, doc)

## Expected Output:
400.1816711425781 | İstanbul'da yaşayan insan sayısı 15 milyonu geçmiştir
309.97796630859375 | Londra'nın nüfusu yaklaşık 9 milyondur.
133.04507446289062 | İstanbul'da hayat çok zor.

Evaluation Results

<!--- Describe how your model was evaluated --> Evaluated on 10k query translated MSMARCO dev dataset.

epochstepscos_sim-Accuracy@1cos_sim-Accuracy@3cos_sim-Accuracy@5cos_sim-Accuracy@10cos_sim-Precision@1cos_sim-Recall@1cos_sim-Precision@3cos_sim-Recall@3cos_sim-Precision@5cos_sim-Recall@5cos_sim-Precision@10cos_sim-Recall@10cos_sim-MRR@10cos_sim-NDCG@10cos_sim-MAP@100dot_score-Accuracy@1dot_score-Accuracy@3dot_score-Accuracy@5dot_score-Accuracy@10dot_score-Precision@1dot_score-Recall@1dot_score-Precision@3dot_score-Recall@3dot_score-Precision@5dot_score-Recall@5dot_score-Precision@10dot_score-Recall@10dot_score-MRR@10dot_score-NDCG@10dot_score-MAP@100
05000.65257879656160460.78080229226361030.81977077363896840.86117478510028660.65257879656160460.63015759312320920.272779369627507150.77206303724928370.172865329512893960.81307306590257880.09123209169054440.85648280802292260.72470573520716690.75401797894452020.72295773846330340.58839541547277940.73409742120343830.77994269340974210.8338108882521490.58839541547277940.56721585482330470.255778414517669530.72429560649474690.164212034383954130.7726480420248330.088108882521489980.827745940783190.67128774957929650.70601578177617270.6695710889515925
010000.69111747851002870.81017191977077360.84355300859598860.88467048710601710.69111747851002870.66723973256924540.28338108882521490.80150429799426940.178223495702005740.8374403056351480.093868194842406880.8807306590257880.7576611179333230.78483924253655910.75560745343643940.63094555873925510.7676217765042980.81375358166189120.86017191977077370.63094555873925510.60861986628462260.26719197707736390.75723495702005730.171604584527220660.80687679083094550.0911891117478510.8553366762177650.70881293491608590.74127982934913120.7066932344452895
015000.71518624641833810.83065902578796560.86088825214899710.8971346704871060.71518624641833810.69124880611270290.290544412607449840.82228987583572110.181833810888252150.85496657115568290.095100286532951290.89295606494746890.77885079819893470.80398758245117520.77660512827388950.65845272206303730.79011461318051580.83080229226361040.87449856733524360.65845272206303730.6361628462273160.275692454632282760.78051575931232090.17498567335243550.82353151862464180.092578796561604590.86930515759312320.73282206531131940.76301033374674420.7306729678612995
0-10.72994269340974220.83853868194842410.86776504297994270.90128939828080230.72994269340974220.7057306590257880.29360076408787010.83045606494746890.183495702005730680.86230897803247370.095544412607449850.8970152817574020.79012405057533920.81356261975614370.7878304939353520.67879656160458460.80315186246418340.83739255014326650.8823782234957020.67879656160458460.65610076408787020.28018147086914990.79330229226361030.176532951289398250.83037249283667620.093481375358166180.87773400191021970.7482561854732330.77673038602044610.7458413737625622
15000.73295128939828080.84226361031518630.87550143266475640.90616045845272210.73295128939828080.70838108882521490.29479465138490930.83401384909264550.18487106017191980.86930515759312320.09610315186246420.90226838586437440.79400338836585090.81775621787608350.79143928242095060.68022922636103160.80787965616045840.84541547277936970.88481375358166190.68022922636103160.65667382999044890.2823782234957020.79886580706781270.178194842406876770.83808500477554910.093696275071633240.87995463228271240.75162607449856720.77980583711791870.7490502934740975
110000.7295128939828080.8414040114613180.8752148997134670.91131805157593130.7295128939828080.70508595988538680.294508118433619850.83351241642788910.184699140401146130.86909025787965620.096561604584527230.90711556829035340.79322781643698510.81822193633502650.79036624390520120.68438395415472770.81017191977077360.85329512893982810.89255014326647560.68438395415472770.66121060171919770.28252148997134670.80059694364851950.179656160458452730.84607211079274110.094484240687679080.88794173829990440.75605141674625850.78498824433956250.7531013420305113
115000.74498567335243550.85243553008595980.88180515759312320.91647564469914040.74498567335243550.72029608404966560.2985673352435530.84471107927411650.186160458452722080.87597898758357210.097306590257879660.91322827125119390.80564430117796780.82943546614937770.80320451748549950.70042979942693410.82177650429799430.85931232091690550.90071633237822350.70042979942693410.67668338108882520.287058261700095460.81300143266475640.1814326647564470.85315186246418340.095458452722063030.89662129894937910.76923335379997180.79724240772720820.7664284653213875
1-10.73438395415472780.84871060171919770.8776504297994270.91160458452722060.73438395415472780.71015998089780320.297277936962750730.84086676217765040.185214899713467080.87169293218720160.096633237822349570.90777220630372490.79743507527175040.82180121521540550.79504163522805920.68710601719197710.81418338108882530.85200573065902570.89412607449856730.68710601719197710.6635625596943650.28409742120343840.80465616045845270.179799426934097420.84560649474689590.094613180515759330.88931470869149940.75886501114294640.78734556190468030.7557920076739941
25000.72535816618911180.83739255014326650.8723495702005730.90601719197707740.72535816618911180.7010983763132760.293266475644699150.82916666666666660.184269340974212050.86639207258834760.095974212034383970.90191021967526260.7886370355209880.81341149081352150.78593457264379680.67263610315186250.80386819484240690.8442693409742120.88624641833810890.67263610315186250.64942693409742120.28051575931232090.794209646609360.178108882521489960.83736867239732560.093839541547277960.88159025787965620.74672880565788760.77644233347925360.7442459199666945
210000.73467048710601720.8457020057306590.87650429799426930.91060171919770770.73467048710601720.7104584527220630.296131805157593130.83754775549188150.185214899713467080.87083333333333320.096547277936962760.90694842406876790.79678446354664060.8210805940295860.79440730811881380.68510028653295130.81432664756446990.84842406876790830.89197707736389690.68510028653295130.66202244508118440.28433619866284620.80524116523400190.17919770773638970.84215616045845280.094455587392550140.88763132760267430.75762740483012680.7863746432305530.7553079432262348
215000.73510028653295130.84785100286532960.87965616045845270.91146131805157590.73510028653295130.71053008595988540.29675262655205340.83962511938872960.185787965616045880.87384192932187190.096647564469914060.90781996179560640.79695240369309060.82135783187797870.79444095563388670.69555873925501430.81919770773638970.85716332378223490.89656160458452730.69555873925501430.67194364851957980.28643744030563510.81056590257879660.18065902578796560.85039398280802290.094971346704871080.89241881566380130.76518584845590560.79316680582085810.7625478945876472
2-10.73309455587392550.84598853868194850.87965616045845270.90988538681948430.73309455587392550.70829751671442210.296131805157593130.83759551098376310.185644699140401130.87338825214899720.096489971346704870.90589780324737330.79523138672852010.81948904042989790.79246711053185370.68925501432664760.81561604584527230.85372492836676220.89512893982808030.68925501432664760.66617717287488050.284861509073543460.80611270296084040.179942693409742120.84680038204393490.094785100286532960.89050859598853870.7604385546004450.78903386973082070.7575932457133956
35000.72808022922636110.84584527220630370.8805157593123210.90945558739255020.72808022922636110.7037846227316140.296131805157593130.83767908309455590.185959885386819480.87472540592168090.096375358166189110.90530085959885390.79301087005957860.81793719830311880.79060951809924120.6866762177650430.8114613180515760.85257879656160460.89670487106017190.6866762177650430.6639326647564470.283715377268385860.80261461318051570.179742120343839520.84574976122254050.094928366762177670.89212034383954150.75905171237549440.78849451476226460.7564213901145882
310000.7276504297994270.84527220630372490.87822349570200580.90945558739255020.7276504297994270.70370105062082130.295749761222540540.83707020057306590.18532951289398280.87178844317096460.096389684813753580.90546800382043920.792319666166370.81735481823156570.78974946677204860.68724928366762170.81776504297994270.85415472779369630.89455587392550140.68724928366762170.66409980897803230.28576886341929320.80895415472779380.179971346704871050.84714660936007650.094656160458452720.88962511938872970.75907951289398270.78780209862151410.7562928001653756
315000.7309455587392550.84785100286532960.87879656160458450.91002865329512890.7309455587392550.70672158548233030.29684813753581660.83976838586437450.185358166189111770.87233763132760260.096432664756446990.90592168099331420.79470272206303630.81912060056005530.79187704987136390.68954154727793690.81532951289398280.85358166189111750.89498567335243550.68954154727793690.66653533906399230.28481375358166190.80624403056351480.179885386819484240.84656160458452720.094627507163323780.88987583572110780.76051337153772660.78888429178942960.7576483206453933
3-10.73194842406876790.84928366762177650.88137535816618910.91060171919770770.73194842406876790.70765281757402090.29737344794651380.84145176695319960.18604584527220630.87527459407831890.096504297994269350.90644699140401140.79568790649019680.82015401523758010.79308777267710910.68939828080229230.81776504297994270.8561604584527220.89770773638968480.68939828080229230.66617717287488050.28548233046800380.8084169054441260.180372492836676220.84917621776504290.094914040114613190.89255014326647560.7614334606813110.79018289532588670.7583172945055513
45000.7295128939828080.84369627507163330.8766475644699140.91017191977077360.7295128939828080.7052411652340020.295415472779369640.83567335243553010.185100286532951320.87060649474689590.096532951289398270.90635148042024830.79334140628553170.81835349816984490.79084154713591640.68624641833810880.81418338108882530.85272206303724930.8952722063037250.68624641833810880.66319245463228270.28438395415472780.8050023877745940.179770773638968480.84584527220630370.094713467048710610.89042502387774580.75853549824896480.78752934496295530.7557095120190159
410000.72936962750716330.84269340974212040.87722063037249290.91074498567335240.72936962750716330.70513371537726830.29503342884431710.83467048710601720.185186246418338140.87108404966571150.096518624641833820.90667382999044890.79265338609178030.81777533647418750.78984421832830920.68896848137535820.81318051575931230.85315186246418340.89555873925501430.68896848137535820.66572349570200570.28366762177650430.8035697230181470.179684813753581670.84596466093600760.094713467048710610.89047277936962750.7601489516532490.78866596717817660.7571659283553608
415000.73266475644699140.84355300859598860.87879656160458450.91174785100286540.73266475644699140.7084169054441260.295463228271251150.8357927411652340.18544412607449860.8727435530085960.096590257879656170.90765281757402090.79487492609268950.819815611794380.79220472061364930.68896848137535820.81733524355300860.85372492836676220.8952722063037250.68896848137535820.66577125119388720.285291308500477570.80808261700095510.179885386819484240.84688395415472780.094727793696275080.89050859598853870.76116540455723820.78960387290035260.7582836411869348
4-10.7309455587392550.84297994269340970.87736389684813750.91275071633237830.7309455587392550.70669770773638970.295319961795606430.83536294173830.18512893982808020.87113180515759310.096676217765042970.90848853868194850.79393260790466940.81915846658734880.79100642521069390.69054441260744980.81633237822349570.8528653295128940.89512893982808030.69054441260744980.66744269340974220.28495702005730660.80703199617956060.179713467048710580.84600047755491880.094699140401146130.890245940783190.76165859371446780.78988791318972660.7588026826359487
55000.72922636103151860.84169054441260750.8776504297994270.91060171919770770.72922636103151860.70485912129894930.294937917860553960.83420487106017190.185300859598853870.87183619866284610.096461318051575940.90633954154727790.79271876563423730.8177778588989320.78994273049312610.68939828080229230.81532951289398280.85300859598853870.89340974212034390.68939828080229230.66601002865329520.284861509073543460.80642311365807060.179656160458452730.8458572110792740.094555873925501440.88874164278892060.76038721744667310.78847517723474130.7574401114646502510000.72979942693409740.84197707736389680.87693409742120340.90845272206303730.72979942693409740.70545606494746890.294890162368672440.83421680993314230.185186246418338090.87128701050620830.096232091690544420.90419054441260750.79251370127802620.8171518263874730.78992570581940140.69054441260744980.81776504297994270.85401146131805160.89340974212034390.69054441260744980.66704871060171920.28553008595988540.80861986628462270.179914040114613180.84714660936007640.094541547277936980.88877745940783180.76119701414472170.78906031852080980.758136309854029
515000.72936962750716330.84083094555873930.87722063037249290.90931232091690540.72936962750716330.70516953199617950.294460362941738330.83292741165234010.185157593123209150.8711914995224450.096346704871060170.90516953199617960.79233649429208040.81719344433843620.78958214779015670.6899713467048710.81704871060171920.85372492836676220.89297994269340970.6899713467048710.6665830945558740.285291308500477570.807927411652340.179828080229226360.84676456542502390.094498567335243560.88825214899713470.7609937690453450.78879287379353770.7579401229598806
5-10.7295128939828080.84097421203438390.87707736389684810.90931232091690540.7295128939828080.70531279847182430.29450811843361990.83307067812798490.185157593123209150.87111986628462270.096346704871060170.90516953199617960.79239459680720290.81723764945722290.7896432063015420.6899713467048710.81704871060171920.85372492836676220.89283667621776510.6899713467048710.6665830945558740.285291308500477570.807927411652340.179828080229226360.84676456542502390.094484240687679080.888108882521490.76095044799199520.7887272156522730.7579130219416423

Training

The model was trained with the parameters:

DataLoader:

torch.utils.data.dataloader.DataLoader of length 311 with parameters:

{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}

Loss:

sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss with parameters:

  {'scale': 20.0, 'similarity_fct': 'cos_sim'}

Parameters of the fit()-Method:

{
    "epochs": 5,
    "evaluation_steps": 500,
    "evaluator": "sentence_transformers.evaluation.InformationRetrievalEvaluator.InformationRetrievalEvaluator",
    "max_grad_norm": 1,
    "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
    "optimizer_params": {
        "lr": 2e-05
    },
    "scheduler": "WarmupLinear",
    "steps_per_epoch": null,
    "warmup_steps": 1000,
    "weight_decay": 0.01
}

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
)

Citing & Authors

<!--- Describe where people can find more information -->