Git Product home page Git Product logo

transformer's Introduction

Transformer LicenseGo.Dev referenceTravis CIGo Report Card

Overview

transformer is pure Go package to facilitate applying Natural Language Processing (NLP) models train/test and inference in Go.

This package is in active mode of building and there are many changes ahead. Hence you can use it with your complete own risk. The package will be considered as stable when version 1.0 is released.

transformer is heavily inspired by and based on the popular Python HuggingFace Transformers. It's also influenced by Rust version - rust-bert. In fact, all pre-trained models for Rust are compatible to import to this Go transformer package as both rust-bert's dependency Pytorch Rust binding - tch-rs and Go binding gotch are built with similar principles.

transformer is part of an ambitious goal (together with tokenizer and gotch) to bring more AI/deep-learning tools to Gophers so that they can stick to the language they love and good at and build faster software in production.

Dependencies

2 main dependencies are:

  • tokenizer
  • gotch

Prerequisites and installation

  • As this package depends on gotch which is a Pytorch C++ API binding for Go, a pre-compiled Libtorch copy (CPU or GPU) should be installed in your machine. Please see gotch installation instruction for detail.
  • Install package: go get -u github.com/sugarme/transformer

Basic example

    import (
        "fmt"
        "log"

        "github.com/sugarme/gotch"
        ts "github.com/sugarme/gotch/tensor"
        "github.com/sugarme/tokenizer"

        "github.com/sugarme/transformer/bert"
    )

    func main() {
        var config *bert.BertConfig = new(bert.BertConfig)
        if err := transformer.LoadConfig(config, "bert-base-uncased", nil); err != nil {
            log.Fatal(err)
        }

        var model *bert.BertForMaskedLM = new(bert.BertForMaskedLM)
        if err := transformer.LoadModel(model, "bert-base-uncased", config, nil, gotch.CPU); err != nil {
            log.Fatal(err)
        }

        var tk *bert.Tokenizer = bert.NewTokenizer()
        if err := tk.Load("bert-base-uncased", nil); err != nil{
            log.Fatal(err)
        }

        sentence1 := "Looks like one [MASK] is missing"
        sentence2 := "It was a very nice and [MASK] day"

        var input []tokenizer.EncodeInput
        input = append(input, tokenizer.NewSingleEncodeInput(tokenizer.NewInputSequence(sentence1)))
        input = append(input, tokenizer.NewSingleEncodeInput(tokenizer.NewInputSequence(sentence2)))

        encodings, err := tk.EncodeBatch(input, true)
        if err != nil {
            log.Fatal(err)
        }

        var maxLen int = 0
        for _, en := range encodings {
            if len(en.Ids) > maxLen {
                maxLen = len(en.Ids)
            }
        }

        var tensors []ts.Tensor
        for _, en := range encodings {
            var tokInput []int64 = make([]int64, maxLen)
            for i := 0; i < len(en.Ids); i++ {
                tokInput[i] = int64(en.Ids[i])
            }

            tensors = append(tensors, ts.TensorFrom(tokInput))
        }

        inputTensor := ts.MustStack(tensors, 0).MustTo(device, true)
        var output ts.Tensor
        ts.NoGrad(func() {
            output, _, _ = model.ForwardT(inputTensor, ts.None, ts.None, ts.None, ts.None, ts.None, ts.None, false)
        })
        index1 := output.MustGet(0).MustGet(4).MustArgmax(0, false, false).Int64Values()[0]
        index2 := output.MustGet(1).MustGet(7).MustArgmax(0, false, false).Int64Values()[0]

        got1, ok := tk.IdToToken(int(index1))
        if !ok {
            fmt.Printf("Cannot find a corresponding word for the given id (%v) in vocab.\n", index1)
        }
        got2, ok := tk.IdToToken(int(index2))
        if !ok {
            fmt.Printf("Cannot find a corresponding word for the given id (%v) in vocab.\n", index2)
        }

        fmt.Println(got1)
        fmt.Println(got2)
        
        // Output:
        // person
        // pleasant
    }

Getting Started

License

transformer is Apache 2.0 licensed.

Acknowledgement

transformer's People

Contributors

sugarme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

transformer's Issues

Example in readme gives wrong output

The following statement in basic example of README.md:

encodings, err := tk.EncodeBatch(input, true)

could cause two different encodings as described in tokenizer/tokenizer.go:
"EncodeBatch encodes all sentences in concurrency".
In fact, the EncodeBatch function lets the goroutines to concurrently execute the following action:

encodings = append(encodings, *e)

Therefore, since there are two sentences in the input, the encodings could be of two different orders: {sentence1, sentence2} and {sentence2, sentence1}. It is unmatched to the two statements after:

index1 := output.MustGet(0).MustGet(4).MustArgmax(0, false, false).Int64Values()[0]
index2 := output.MustGet(1).MustGet(7).MustArgmax(0, false, false).Int64Values()[0]

As mentioned above, we could either revise function EncodeBatch to make sure it returns encodings in a correct order, or recorrect the two output statements above to choose the right subtensors.

Hope this helps. I like your work very much.

This repo looks defunct: but prove me wrong :)

This looks really great! But 6 months of silence -- meanwhile transformers.py has made huge headways -- suggests this has fallen into disuse and is no longer active. But I hope I'm wrong!

"go mod tidy" error from sermo repo

I was looking to update the repo to work with the "tensorflow" package that has been renamed to "ts" one of the dependency projects but ran into this:

  1. Clone the repo.
  2. go mod tidy

You get a git "invalid version" error because something is trying to pull in github.com/sugarme/[email protected], and the repo seems to be private or deleted.

pipelines

create task specific pipelines in a sub-package pipeline

  • ConversationalPipeline
  • FeatureExtractionPipeline
  • FillMaskPipeline
  • QuestionAnsweringPipeline
  • SummarizationPipeline
  • TextClassificationPipeline
  • TextGenerationPipeline
  • TokenClassificationPipeline
  • TranslationPipeline
  • ZeroShotClassificationPipeline
  • Text2TextGenerationPipeline

And API transformer.Pipeline() wrapper at transformer package.

Update to gotch 0.9.0

Would be great to update transformer to work with https://github.com/sugarme/gotch/tree/v0.9.0

For example in /transformer/util/activation.go, the MustGelu method signature changed to accept a string and a bool:

func (g GeluActivation) Fwd(x *ts.Tensor) (retVal *ts.Tensor) {
	return x.MustGelu("???", false)
                           ^^^
}

Different Result on Same BERT Embedding Model

Transformer Code

	singleEncodeInput := tokenizer.NewSingleEncodeInput(tokenizer.NewInputSequence(text))

	encodingResult, err := s.tokenizer.Encode(singleEncodeInput, true)
	if err != nil {
		return
	}

	var attentionMask []float64
	for _, attentionMaskItem := range encodingResult.AttentionMask {
		attentionMask = append(attentionMask, float64(attentionMaskItem))
	}

	tokenIdsTensor := ts.TensorFrom(encodingResult.Ids).MustTo(s.compileMode, true)
	typeIdsTensor := ts.TensorFrom(encodingResult.TypeIds).MustTo(s.compileMode, true)

	positionalIdsTensor := ts.TensorFrom(encodingResult.Words).MustTo(s.compileMode, true)
	
	// If no Clamp, Error Because -1 out of range
	positionalIdsTensor, _ = positionalIdsTensor.Clamp(ts.IntScalar(0), ts.IntScalar(s.config.VocabSize), true)

	ts.NoGrad(func() {
		sbertResult, err := s.model.ForwardT(
			tokenIdsTensor,
			typeIdsTensor, 
			positionalIdsTensor,
			ts.None,
			false,
		)
		if err != nil {
			return
		}

		meanPoolResult, err := MeanPooling(sbertResult, ts.TensorFrom(attentionMask))
		if err != nil {
			return
		}

		result = meanPoolResult.Float64Values(true)
	})

With:

MeanPooling(
	modelOutput *ts.Tensor,
	attentionMask *ts.Tensor,
) (*ts.Tensor, error) {
	squeezeMask, err := attentionMask.Unsqueeze(-1, true)
	if err != nil {
		fmt.Println("Error in Squeeze Mask Expanded", err)
		return nil, err
	}

	expandedMask, err := squeezeMask.Expand([]int64{modelOutput.MustSize()[0], 1}, false, true)
	if err != nil {
		fmt.Println("Error in Expanded Mask Expanded", err)
		return nil, err
	}

	multiple, err := modelOutput.Multiply(expandedMask, false)
	if err != nil {
		fmt.Println("Error in Multiple Embedding Value & Mask Expanded", err)
		return nil, err
	}

	multipleSum, err := multiple.SumToSize([]int64{s.config.HiddenSize}, true)
	if err != nil {
		fmt.Println("Error in Sum Multiple Embedding Value & Mask Expanded", err)
		return nil, err
	}

	fmt.Println("Multiple Sum Size", multipleSum.MustSize())

	expandedMaskSum, err := expandedMask.Sum(gotch.BFloat16, true)
	if err != nil {
		fmt.Println("Error in Sum Expanded Mask Expanded", err)
		return nil, err
	}

	expandedMaskClamp, err := expandedMaskSum.ClampMin(ts.FloatScalar(1e-9), true)
	if err != nil {
		fmt.Println("Error in Clamp Expanded Mask", err)
		return nil, err
	}

	return multipleSum.Divide(expandedMaskClamp, true)
}

Using BERT Embedding using firqaaa/indo-sentence-bert-base model with Mean Pooling, Got:

 [-1.6227916538715363,0.7554875880479812,0.1589603044645628,0.8658471912145614,-0.4249356545507908,0.01967335669323802,0.9502722173929214,-0.3677066618576646,1.1301569476723672,-1.4967026352882384,0.16354716694913804,-1.0760953173041343,-0.624056831933558,0.13163216412067413,-0.5605657094158232,-0.1305385995656252,-0.19867468923330306,1.722248911857605,-0.1994105402380228,-1.4139509856700898,0.42254706418607385,-1.0478729814291001,1.5752075016498566,-1.1409893691539765,0.4027868114331795,1.0004204362630844,0.9397359506983776,0.3373792964965105,-0.3797923713922501,-0.4052686534821987,0.7873915031552314,-1.1068729043006897,-0.5163623943924904,0.2611077643930912,1.1646993651986122,0.41107474863529203,-0.06333556547760963,-1.0262116046622396,-0.5505763769149781,-0.29493677951395514,0.5741721652448177,0.6379409968852997,0.18359720571897925,0.2578465469181538,-0.04277798626571894,-0.006689520180225372,-0.07283653393387794,0.027506009116768836,-0.5368784964084625,-0.2336610034108162,-0.6083711832761765,-1.1165205121040345,0.2659545764327049,-0.420451824599877,-0.09777965396642685,0.37623532488942146,1.376661330461502,-0.34119268879294395,-0.8356417715549469,1.204750394821167,-0.7787564300000668,-0.5885449111461639,-0.23886494506150485,-0.12483588429167866,0.43210629746317863,-0.5659979455173015,0.6688313819584437,0.38319472670555116,0.3330675795674324,0.8130357705056668,-0.4499365001916885,-1.6743723392486571,1.3455155491828918,1.3436111986637116,-0.29789138287305833,-1.1723614156246185,0.28456454649567603,0.9028494514524936,-1.0644310090690852,0.4904009073972702,-0.7448074653744697,0.3888047568500042,1.0846442807465793,-0.4661381786223501,1.146113967895508,0.2453242763876915,0.6124971672892571,-0.12931594848632813,0.4396951522678137,-0.10419512782245874,-0.1389782418962568,0.7814542919397354,-1.082936555147171,0.543551667034626,-0.45684188716113566,-1.6327427625656128,0.547798165678978,-1.0640608921647072,-0.592055407166481,0.2637485801242292,0.04996199081651866,0.259585880022496,0.5630159471184015,0.5123400680720807,1.1783067256212234,1.4461433589458466,0.3455542854964733,-0.9629830822348595,0.19565976709127425,-1.0863568186759949,-0.34217013604938984,0.8319569528102875,1.202864345908165,0.28094092253595593,-0.9778533601667732,-0.0915665116161108,-1.7865074813365935,0.9091301769018173,-0.034772072732448575,-0.4708100453019142,-0.24228798504918814,-0.43598178327083587,0.5572963342070579,-0.9968375831842422,0.4635215237736702,0.2609421290457249,-0.46491607669740914,-1.4113442786037922,-0.051442237198352815,-0.6520886942744255,0.3925953581929207,0.5854724477976561,-0.15212079808115958,-0.4005308158695698,0.5666025180369616,0.248254712857306,0.48880391418933866,0.9002874851226806,-0.8982043355703354,-0.26018930720165373,-0.43198364223353564,-0.33130444027483463,0.4112240560352802,0.19897668808698654,-0.15394992828369142,-0.1385298477485776,-1.174750530719757,1.1421632036566733,0.5469675600528717,-1.0588995605707168,-1.5501525282859803,-0.7415343614295125,-0.1770402893424034,-0.14751780927181243,0.3815243750810623,0.4742387685924768,-0.5843388440087438,0.2055481977760792,0.13543433994054793,0.061221899837255477,0.6243008613586426,1.5520382758229971,0.8577583432197571,0.21417295262217523,0.11074728509411216,0.07564935982227325,0.7405689567327499,-0.8669735431671143,0.46681671440601347,-1.536320161819458,-0.5370194882154464,0.19270511120557784,0.6078463859856129,0.9395915418863297,-0.26305809170007705,-0.22174796797335147,-1.0416114673018455,-0.853209388256073,-0.9889775365591049,-0.253652174398303,-0.39191010892391204,0.3293208733201027,1.5862296529114246,0.03622507750988006,-0.5202541723847389,-0.6523760542273521,-0.999642089009285,0.7373349595814943,-0.20583635196089745,1.130672037601471,0.9826638631522655,0.33566457591950893,-0.36206286642700436,0.8018047153949738,0.1859155386686325,0.22497576847672462,-0.04723847098648548,0.4920762531459332,-0.8198982387781143,-0.22730761589482426,0.21381990164518355,-0.31953837871551516,-0.20060425549745559,-1.104482302069664,0.7249462202191352,-1.1688048660755157,0.9511110633611679,-0.8583337485790252,-0.8150541067123414,0.3349034905433655,0.26009077318012713,0.3106609046459198,0.10342213585972786,-0.029414141178131105,-0.7427665680646897,0.8560516193509102,0.7308406054973602,-0.279021218419075,-1.0104446589946747,-0.4133190631866455,-0.46885893144644797,-0.4712497230619192,-0.20888532549142838,-0.4310174971818924,0.18832004498690366,0.08069765288382769,0.6109874784946442,-0.04693659096956253,-0.8556462123990058,0.7957041263580322,-0.023471899703145026,-1.5803398966789246,-1.1334915831685066,-0.21581769958138466,0.7068514049053192,-0.5155457347631455,-0.43313210308551786,1.4783492684364319,-0.981499956548214,0.00045935362577438356,0.030957138910889626,-0.35024763755500316,-0.47378902435302733,-0.5338902229908854,0.8176291070878505,-0.580621188879013,0.020258036628365516,0.33431983217597006,-0.38455332070589066,-0.4846494659781456,0.7687359422445297,-0.27531019002199175,-0.40198176354169846,-1.0060478553175927,1.6370448514819145,-0.7189604699611664,-0.024537438154220582,-0.844023984670639,-0.693036861717701,-1.4743432614952325,-0.9993432104587555,0.013567449524998665,-0.4087207529693842,0.24881195202469825,-0.10783162487205118,1.2972548914141953,0.16975656263530253,0.6388064071536064,-0.0675088495016098,0.27213895674794913,-0.3786322416737676,-0.684461808949709,-0.45459844544529915,0.19717584997415544,-0.29845784306526185,0.7010430447757244,-0.2589167824015021,0.6542329989373684,-0.2543443229049444,-0.2947466917335987,0.49407202154397967,0.9982753306627273,0.18598248511552812,-1.1279077351093292,0.6515263095498085,-1.7908330619335175,0.19241741634905338,-0.9097377564758062,0.8956561774015427,0.2439974308013916,-1.9064784288406371,1.8904009461402893,-1.1107844233512878,-1.0332094520330428,0.9775099195539951,-0.1856686592102051,-1.8006864309310913,0.39225673452019694,-0.31076042018830774,-0.2632787056267262,-0.02340511977672577,-0.732978855073452,-0.19577767178416253,-0.40257913144305346,0.04340318888425827,-0.8248156391084194,0.4959971934556961,-1.075779170077294,0.7139468789100647,-1.1349065941292793,0.23925037495791912,0.7098519415594637,0.2550899609923363,1.1976337932050227,-0.5797888904809951,1.0725666850805282,-1.2059510499238968,1.8276023507118224,-1.1533979617059231,-0.019122007489204406,-1.0020369201898576,-0.07116430699825287,-1.6217625737190247,0.7622346464544535,-0.11014300882816315,0.001501660794019699,1.5060202330350876,0.4088600918650627,-0.007463470101356506,-0.8866957053542137,-0.6372593127191066,-0.03157520592212677,-0.2985875096172094,0.42482919059693813,0.8864388833986595,0.22701898626983166,-0.9544445395469665,0.6479334082454443,0.5389591980725527,-0.0017100878059864045,-0.46421301271766424,-1.3578950121998787,0.6430660977959632,-0.16960019767284393,1.016950972378254,-0.5816740438342094,-1.0066136002540589,-0.6528769262135029,-0.45029334127902987,-0.6974457375705242,0.34797944128513336,-0.358734966814518,-0.5551158845424652,0.20834498684853314,0.42887702733278277,0.7220531821250915,-0.08326522765564733,0.11851725354790688,-0.09428922142833471,0.09580109594389796,-1.4407778084278107,-0.05954618453979492,0.6600876122713089,-0.0634625969454646,-0.41714775562286377,0.7770369492471219,0.6864045621827245,0.03693680167198181,-0.4120656654238701,0.05158143937587738,0.02772249570116401,0.8471460446715355,0.049033766984939574,0.26699562296271323,1.855992865562439,-0.1543639376759529,-1.4973345875740052,-0.6066253423690796,0.039319860935211184,-0.12450548550114035,-0.34614725708961486,0.08537808358669281,0.7866152996197343,0.06533520855009556,-0.27746916450560094,0.2727154903113842,-1.0244901210069657,-0.5247770935297013,1.4109093479812145,0.3218833848834038,0.17662233263254165,-0.7149662107229233,0.5201324332505465,-0.7172928608953952,-0.43893435075879095,-0.9539713244885206,-0.12814276088029147,0.6968303814530372,-0.13752517737448217,-0.7622620998648927,-1.4261201649904252,-0.20704141072928905,0.12931029498577118,0.4589701727032661,0.08065592274069786,1.1876368090510367,0.8848432749509811,-0.6172445826232433,0.031136724352836608,0.1109648272395134,-0.498911302536726,-1.0229070968925953,0.145998084358871,-0.5836220681667328,-0.0697794258594513,-0.8388557713478804,-0.5475250393152237,0.5586968330666423,-0.06198848411440849,-0.7878557503223419,-0.597209857404232,0.5896203216165304,-0.6727967172861099,-1.053236410021782,0.16927917525172234,-0.5411766059696674,-0.3221927274018526,0.8349465101957321,1.3161027133464813,-0.5924117622897029,-0.09108909368515014,-0.41384502276778223,-0.5606288623064757,0.16964007318019866,-0.17984266187995673,2.1434337973594664,0.4724122447893023,-1.0696836560964584,-0.8426746599376201,0.7970569148659706,0.7037404209375382,0.439544378221035,0.6676521005341783,-1.5460260286927223,0.40073547679930926,-0.21073501110076903,1.2645777404308318,0.8474169675260782,0.8591869635507464,0.2604157369583845,-0.6670644178986549,-0.6546155236661434,0.11989506259560585,0.19017186537384986,0.6451993092894555,0.11498310342431069,-0.012126469612121582,-0.9663621947169304,0.44557329937815665,0.6731792092323303,0.009609638713300228,1.4811460554599762,-0.2532421754673123,0.5893595390021801,0.48626772239804267,2.1812758088111877,0.3147154726088047,0.23517969269305466,0.07003139704465866,-0.218382728099823,0.10578752160072327,-0.04805323332548141,-0.5086295083165169,0.20082964599132538,-0.27541499193757774,0.28482021633535626,-0.5660529337823391,0.6601719319820404,-0.7288568608462811,-0.8564579606056213,0.053908254206180575,0.5381353437900543,0.34716264382004736,-0.6855230748653411,-0.8889098793268204,-0.4598736196756363,-0.2315896453335881,0.08745338320732117,-1.0132429018616675,0.26083519160747526,0.2672958794981241,0.8001825690269471,0.07317597679793834,-1.5293342918157578,0.7700544178485871,-0.38036307096481325,0.32557658534497025,0.28845980055630205,-0.4033867284655571,-0.8095119854435324,0.12655990719795226,0.41581719666719436,0.03553529661148787,0.8597572609782219,0.09632265567779541,-0.12904588365927339,0.23773942999541758, 0.8890036374330521,-0.15018625324591994,0.3368433456867933,0.5023089818656444,-1.3627200067043304,0.19050977639853955,1.0743166238069535,-1.0128441404551267,0.7278734616935253,-1.2822263717651368,0.10383517444133758,0.21801416873931884,1.2507037222385406,1.1117293804883956,1.6295706421136855,-0.27292307913303376,0.6904935158789158,0.30494711492210624,-0.15803228747099637,-0.9943818051367999,-0.691871153563261,-0.1855253607034683,-1.6241046011447906,0.28228028789162635,-0.2927743878215551,2.039055681228638,0.09252578038722277,0.7780836217105389,0.9724092990159988,-0.429710141569376,-0.5675291270017624,0.12904180064797402,-0.597060356196016,-0.4464557906612754,-0.32624791264534,-0.11680353824049235,0.6353850707411766,0.09050620421767235,-0.479398013651371,-0.6038840375840664,0.06460570022463799,0.8507871799170971,-0.24199280589818956,0.22186804041266442,0.3082819571951404,-0.08830756545066834,-0.9892218768596649,-0.1902116745710373,1.2559814631938935,0.45681111216545106,-0.8271580175030977,0.07470232723280787,1.273093244433403,0.1140906721353531,1.8947067260742188,-1.159347065538168,0.8624736249446869,-0.018799912929534913,0.05584504902362823,-0.3757443904876709,-0.6914042174816132,0.2764869391918182,-0.6742952764034271,-0.29773723892867565,0.9870483368635178,0.41381838181987407,0.12369731068611145,0.14696347116769176,1.0757858373224736,-0.31362596303224566,0.18366997744888067,0.7859392292797566,0.2224468022584915,-0.6298900648951531,1.0573180854320525,0.03715910352766514,0.6537074632942677,0.222159668430686,-0.001502983272075653,-0.9918753147125244,-0.023164074681699277,-0.3379133678972721,0.7236129661090672,-0.18951546773314476,0.9525809109210968,-1.2041710704565047,0.17514527440071107,1.3968581287190318,-0.3311567023396492,-0.0658687592484057,-0.38329134322702885,-0.4862900897860527,-0.35470639616250993,-1.0437089785933495,1.1808406174182893,-0.6417392700910568,0.6755236729979515,0.4630655162036419,0.1978838506154716,-0.12749075666069984,-1.138187761604786,0.6199604518711567,0.6738107815384865,-0.22519489377737045,0.2706799848005176,-0.12315469719469548,0.5636254146695137,-0.7213790429290384,0.3603172838687897,0.40056815594434736,-0.08833450078964233,0.08905534637160599,-0.7079260911792516,-0.2848669587168843,0.7480041176080704,0.09355245791375637,0.04222092609852553,-0.29621285274624826,-0.45023547634482386,1.1709188945591449,-0.7609114453196526,0.22377288304269313,-0.1491543710231781,-0.9789104461669922,0.808806927036494,0.6604092936962843,-0.7428200908005238,0.35011737532913684,-0.2829148083925247,1.6581971883773803,-0.26540189832448957,1.085553953051567,-0.8308384045958519,0.35945844277739525,0.8360313981771469,-0.8160667777061462,0.19679526388645172,-0.7388108819723129,-0.24889890532940626,-1.1070286083966494,-0.9435775860678405,-1.7015673577785493,-0.5687697812914848,-0.3901574552059174,0.40058660358190534,0.3103815188631415,0.4885440498590469,0.14719783551990986,-1.0589678853750228,0.09778809100389481,1.2664411459118128,-0.009655763767659665,0.6416023697005585,-0.678122241050005,-0.136600411683321,-0.5401053562760353,-0.7549299389123917,-0.21374049559235572,1.3625728815793992,0.8267437852919102,0.18181079430505634,-0.132286539580673,1.2091324269771575,-1.2357918336987495,0.7543587923049927,0.7079430356621742,1.6972235932946205,0.6543703213334083,1.0618213027715684,-0.7883206367492676,0.25189454704523084,0.43170635513961314,-0.7154882803559304,-0.5958760793320834,-0.1960826139897108,-0.2590740643441677,-0.30847129225730896,-0.23803000338375568,0.12984665501862763,-1.2800627529621125,1.8020237326622008,0.7414972614496946,-0.6841292217373848,-0.053115977346897124,0.7031856946647167,-0.34489245265722274,0.024949825555086135,0.6352024555206299,0.7065548650920391,0.7830114986747503,1.3826203644275665,-0.3955674883443862,0.7644621558487416,0.4134648159146309,-0.5760974809527397,-0.061812875838950274,0.8622376382350921,0.9896795392036438,-1.0868304893374443,1.2600854992866517,0.12221512142568827,0.8994341418147087,-0.13916447758674622,1.0496542654931544,0.40213768780231474,0.11315265782177449,0.12426903247833251,-0.5749346818774939,0.811308029294014,-0.05079434812068939,0.33789140582084654,0.3242235668003559,-0.9549410089850425,0.36674793921411036,-0.8911048397421837,1.2140932470560073,0.5753776967525482,-0.5680039386730641,-0.3665329821407795,0.7392982844263315,0.769312915019691,0.18854526951909065,0.8185647945851088,0.8662123724818229,0.7193871855735778,0.5484496064484119,-0.12320410460233688,-0.6762118853628636,-0.3013422687537968,-1.4574438214302063,0.0859515056014061,-1.1599058970808982,-1.1722162164747716,-0.7108936935663224,1.46783849298954,-1.5605870937928557,0.3906925797462463,-0.0009803369641304017,-0.19581137001514434,-0.39009226388297974,0.16428479477763175,-0.522692234441638,1.2395337894558907,0.31263163164258,-0.153193024918437,-0.6475861091166735,-0.38708709478378295,-1.0649456083774567,0.4890880882740021,0.9730777341872454,-0.9731360915582628,-0.9298874586820602,0.9608874320983887,-0.3877456933259964,-0.412495294958353,1.2777734100818634,-0.6281776757910847,0.8273628417402505,-0.5963116988539696,-0.5670356020331383,0.30195359587669374]

Using BERT Embedding using firqaaa/indo-sentence-bert-base model without Mean Pooling (First Index in Tensor), Got:

[-1.3033605813980103,-0.6893500685691833,0.5115883946418762,1.2126647233963013,-1.1313285827636719,0.18551763892173767,-1.1563800573349,0.658353865146637,0.8354262113571167,0.47388744354248047,2.0444416999816895,0.2991040349006653,-0.30433937907218933,-1.081435203552246,-1.295798897743225,1.4828686714172363,1.9937177896499634,0.03033819980919361,1.8622337579727173,-0.026061031967401505,3.522106647491455,0.5721272826194763,0.007917575538158417,1.1321638822555542,-1.4782061576843262,-0.6725410223007202,-0.12654316425323486,-0.6685246229171753,-1.448246717453003,-0.219361811876297,0.4461040496826172,-0.5248202085494995,-1.7883286476135254,-0.8081768155097961,0.06659533828496933,-0.15744483470916748,0.9223767518997192,0.27264973521232605,0.3989594876766205,-0.2036086767911911,0.6106128096580505,0.5813379287719727,0.23178668320178986,0.5779843926429749,1.205450415611267,-0.9625248908996582,0.12500335276126862,0.6902114748954773,0.6097317337989807,1.9351543188095093,-0.13893231749534607,-0.29808467626571655,0.5747309327125549,-0.13892300426959991,0.0068739429116249084,-0.22105936706066132,-2.1271257400512695,0.1441042721271515,-0.22156955301761627,-1.000765323638916,0.534807562828064,0.04143365100026131,0.34851402044296265,-0.689038872718811,1.1579147577285767,0.07655597478151321,1.501584529876709,-0.004639608319848776,0.8765362501144409,-1.4406819343566895,-0.4396618604660034,0.015100540593266487,0.9123409986495972,0.7017473578453064,1.850691795349121,-0.15534256398677826,-0.808193564414978,0.744256854057312,-0.5735523104667664,1.3413525819778442,0.5323929786682129,0.27519139647483826,-0.25745871663093567,0.8535757064819336,0.26891258358955383,-0.8611034750938416,1.71231210231781,0.34356725215911865,-0.30096670985221863,0.4666862189769745,-0.6835775971412659,-1.025305986404419,0.09724541753530502,1.6259045600891113,1.3151710033416748,1.0707659721374512,-0.3721978962421417,-0.7607817053794861,1.4115325212478638,0.6808609366416931,1.0539398193359375,-0.7135828137397766,-0.424746036529541,-0.1397312581539154,0.9764535427093506,-0.6979526877403259,1.130998134613037,0.9412159323692322,-1.7321704626083374,-1.1754215955734253,1.2291817665100098,-0.019812647253274918,0.5956840515136719,-0.5288306474685669,1.7665061950683594,1.2271496057510376,0.8258413076400757,-0.09724298864603043,-1.6614570617675781,0.6972789168357849,-1.9059745073318481,-0.6626917123794556,-2.3358206748962402,0.34933140873908997,-0.2707288861274719,1.2725584506988525,-1.2606464624404907,0.7836956977844238,2.5075554847717285,0.9545530080795288,-0.4307652413845062,0.2151593565940857,-0.6191155314445496,2.5505356788635254,-0.09841468185186386,-0.291558176279068,-1.4886784553527832,0.907196581363678,-0.43823450803756714,0.7149364948272705,-1.4845023155212402,0.31813329458236694,0.2500913143157959,-0.3865405023097992,0.13654541969299316,-0.591360867023468,1.5757371187210083,0.2215951383113861,-0.488860547542572,-0.0838872492313385,0.7214955687522888,2.046337366104126,-2.026517152786255,1.1252012252807617,-1.138755440711975,0.01771424524486065,0.6947379112243652,0.13176938891410828,0.7188668847084045,-1.2496877908706665,0.36186298727989197,0.7297599911689758,-0.7450162768363953,-0.7351570725440979,0.6711434125900269,0.6051809191703796,1.1925333738327026,0.5016082525253296,0.020456843078136444,1.8417425155639648,-0.40241894125938416,0.7555134296417236,-0.04517541453242302,-0.7439769506454468,-0.5530329346656799,0.44798949360847473,1.8490532636642456,-0.5483790040016174,1.05153226852417,-0.7718961238861084,0.019809547811746597,-0.8159617781639099,-0.6716899871826172,-0.7078420519828796,0.34952443838119507,1.176863670349121,0.7325515747070312,-1.1291731595993042,-1.4784797430038452,0.06895957887172699,0.010098513215780258,1.371533989906311,-0.45576995611190796,-1.0263309478759766,0.07093511521816254,0.24211786687374115,0.7719075679779053,-0.8800277709960938,0.4933244585990906,1.9842501878738403,-0.6802620887756348,-0.11999005079269409,-0.3801525831222534,-1.6295223236083984,-1.851374864578247,-0.3323567509651184,-0.12440581619739532,0.6722894310951233,-2.0248658657073975,-0.18596866726875305,0.7686638832092285,-0.7511233687400818,-0.6392114162445068,1.6007987260818481,-0.6480914354324341,-0.6446964144706726,0.7743696570396423,0.3679388165473938,0.394912451505661,-1.4300460815429688,1.1803864240646362,-0.5143880844116211,-0.31431159377098083,1.357275128364563,1.560695767402649,-0.3176881968975067,1.5277791023254395,-3.284796953201294,1.188019871711731,0.9911147356033325,-0.08451548963785172,0.3338974416255951,-0.14713117480278015,-1.740966796875,1.4697571992874146,-0.8498929142951965,-0.18134286999702454,-0.6419159770011902,-1.0091710090637207,-1.0550742149353027,1.1109037399291992,0.2363080382347107,-0.03514796122908592,-2.2092766761779785,-0.7686383724212646,0.46406543254852295,-1.713537335395813,0.1481059044599533,-0.2976853549480438,0.520101010799408,1.6806749105453491,-0.595875084400177,0.39946457743644714,1.0571550130844116,1.0589481592178345,-1.080141544342041,-0.877689778804779,0.42605847120285034,0.8373844027519226,0.22702795267105103,-0.7818632125854492,0.1111782118678093,2.037339210510254,0.6384644508361816,0.6850972175598145,-0.42064210772514343,1.2015608549118042,-1.4884443283081055,0.40069514513015747,0.452289879322052,0.883286714553833,0.3091121315956116,0.48481032252311707,0.03191594406962395,0.17219191789627075,-1.4521090984344482,-0.6900157928466797,-0.1521165817975998,0.34748926758766174,-1.0867305994033813,-0.4002108871936798,-0.18167231976985931,0.4086719751358032,0.8118977546691895,-2.104076385498047,0.9762097001075745,-0.2664123475551605,-1.4136126041412354,1.240167260169983,0.1268242597579956,-0.8574983477592468,-0.6808261275291443,-1.684479832649231,0.6182729601860046,-0.4861699640750885,-0.9638119339942932,-0.8043613433837891,-0.2472689300775528,1.0141083002090454,-0.09366199374198914,0.9276924729347229,-0.8138614296913147,-1.5035055875778198,-0.635256826877594,0.3416958451271057,0.4377307593822479,-0.982066810131073,-0.6267072558403015,-0.1293206810951233,-1.0471453666687012,0.6946237087249756,0.5841215252876282,0.1596013605594635,-0.12783022224903107,-0.6316893100738525,0.6521542072296143,-0.19167494773864746,1.928271770477295,-0.05001677945256233,0.841772735118866,0.9630845785140991,1.093938946723938,-0.24611403048038483,-0.614762008190155,2.1410276889801025,1.8667927980422974,-1.632458209991455,0.08926986157894135,-0.3368683159351349,-1.4921621084213257,-0.23756176233291626,0.2745567858219147,0.47869256138801575,-0.5216085314750671,-0.5482800602912903,-1.2583415508270264,1.6402746438980103,-0.5148667097091675,-1.2213438749313354,-0.10233847051858902,-0.6210096478462219,1.04427969455719,-0.9491869211196899,-0.4521280825138092,0.14092105627059937,-0.4080565869808197,-1.0988045930862427,-0.5049154758453369,0.8664956092834473,-1.1452877521514893,-0.4803309440612793,-1.446687936782837,-0.4168053865432739,0.2792304754257202,-0.9720661044120789,-0.12419069558382034,1.2693297863006592,-1.0074542760849,1.4506784677505493,0.2175675928592682,1.1622796058654785,0.11008260399103165,-0.11005748808383942,-0.45648953318595886,0.05980463698506355,-0.2521032691001892,-0.7172722816467285,-2.8589534759521484,0.2123936414718628,0.7645631432533264,0.033932775259017944,0.8863782286643982,1.8365803956985474,-1.5827972888946533,-0.22427862882614136,-1.5625042915344238,-0.45201733708381653,0.23241659998893738,1.0279371738433838,0.5559368133544922,-0.8822855949401855,-0.6951384544372559,-0.2105642855167389,1.1569066047668457,-0.7192208170890808,-0.4973181486129761,0.41426965594291687,0.8823067545890808,-1.0662754774093628,-0.26620668172836304,0.6874479055404663,-0.7391585111618042,-0.4520166516304016,-0.2691906988620758,-1.4952528476715088,-0.9685438275337219,-0.45282095670700073,-1.6793229579925537,-0.2510475516319275,2.278420925140381,-0.594187319278717,0.7468273639678955,0.7092157006263733,0.8045746684074402,-0.24712710082530975,-0.2553390860557556,0.6070898175239563,0.40715375542640686,-1.533395767211914,0.17775554955005646,-0.2579806447029114,1.515956997871399,-0.159017413854599,-0.6983113288879395,0.7281506657600403,-0.3511245846748352,0.4735342562198639,0.7903203964233398,-0.6578787565231323,-1.7521047592163086,-0.42369356751441956,1.3414336442947388,-0.5638956427574158,0.835208535194397,0.6478133201599121,1.5945967435836792,0.3306652307510376,0.6514559388160706,0.562816321849823,-0.6718156337738037,-0.12635450065135956,0.9882451295852661,-1.7150936126708984,-0.4268808960914612,-0.6947535276412964,0.4113764464855194,0.4923187494277954,-0.5962427258491516,0.18262600898742676,0.7655742764472961,-0.19029846787452698,0.5570396780967712,-0.9502344727516174,0.24539701640605927,-0.5622003674507141,-0.5389556288719177,0.8691728711128235,0.2323179543018341,-1.6118403673171997,-0.42567723989486694,-0.40177252888679504,-0.9734264612197876,0.024227852001786232,-0.5991965532302856,1.593422532081604,-1.483076572418213,-0.2640804946422577,0.3804115056991577,-0.9499490261077881,-1.0500966310501099,-0.1632671356201172,1.2220771312713623,0.7626445293426514,-1.0211533308029175,0.5829855799674988,-0.12121884524822235,0.17844828963279724,-2.0936923027038574,0.3746737539768219,0.26630204916000366,-0.15964610874652863,-0.8679308891296387,0.5146467685699463,1.0057456493377686,-1.3424017429351807,0.9410102367401123,-0.5889606475830078,-2.6151139736175537,0.6066080927848816,0.4809713661670685,-0.6458501815795898,3.212249279022217,-1.0153146982192993,-0.8535961508750916,2.099139451980591,1.900411605834961,1.5187684297561646,-1.7616320848464966,1.4527537822723389,0.6367459893226624,1.5272568464279175,-0.9228829741477966,-1.5886249542236328,0.6957477331161499,-0.35124388337135315,2.028266668319702,-0.39498502016067505,-0.10188016295433044,1.7192227840423584,0.5842673778533936,-0.7063647508621216,-0.3026973307132721,1.4057403802871704,-0.40056514739990234,0.7430214881896973,-0.18080240488052368,0.8494066596031189,0.7361655831336975,-1.417173147201538,1.6568375825881958,-0.9092342257499695,0.18937616050243378,-0.1628282517194748,0.3400737941265106,-0.5712150931358337,-0.9939681887626648,1.1193585395812988,0.6391936540603638,-1.4596256017684937,-0.6277069449424744,-0.8859458565711975,3.315753221511841,-1.6577224731445312,1.1386605501174927,-1.1479201316833496,-0.42704159021377563,-2.100452184677124,0.010895675979554653,-0.7863140106201172,-0.1998968869447708,-1.0543469190597534,0.8521649241447449,-1.3183813095092773,-0.9357575178146362,-1.4069650173187256,-0.5289789438247681,1.837856411933899,-0.35237032175064087,0.768679141998291,0.3202495872974396,-0.639560878276825,0.6873445510864258,-0.9559412002563477,0.9905231595039368,0.4652958810329437,-1.994078278541565,0.22237186133861542,0.7972632050514221,0.9062623381614685,0.5288797616958618,-1.4024099111557007,0.8067528605461121,-0.21938519179821014,-0.5914400219917297,-1.193498969078064,-2.4094274044036865,-0.0203936155885458,-0.4548194706439972,-1.2056118249893188,1.2387951612472534,-0.861380934715271,0.08695204555988312,0.4445524513721466,0.36830461025238037,-0.5633306503295898,-0.0701281726360321,0.5569648742675781,-0.7826809883117676,-1.9058500528335571,0.7039915919303894,-0.15418854355812073,-0.807640016078949,-1.2608163356781006,-1.227465271949768,-1.2998011112213135,-0.7112398147583008,0.3004903197288513,0.5975300073623657,0.9817243218421936,0.6016124486923218,1.1728324890136719,-0.43686074018478394,0.8666543960571289,-0.3868636190891266,-0.6696138978004456,1.3672012090682983,1.4193041324615479,-2.06880259513855,0.5641741752624512,0.3863915801048279,0.13076288998126984,-0.16583870351314545,0.7007835507392883,-2.1175730228424072,0.9749196767807007,0.4677152633666992,-0.6484891772270203,-0.54981929063797,-1.4419316053390503,-0.7667346596717834,0.4795188307762146,-0.40981248021125793,-0.038805458694696426,-0.162735253572464,0.4552173316478729,0.05351923033595085,-0.739958643913269,0.9900935888290405,0.9306311011314392,-0.9224599599838257,0.003978446125984192,-0.522473931312561,1.4377156496047974,-1.77664053440094,0.687629759311676,0.8230379223823547,1.1321933269500732,-0.7517548203468323,-0.3458455801010132,-0.6121591925621033,1.4684911966323853,1.0137704610824585,0.022755881771445274,1.202986717224121,-0.21155549585819244,0.010072692297399044,0.4478440582752228,-1.1295878887176514,1.3908166885375977,0.9018248915672302,0.2032039910554886,-1.0039761066436768,-0.767303466796875,1.110292673110962,-1.1196565628051758,-0.23829911649227142,-1.0335534811019897,-0.08106939494609833,-0.0667790025472641,-0.8099790811538696,0.023408016189932823,0.5664415955543518,0.22082781791687012,0.02908618375658989,0.05635359138250351,0.3860180675983429,-0.34447696805000305,0.8765964508056641,-0.47746723890304565,-0.9999526143074036,-0.303785502910614,-0.18957297503948212,0.44396400451660156,-0.0288506168872118,0.04309045523405075,-1.4608741998672485,0.4330745041370392,-1.352256417274475,-2.3736236095428467,0.2195567637681961,0.7578608393669128,-1.0584743022918701,1.6064454317092896,-1.7646211385726929,0.3323518633842468,0.44313186407089233,-1.4064627885818481,-0.04255500063300133,-0.3040188252925873,0.04633926972746849,3.014146089553833,0.6632212400436401,-0.18702039122581482,1.2623753547668457,-0.8275432586669922,-1.5318272113800049,0.7151585817337036,-0.5838198065757751,1.6670904159545898,-0.6081392765045166,-1.3305988311767578,-0.08773183077573776,-0.7434533834457397,-0.17483562231063843,1.5137548446655273,-0.3618879020214081,0.6134769320487976,-0.325838178396225,-1.1051216125488281,0.20794901251792908,0.17229609191417694,0.05923738330602646,0.3184024691581726,-0.060878295451402664,0.49373918771743774,0.12074894458055496,0.3953256905078888,-2.439988851547241,1.0523688793182373,-3.6998980045318604,1.9480915069580078,1.7039846181869507,1.2168594598770142,-0.37126973271369934,-1.6950757503509521,1.472368836402893,1.2014166116714478,-0.07058633863925934,-0.7438192367553711,0.709946870803833,-2.6227943897247314,1.2053481340408325,-1.1472675800323486,1.3993207216262817,-0.39820268750190735,1.9451353549957275,-0.8780097961425781,0.6444945931434631,-2.688342571258545,0.05134633183479309,-0.18870756030082703,-0.26525986194610596,-0.5068386793136597,0.474709153175354,-0.3310593366622925,-0.397487074136734,-0.4531141519546509,0.2406158298254013,-0.5774913430213928,1.216773271560669,0.5738421082496643,-0.34485626220703125,-0.45995867252349854,-1.2936426401138306,1.8315157890319824,-0.2021448016166687,0.5368388891220093,0.42909902334213257,0.8375856876373291,-2.039673328399658,0.11812838166952133,1.1435039043426514,0.7149943709373474,0.4744113087654114,0.6062092781066895,-1.184807300567627,0.8823735117912292,0.577489972114563,-0.21540918946266174,0.5953290462493896,-1.0438674688339233,2.316298484802246,-1.0819731950759888,-0.5068461298942566,1.3727575540542603,0.3639948070049286,-0.412334680557251,0.48733431100845337,0.2685856819152832,-1.1878165006637573,0.35754770040512085,0.16103674471378326,0.8853011131286621,-0.14657099545001984,0.6511698961257935,0.7795071005821228,-0.0786832645535469,-0.7052752375602722]

Sentence Transformer Code

from sentence_transformers import SentenceTransformer
sentences = ["Nama saya Yusyfina Yuniarti"]

model = SentenceTransformer('firqaaa/indo-sentence-bert-base')
embeddings = model.encode(sentences)
print(embeddings[0])

Using Hugging Face Sentence Transformer firqaaa/indo-sentence-bert-base, Got:

[-0.728769541,1.03070807,0.597038627,-0.724488199,1.1109004,0.367057145,-1.69312644,-0.432370961,-0.479102075,0.447933823,0.294710457,-0.476568758,-0.745833099,-0.0163534097,1.58723664,-0.292736471,1.61940897,-0.322055757,0.176826686,-0.575170398,-0.0526563823,-0.182893798,-0.732043743,-0.193100244,0.190573841,-0.586943209,1.39887476,-1.78764725,-0.936073959,-0.154629216,-0.00232271547,0.64753139,0.0663546473,0.887663722,-0.416142374,0.397735804,1.49786794,0.234046772,-0.623843729,0.572009206,-1.08866334,-0.853966534,0.00190120342,-0.315858692,0.689347386,0.455875814,0.127252415,-1.36490893,0.711537302,0.500115097,0.487224877,0.268592447,0.211649343,0.856098652,-0.0447329655,-0.0101358993,0.394373477,-0.886888027,-0.758469701,0.512086987,0.490378439,2.43307161,0.111732796,0.345883131,-0.544274449,-1.08962536,-0.620646179,0.926523387,-1.48084176,0.694925427,0.864914536,-0.426542372,1.21106458,0.515560389,0.0673334524,0.109631538,0.392081559,0.137717515,-0.667318404,-0.196232617,0.308202267,0.996181488,0.961703956,-0.326957136,0.541214287,0.0227988958,-0.348437488,1.42413735,-0.554342389,1.69492698,1.6115309,-0.733397007,-1.36865056,-0.858273864,-0.441358805,0.301705241,0.166016787,0.339023799,-0.233055398,0.649249494,-1.3350929,1.61175442,-0.194594815,0.560382724,-1.47822452,-1.17750573,-2.18012691,-1.30076694,0.345810175,-0.174260587,-1.02486825,-0.0365230553,0.148810506,-0.967721343,0.980295002,-1.12986374,-0.983318686,0.0646299571,-0.316435724,0.95693177,-0.009766954,-0.603620708,0.469835222,-2.40198946,0.513327837,1.08039689,0.400699228,0.258626252,0.366823822,0.34700194,-0.920541763,-0.430476189,-0.212324068,-0.64631021,1.61734962,-0.426103413,-0.307771385,-0.730635047,0.231489375,0.381328523,0.0886718109,-0.795271218,-0.554852128,0.597893834,1.08427835,0.764360249,-0.105325758,-0.338070929,-0.960273147,-0.471959829,-0.685437024,0.164848149,-1.62792242,1.44042611,0.181020856,0.300756216,-0.332496613,0.989802361,-0.479425669,-0.683336616,0.0553333387,-0.0631729513,0.799441934,1.4526732,-0.340206295,0.405278593,0.597343385,-0.88882637,1.18792522,-0.336030811,-0.958358109,0.739529014,-0.314184368,1.01407504,1.78445506,-0.217505187,1.57367468,0.798707485,0.149183512,-1.67905998,-1.1579926,-0.304793924,-0.489402115,-0.773307621,-0.399694085,0.280870914,1.36378324,-0.267359853,-1.65033531,-0.926304221,0.251480311,-1.35584664,-0.278774828,-1.20915508,-0.0865978077,0.00474175811,1.28428626,-0.914889693,-0.558385968,-0.483170658,0.0760708377,-1.20614624,-0.14691928,-0.0757105798,-0.888332844,1.21772885,-0.530717373,-0.528036773,0.0122616561,-1.10750651,0.736021817,-0.753809214,0.407816797,0.206235558,0.886216044,-1.00062001,0.18625921,-0.315424681,0.870782554,-1.05559707,-0.454290539,0.682997286,0.0866720676,0.779103279,-0.441071987,1.44329166,0.2653763,-0.627355516,-0.23099713,-0.209176183,0.279097438,-0.983110607,-0.907089591,-0.796043515,0.438886732,-1.25649297,1.13402379,0.308278531,-1.57490885,-1.0148319,0.643121362,-0.941913486,1.0450598,-0.832120538,0.501715541,0.107521728,0.698807478,0.837365448,0.689181864,1.0568223,-0.157781273,-0.403208643,-1.19043851,2.2801609,-0.365974575,-0.246961862,-0.798121154,0.590959668,0.0538649186,-0.282077909,-0.214157552,-0.0218678676,1.68445718,0.219645217,-0.0937952548,1.53240812,-1.69949269,0.537909567,2.07488275,-0.145033315,0.675438881,-0.361287266,-2.10395336,0.920599937,0.305064619,0.813822091,-1.69480383,0.348859847,-1.16524172,1.42593038,0.288887173,-0.274802864,-0.792757213,-0.454061359,0.404667377,-1.39712834,-0.364296049,0.0700722411,0.109201215,0.224094316,1.27386761,0.136766627,-0.135663301,0.0253491346,-0.799788952,-0.963498712,0.564341366,-0.345468938,2.52282643,0.439551413,0.0166289993,0.00336701283,0.117773674,-0.207406953,-1.16465116,0.807724476,-1.44290638,-0.321124703,0.192775249,0.312011003,-0.521700621,-0.134442046,-0.645359874,-1.6678499,-0.0944285542,-0.405213833,0.435147107,-0.793227315,0.153089494,0.257286251,-0.771237016,0.352756083,-0.561610222,-0.112235069,0.585083961,-0.780044913,-0.108352736,-0.123265579,0.26248163,1.48682272,0.189995721,-0.722001731,-0.308026373,-1.86904275,1.24657941,1.20005584,0.416530758,-0.791242719,-0.152546808,0.813379467,0.0996577963,-1.46598887,-0.110749543,0.543525398,0.614660144,0.750840724,-1.31719518,1.33560681,-0.309238762,-0.386107028,0.29648149,-1.11639178,-0.0334254727,-0.16517362,0.129936546,0.394218177,0.813289285,0.289862633,0.0304445084,0.829479575,1.59007955,0.201292425,1.09429002,0.578027129,-0.393633157,-0.270335108,0.731883168,0.396843672,-0.617126346,0.63915813,-0.676132977,1.43360972,-0.0391074643,-0.0167858433,-2.21214747,-0.373658329,-1.52301121,1.03671086,-0.975005507,0.692907274,0.276638687,-0.70737797,-0.511367679,-0.663949847,0.42901215,0.196242899,-0.00546634803,-0.0782182291,1.03464198,1.18685651,-0.983290493,-0.148377091,0.584150791,-1.52060783,-0.0226204693,-0.804868817,0.204304367,0.738552094,0.724400997,-0.0688259378,-0.258259386,-0.487994492,-1.70594561,2.77724814,-0.146072835,-0.111535132,0.593815327,0.309488565,-1.27585483,0.852240205,0.100150742,0.908684134,-0.229397565,-0.725431442,-0.135620549,0.699554145,0.468046814,-1.11318195,1.16892755,1.43818605,-1.42920756,-2.62224388,-0.0989494771,-1.22972155,-1.39280677,0.796736598,-0.604684234,0.677146792,0.0349738263,0.763561964,0.163160428,-0.54277575,-0.522984624,-1.68672085,0.438635826,-1.03538144,0.58415395,0.366744787,0.813757122,0.795464993,0.536079407,-0.377952516,0.154311493,-0.16921486,-0.205458447,0.584939599,-1.28760731,0.878001571,-0.706819654,-2.01022291,1.64731336,-1.19172537,-0.0806191042,-0.365895182,-1.5297116,2.06994915,-1.33397555,0.448670059,0.176600054,0.944906116,0.812909782,-0.0819159448,0.154557198,-0.883100033,1.22251022,-0.0769464523,0.675515294,0.897033393,0.796602249,0.395277083,-1.35935009,-0.227515548,-0.113261677,-1.50256562,0.835243404,0.990077198,-0.706494689,0.397959739,0.817661107,-0.283436149,0.938300729,0.380985796,0.734152436,-0.210968345,-1.2447046,1.2427547,0.493545383,0.448120356,0.743328631,0.368068278,-0.996080697,-0.794371247,1.2836144,-0.706647754,-1.46724737,-0.679964542,0.749995768,0.611397147,-0.452865779,-0.431475073,0.0747181028,0.260969281,-1.28478551,-0.784657657,0.145807609,0.504044175,0.329966813,1.39786005,0.822176933,-0.08945252,-0.190196529,1.05751705,-0.999282241,0.571135104,-0.892419815,-0.388410747,0.028385317,-0.14772889,0.0772391781,-1.22697961,0.277946174,-0.272798598,-0.749939144,0.406444311,0.975308597,0.835246861,-0.634159565,-0.16951704,-1.30175054,1.52183867,-2.08554888,1.6525526,-0.686420321,1.45032358,1.05336189,0.271915704,1.34345853,1.25561631,1.12044895,-0.244602963,0.312030971,0.15331845,1.01322353,0.297351062,0.582654834,-1.59378338,-0.75789237,-1.7211988,-0.458590269,-1.24758196,-1.13531661,-1.50956011,0.187723517,-1.08038068,-0.905101597,-1.24955416,-0.935046017,0.494446516,-0.535005808,-0.80595541,-0.21375367,0.977862656,-0.347039342,-2.03845263,-0.832987428,0.8676036,-1.01497841,1.53159952,0.509725094,0.261962622,-1.9713074,-0.161661521,0.805979073,1.07685411,0.359058499,0.0219900068,1.16120934,1.07788217,0.803620458,0.277541935,0.214384109,1.04378235,-1.02108479,0.703242898,-0.142739743,0.34108758,-0.0411276594,-0.330990493,1.32234263,-0.225063995,1.26802695,0.294223756,-0.303400129,0.0654654652,-0.355899751,1.07629526,0.236245066,0.0482232682,2.01075006,-0.497893572,1.01250887,0.713065684,0.530504107,-0.87463063,1.50622451,0.0338454023,-0.143252462,-0.714521527,0.857954323,0.267211974,-0.0708858967,0.0451739207,0.752122164,1.26691508,0.00222370028,0.563353181,0.0933398381,-0.603803515,0.200790375,-0.0984424129,-1.72864854,-0.858503222,0.00269610435,0.146178544,0.643018603,0.163280159,0.839584053,-0.430350959,0.166197896,-0.671090961,0.256469369,0.340761721,-0.821236968,0.32586664,0.205598027,1.0675503,0.0379331261,0.58070457,-1.28695083,0.917746544,-0.493280411,-0.460144192,0.908219337,-0.245404094,-0.860964596,-0.593600512,-0.71861279,1.07989144,-0.776190281,-0.994650006,-0.206728458,-0.462715298,-0.835745633,0.0756522417,-1.07736754,-0.11177025,1.45153201,2.46418571,1.63063276,-0.447155952,0.986142755,0.749830127,0.978344142,-0.210574791,-0.710896313,0.216160819,0.778284073,1.13490891,1.03955841,0.678692162,0.368737131,1.02859855,1.41996849,-0.258090019,-0.30130893,0.787674606,-1.05440295,-1.01637745,-1.66441083,-1.69106221,0.761142015,1.02617896,-0.262973011,0.223167494,1.03020942,-0.310333759,-0.326069713,0.918969274,-1.1214999,1.45283413,-0.331593364,0.0737351403,0.713323951,-0.240523726,-1.69688416,0.0111242533,-0.323366553,-0.0687069744,-1.06364954,1.17658615,0.447214842,1.42611599,-0.555052876,-0.969000936,-0.718675017,0.953151822,0.227617472,0.105078563,1.05417657,-1.52192688,-0.539461255,-0.272577465,0.533005834,-1.39793515,0.89386493,1.11877894,-2.00432444,1.90087891,0.532482564,0.514702797,0.441513926,1.42499733,0.0199254807,0.55358994,-0.619493127,-1.94097638,-0.340827733,0.518716693,-0.260291457,-1.53159451,-0.0554607995,-0.215524286,-0.027808547,1.59226429,-0.399910927,-0.707757115,0.975118518,-1.88227272,-0.149101168,1.8514179,-0.832739234,0.255464286,0.430327833,-0.701454222,-0.307301342,-0.61709106,0.290703148,-0.788572788,-0.581383884,-0.936832607,0.0595518239,1.97561288,-0.653161407,1.09138918,0.65674603,-1.45197105,0.322718084,-1.00390351,0.643758595,-0.241118819,0.200553179,-0.864903748,-1.31950569,-0.271951973,-0.402432144,-1.0449146,0.0887210965,-1.21201491]

Edit

Different vector result, but same accuracy for Text Similarity

Segmentation Fault

Segmentation fault when encode text data (BERT Embedding) in Web Server Application using Go Fiber.

Scenario:

  1. Encode Server Error (Intermittent)
  2. Try Encode Again!

Temporary Solution:

  • Reboot & Restart Server

 ┌───────────────────────────────────────────────────┐
 │                   Fiber v2.48.0                   │
 │               http://127.0.0.1:8080               │
 │       (bound on host 0.0.0.0 and port 8080)       │
 │                                                   │
 │ Handlers ............ 60  Processes ........... 1 │
 │ Prefork ....... Disabled  PID ................. 1 │
 └───────────────────────────────────────────────────┘

1  200  -  GET      /
1  200  -  GET      /assets/index-bc26e55c.js
1  200  -  GET      /assets/index-d9ef7090.css
1  200  -  GET      /src/assets/js/script.min.js
1  200  -  GET      /favicon.ico
1  200  -  GET      /favicon.ico
SIGSEGV: segmentation violation
PC=0x7f8c33bf7524 m=0 sigcode=1
signal arrived during cgo execution

goroutine 10 [syscall, 1 minutes]:
runtime.cgocall(0xf804a0, 0xc000166a90)
        /usr/local/go/src/runtime/cgocall.go:157 +0x4b fp=0xc000166a68 sp=0xc000166a30 pc=0x4b440b
github.com/sugarme/gotch/libtch._Cfunc_atg_divide(0x7f8bd800d310, 0x7f8bd800b860, 0x7f8bd800b420)
        _cgo_gotypes.go:16083 +0x45 fp=0xc000166a90 sp=0xc000166a68 pc=0xa74cc5
github.com/sugarme/gotch/ts.(*Tensor).Divide.AtgDivide.func1(0x0?, 0x7f8bd800d310?, 0x0?)
        /app/go/pkg/mod/github.com/sugarme/[email protected]/libtch/c-generated.go:4545 +0x87 fp=0xc000166ad8 sp=0xc000166a90 pc=0xbef247
github.com/sugarme/gotch/libtch.AtgDivide(...)
        /app/go/pkg/mod/github.com/sugarme/[email protected]/libtch/c-generated.go:4545
github.com/sugarme/gotch/ts.(*Tensor).Divide(0xc000599110, 0xc000599170, 0x1)
        /app/go/pkg/mod/github.com/sugarme/[email protected]/ts/tensor-generated.go:16412 +0xbe fp=0xc000166b70 sp=0xc000166ad8 pc=0xbef05e

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.