import{s as Ve,o as Ne,n as We}from"../chunks/scheduler.56725da7.js";import{S as Se,i as Ge,e as p,s as o,c,h as Re,a as u,d as n,b as a,f as Me,g as d,j as _,k as ye,l as J,m as l,n as M,t as y,o as g,p as h}from"../chunks/index.18a26576.js";import{C as xe}from"../chunks/CopyLLMTxtMenu.cb10b98b.js";import{D as ke}from"../chunks/Docstring.46c11ef1.js";import{C as L}from"../chunks/CodeBlock.e5842034.js";import{E as ve}from"../chunks/ExampleCodeBlock.31145b1a.js";import{H as D}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d674d2fe.js";function ze(q){let r,Z="Text Example:",f,m,i;return m=new L({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEFmcm9tJTIwb3B0aW11bS5uZXVyb24lMjBpbXBvcnQlMjBOZXVyb25Nb2RlbEZvclNlbnRlbmNlVHJhbnNmb3JtZXJzJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3B0aW11bSUyRmJnZS1iYXNlLWVuLXYxLjUtbmV1cm9ueCUyMiklMEFtb2RlbCUyMCUzRCUyME5ldXJvbk1vZGVsRm9yU2VudGVuY2VUcmFuc2Zvcm1lcnMuZnJvbV9wcmV0cmFpbmVkKCUyMm9wdGltdW0lMkZiZ2UtYmFzZS1lbi12MS41LW5ldXJvbnglMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkluJTIwdGhlJTIwc21vdWxkZXJpbmclMjBwcm9taXNlJTIwb2YlMjB0aGUlMjBmYWxsJTIwb2YlMjBUcm95JTJDJTIwYSUyMG15dGhpY2FsJTIwd29ybGQlMjBvZiUyMGdvZHMlMjBhbmQlMjBtb3J0YWxzJTIwcmlzZXMlMjBmcm9tJTIwdGhlJTIwYXNoZXMuJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBdG9rZW5fZW1iZWRkaW5ncyUyMCUzRCUyMG91dHB1dHMudG9rZW5fZW1iZWRkaW5ncyUwQXNlbnRlbmNlX2VtYmVkZGluZyUyMCUzRCUyMCUzRCUyMG91dHB1dHMuc2VudGVuY2VfZW1iZWRkaW5n",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronModelForSentenceTransformers

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/bge-base-en-v1.5-neuronx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NeuronModelForSentenceTransformers.from_pretrained(<span class="hljs-string">&quot;optimum/bge-base-en-v1.5-neuronx&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;In the smouldering promise of the fall of Troy, a mythical world of gods and mortals rises from the ashes.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>token_embeddings = outputs.token_embeddings
<span class="hljs-meta">&gt;&gt;&gt; </span>sentence_embedding = = outputs.sentence_embedding`,wrap:!1}}),{c(){r=p("p"),r.textContent=Z,f=o(),c(m.$$.fragment)},l(s){r=u(s,"P",{"data-svelte-h":!0}),_(r)!=="svelte-1vtqn41"&&(r.textContent=Z),f=a(s),d(m.$$.fragment,s)},m(s,b){l(s,r,b),l(s,f,b),M(m,s,b),i=!0},p:We,i(s){i||(y(m.$$.fragment,s),i=!0)},o(s){g(m.$$.fragment,s),i=!1},d(s){s&&(n(r),n(f)),h(m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BuaWdodCclNUQlMkMlMjBpbWFnZXMlM0RJbWFnZS5vcGVuKCUyMnR3b19kb2dzX2luX3Nub3cuanBnJTIyKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUwQSklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBY29zX3Njb3JlcyUyMCUzRCUyMHV0aWwuY29zX3NpbShvdXRwdXRzLmltYWdlX2VtYmVkcyUyQyUyMG91dHB1dHMudGV4dF9lbWJlZHMpJTIwJTIwJTIzJTIwQ29tcHV0ZSUyMGNvc2luZSUyMHNpbWlsYXJpdGllcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> sentence_transformers <span class="hljs-keyword">import</span> util
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronModelForSentenceTransformers

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;optimum/clip_vit_emb_neuronx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NeuronModelForSentenceTransformers.from_pretrained(<span class="hljs-string">&quot;optimum/clip_vit_emb_neuronx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>util.http_get(<span class="hljs-string">&quot;https://github.com/UKPLab/sentence-transformers/raw/master/examples/sentence_transformer/applications/image-search/two_dogs_in_snow.jpg&quot;</span>, <span class="hljs-string">&quot;two_dogs_in_snow.jpg&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">&gt;&gt;&gt; </span>    text=[<span class="hljs-string">&quot;Two dogs in the snow&quot;</span>, <span class="hljs-string">&#x27;A cat on a table&#x27;</span>, <span class="hljs-string">&#x27;A picture of London at night&#x27;</span>], images=Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;two_dogs_in_snow.jpg&quot;</span>), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>cos_scores = util.cos_sim(outputs.image_embeds, outputs.text_embeds)  <span class="hljs-comment"># Compute cosine similarities</span>`,wrap:!1}}),{c(){r=p("p"),r.textContent=Z,f=o(),c(m.$$.fragment)},l(s){r=u(s,"P",{"data-svelte-h":!0}),_(r)!=="svelte-l4l8dd"&&(r.textContent=Z),f=a(s),d(m.$$.fragment,s)},m(s,b){l(s,r,b),l(s,f,b),M(m,s,b),i=!0},p:We,i(s){i||(y(m.$$.fragment,s),i=!0)},o(s){g(m.$$.fragment,s),i=!1},d(s){s&&(n(r),n(f)),h(m,s)}}}function Fe(q){let r,Z,f,m,i,s,b,K,X,Te='<a href="https://sbert.net/" rel="nofollow">SentenceTransformers 🤗</a> is a Python framework for state-of-the-art sentence, text and image embeddings. It can be used to compute embeddings using Sentence Transformer models or to calculate similarity scores using Cross-Encoder (a.k.a. reranker) models. This unlocks a wide range of applications, including semantic search, semantic textual similarity, and paraphrase mining. Optimum Neuron offer APIs to ease the use of SentenceTransformers on AWS Neuron devices.',O,$,ee,B,te,k,we="<li>Example - Text embeddings</li>",ne,v,se,W,_e="<li>Example - Image Search</li>",le,V,oe,N,ae,S,Ze="<li>Example - Text embeddings</li>",re,G,me,R,Ce="<li>Example - Image Search</li>",ie,x,pe,z,ce,U,Y,ge,E,Ie="Neuron Model for Sentence Transformers.",he,Q,Xe=`This model inherits from <code>~neuron.modeling.NeuronTracedModel</code>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`,fe,H,$e="Sentence Transformers model on Neuron devices.",be,T,F,Ue,A,Be="The <code>NeuronModelForSentenceTransformers</code> forward method, overrides the <code>__call__</code> special method. Accepts only the inputs traced during the compilation step. Any additional inputs provided during inference will be ignored. To include extra inputs, recompile the model with those inputs specified.",je,C,Je,I,ue,P,de;return i=new xe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new D({props:{title:"Sentence Transformers 🤗",local:"sentence-transformers-",headingTag:"h1"}}),$=new D({props:{title:"Export to Neuron",local:"export-to-neuron",headingTag:"h2"}}),B=new D({props:{title:"Option 1: CLI",local:"option-1-cli",headingTag:"h3"}}),v=new L({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtbSUyMEJBQUklMkZiZ2UtbGFyZ2UtZW4tdjEuNSUyMC0tc2VxdWVuY2VfbGVuZ3RoJTIwMzg0JTIwLS1iYXRjaF9zaXplJTIwMSUyMC0tdGFzayUyMGZlYXR1cmUtZXh0cmFjdGlvbiUyMGJnZV9lbWJfbmV1cm9uJTJG",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron -m BAAI/bge-large-en-v1.5 --sequence_length 384 --batch_size 1 --task feature-extraction bge_emb_neuron/',wrap:!1}}),V=new L({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtbSUyMHNlbnRlbmNlLXRyYW5zZm9ybWVycyUyRmNsaXAtVmlULUItMzIlMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDY0JTIwLS10ZXh0X2JhdGNoX3NpemUlMjAzJTIwLS1pbWFnZV9iYXRjaF9zaXplJTIwMSUyMC0tbnVtX2NoYW5uZWxzJTIwMyUyMC0taGVpZ2h0JTIwMjI0JTIwLS13aWR0aCUyMDIyNCUyMC0tdGFzayUyMGZlYXR1cmUtZXh0cmFjdGlvbiUyMC0tc3ViZm9sZGVyJTIwMF9DTElQTW9kZWwlMjBjbGlwX2VtYl9uZXVyb24lMkY=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron -m sentence-transformers/clip-ViT-B-32 --sequence_length 64 --text_batch_size 3 --image_batch_size 1 --num_channels 3 --height 224 --width 224 --task feature-extraction --subfolder 0_CLIPModel clip_emb_neuron/',wrap:!1}}),N=new D({props:{title:"Option 2: Python API",local:"option-2-python-api",headingTag:"h3"}}),G=new L({props:{code:"ZnJvbSUyMG9wdGltdW0ubmV1cm9uJTIwaW1wb3J0JTIwTmV1cm9uTW9kZWxGb3JTZW50ZW5jZVRyYW5zZm9ybWVycyUwQSUwQSUyMyUyMGNvbmZpZ3MlMjBmb3IlMjBjb21waWxpbmclMjBtb2RlbCUwQWlucHV0X3NoYXBlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmJhdGNoX3NpemUlMjIlM0ElMjAxJTJDJTBBJTIwJTIwJTIwJTIwJTIyc2VxdWVuY2VfbGVuZ3RoJTIyJTNBJTIwMzg0JTJDJTBBJTdEJTBBY29tcGlsZXJfYXJncyUyMCUzRCUyMCU3QiUyMmF1dG9fY2FzdCUyMiUzQSUyMCUyMm1hdG11bCUyMiUyQyUyMCUyMmF1dG9fY2FzdF90eXBlJTIyJTNBJTIwJTIyYmYxNiUyMiU3RCUwQSUwQW5ldXJvbl9tb2RlbCUyMCUzRCUyME5ldXJvbk1vZGVsRm9yU2VudGVuY2VUcmFuc2Zvcm1lcnMuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkJBQUklMkZiZ2UtbGFyZ2UtZW4tdjEuNSUyMiUyQyUwQSUyMCUyMCUyMCUyMGV4cG9ydCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjAqKmlucHV0X3NoYXBlcyUyQyUwQSUyMCUyMCUyMCUyMCoqY29tcGlsZXJfYXJncyUyQyUwQSklMEElMEElMjMlMjBTYXZlJTIwbG9jYWxseSUwQW5ldXJvbl9tb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIyYmdlX2VtYl9uZXVyb24lMkYlMjIpJTBBJTBBJTIzJTIwVXBsb2FkJTIwdG8lMjB0aGUlMjBIdWdnaW5nRmFjZSUyMEh1YiUwQW5ldXJvbl9tb2RlbC5wdXNoX3RvX2h1YiglMEElMjAlMjAlMjAlMjAlMjJiZ2VfZW1iX25ldXJvbiUyRiUyMiUyQyUyMHJlcG9zaXRvcnlfaWQlM0QlMjJvcHRpbXVtJTJGYmdlLWJhc2UtZW4tdjEuNS1uZXVyb254JTIyJTIwJTIwJTIzJTIwUmVwbGFjZSUyMHdpdGglMjB5b3VyJTIwSEYlMjBIdWIlMjByZXBvJTIwaWQlMEEpJTBB",highlighted:`<span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronModelForSentenceTransformers

<span class="hljs-comment"># configs for compiling model</span>
input_shapes = {
    <span class="hljs-string">&quot;batch_size&quot;</span>: <span class="hljs-number">1</span>,
    <span class="hljs-string">&quot;sequence_length&quot;</span>: <span class="hljs-number">384</span>,
}
compiler_args = {<span class="hljs-string">&quot;auto_cast&quot;</span>: <span class="hljs-string">&quot;matmul&quot;</span>, <span class="hljs-string">&quot;auto_cast_type&quot;</span>: <span class="hljs-string">&quot;bf16&quot;</span>}

neuron_model = NeuronModelForSentenceTransformers.from_pretrained(
    <span class="hljs-string">&quot;BAAI/bge-large-en-v1.5&quot;</span>,
    export=<span class="hljs-literal">True</span>,
    **input_shapes,
    **compiler_args,
)

<span class="hljs-comment"># Save locally</span>
neuron_model.save_pretrained(<span class="hljs-string">&quot;bge_emb_neuron/&quot;</span>)

<span class="hljs-comment"># Upload to the HuggingFace Hub</span>
neuron_model.push_to_hub(
    <span class="hljs-string">&quot;bge_emb_neuron/&quot;</span>, repository_id=<span class="hljs-string">&quot;optimum/bge-base-en-v1.5-neuronx&quot;</span>  <span class="hljs-comment"># Replace with your HF Hub repo id</span>
)
`,wrap:!1}}),x=new L({props:{code:"ZnJvbSUyMG9wd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c2hhcGVzJTJDJTBBJTIwJTIwJTIwJTIwKipjb21waWxlcl9hcmdzJTJDJTBBKSUwQSUwQSUyMyUyMFNhdmUlMjBsb2NhbGx5JTBBbmV1cm9uX21vZGVsLnNhdmVfcHJldHJhaW5lZCglMjJjbGlwX2VtYl9uZXVyb24lMkYlMjIpJTBBJTBBJTIzJTIwVXBsb2FkJTIwdG8lMjB0aGUlMjBIdWdnaW5nRmFjZSUyMEh1YiUwQW5ldXJvbl9tb2RlbC5wdXNoX3RvX2h1YiglMEElMjAlMjAlMjAlMjAlMjJjbGlwX2VtYl9uZXVyb24lMkYlMjIlMkMlMjByZXBvc2l0b3J5X2lkJTNEJTIyb3B0aW11bSUyRmNsaXBfdml0X2VtYl9uZXVyb254JTIyJTIwJTIwJTIzJTIwUmVwbGFjZSUyMHdpdGglMjB5b3VyJTIwSEYlMjBIdWIlMjByZXBvJTIwaWQlMEEp",highlighted:`<span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronModelForSentenceTransformers

<span class="hljs-comment"># configs for compiling model</span>
input_shapes = {
    <span class="hljs-string">&quot;num_channels&quot;</span>: <span class="hljs-number">3</span>,
    <span class="hljs-string">&quot;height&quot;</span>: <span class="hljs-number">224</span>,
    <span class="hljs-string">&quot;width&quot;</span>: <span class="hljs-number">224</span>,
    <span class="hljs-string">&quot;text_batch_size&quot;</span>: <span class="hljs-number">3</span>,
    <span class="hljs-string">&quot;image_batch_size&quot;</span>: <span class="hljs-number">1</span>,
    <span class="hljs-string">&quot;sequence_length&quot;</span>: <span class="hljs-number">64</span>,
}
compiler_args = {<span class="hljs-string">&quot;auto_cast&quot;</span>: <span class="hljs-string">&quot;matmul&quot;</span>, <span class="hljs-string">&quot;auto_cast_type&quot;</span>: <span class="hljs-string">&quot;bf16&quot;</span>}

neuron_model = NeuronModelForSentenceTransformers.from_pretrained(
    <span class="hljs-string">&quot;sentence-transformers/clip-ViT-B-32&quot;</span>,
    subfolder=<span class="hljs-string">&quot;0_CLIPModel&quot;</span>,
    export=<span class="hljs-literal">True</span>,
    dynamic_batch_size=<span class="hljs-literal">False</span>,
    **input_shapes,
    **compiler_args,
)

<span class="hljs-comment"># Save locally</span>
neuron_model.save_pretrained(<span class="hljs-string">&quot;clip_emb_neuron/&quot;</span>)

<span class="hljs-comment"># Upload to the HuggingFace Hub</span>
neuron_model.push_to_hub(
    <span class="hljs-string">&quot;clip_emb_neuron/&quot;</span>, repository_id=<span class="hljs-string">&quot;optimum/clip_vit_emb_neuronx&quot;</span>  <span class="hljs-comment"># Replace with your HF Hub repo id</span>
)`,wrap:!1}}),z=new D({props:{title:"NeuronModelForSentenceTransformers",local:"optimum.neuron.NeuronModelForSentenceTransformers",headingTag:"h2"}}),Y=new ke({props:{name:"class optimum.neuron.NeuronModelForSentenceTransformers",anchor:"optimum.neuron.NeuronModelForSentenceTransformers",parameters:[{name:"model",val:": ScriptModule"},{name:"config",val:": PretrainedConfig"},{name:"model_save_dir",val:": str | pathlib.Path | tempfile.TemporaryDirectory | None = None"},{name:"model_file_name",val:": str | None = None"},{name:"preprocessors",val:": list | None = None"},{name:"neuron_config",val:": NeuronDefaultConfig | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>optimum.neuron.modeling.NeuronTracedModel.from_pretrained</code> method to load the model weights.`,name:"config"},{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.model",description:'<strong>model</strong> (<code>torch.jit._script.ScriptModule</code>) &#x2014; <a href="https://pytorch.org/docs/stable/generated/torch.jit.ScriptModule.html" rel="nofollow">torch.jit._script.ScriptModule</a> is the TorchScript module with embedded NEFF(Neuron Executable File Format) compiled by neuron(x) compiler.',name:"model"}],source:"https://github.com/huggingface/optimum-neuron/blob/vr_1016/optimum/neuron/modeling.py#L144"}}),F=new ke({props:{name:"forward",anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"attention_mask",val:": Tensor"},{name:"pixel_values",val:": torch.Tensor | None = None"},{name:"token_type_ids",val:": torch.Tensor | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor | None</code> of shape <code>(batch_size, sequence_length)</code>, defaults to <code>None</code>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor | None</code> of shape <code>(batch_size, sequence_length)</code>, defaults to <code>None</code>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:
<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum-neuron/blob/vr_1016/optimum/neuron/modeling.py#L152"}}),C=new ve({props:{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward.example",$$slots:{default:[ze]},$$scope:{ctx:q}}}),I=new ve({props:{anchor:"optimum.neuron.NeuronModelForSentenceTransformers.forward.example-2",$$slots:{default:[Ye]},$$scope:{ctx:q}}}),{c(){r=p("meta"),Z=o(),f=p("p"),m=o(),c(i.$$.fragment),s=o(),c(b.$$.fragment),K=o(),X=p("p"),X.innerHTML=Te,O=o(),c($.$$.fragment),ee=o(),c(B.$$.fragment),te=o(),k=p("ul"),k.innerHTML=we,ne=o(),c(v.$$.fragment),se=o(),W=p("ul"),W.innerHTML=_e,le=o(),c(V.$$.fragment),oe=o(),c(N.$$.fragment),ae=o(),S=p("ul"),S.innerHTML=Ze,re=o(),c(G.$$.fragment),me=o(),R=p("ul"),R.innerHTML=Ce,ie=o(),c(x.$$.fragment),pe=o(),c(z.$$.fragment),ce=o(),U=p("div"),c(Y.$$.fragment),ge=o(),E=p("p"),E.textContent=Ie,he=o(),Q=p("p"),Q.innerHTML=Xe,fe=o(),H=p("p"),H.textContent=$e,be=o(),T=p("div"),c(F.$$.fragment),Ue=o(),A=p("p"),A.innerHTML=Be,je=o(),c(C.$$.fragment),Je=o(),c(I.$$.fragment),ue=o(),P=p("p"),this.h()},l(e){const t=Re("svelte-u9bgzb",document.head);r=u(t,"META",{name:!0,content:!0}),t.forEach(n),Z=a(e),f=u(e,"P",{}),Me(f).forEach(n),m=a(e),d(i.$$.fragment,e),s=a(e),d(b.$$.fragment,e),K=a(e),X=u(e,"P",{"data-svelte-h":!0}),_(X)!=="svelte-18qnw3c"&&(X.innerHTML=Te),O=a(e),d($.$$.fragment,e),ee=a(e),d(B.$$.fragment,e),te=a(e),k=u(e,"UL",{"data-svelte-h":!0}),_(k)!=="svelte-1yh68uj"&&(k.innerHTML=we),ne=a(e),d(v.$$.fragment,e),se=a(e),W=u(e,"UL",{"data-svelte-h":!0}),_(W)!=="svelte-18kij33"&&(W.innerHTML=_e),le=a(e),d(V.$$.fragment,e),oe=a(e),d(N.$$.fragment,e),ae=a(e),S=u(e,"UL",{"data-svelte-h":!0}),_(S)!=="svelte-1yh68uj"&&(S.innerHTML=Ze),re=a(e),d(G.$$.fragment,e),me=a(e),R=u(e,"UL",{"data-svelte-h":!0}),_(R)!=="svelte-18kij33"&&(R.innerHTML=Ce),ie=a(e),d(x.$$.fragment,e),pe=a(e),d(z.$$.fragment,e),ce=a(e),U=u(e,"DIV",{class:!0});var j=Me(U);d(Y.$$.fragment,j),ge=a(j),E=u(j,"P",{"data-svelte-h":!0}),_(E)!=="svelte-o9alfo"&&(E.textContent=Ie),he=a(j),Q=u(j,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-t21i2g"&&(Q.innerHTML=Xe),fe=a(j),H=u(j,"P",{"data-svelte-h":!0}),_(H)!=="svelte-fib3qb"&&(H.textContent=$e),be=a(j),T=u(j,"DIV",{class:!0});var w=Me(T);d(F.$$.fragment,w),Ue=a(w),A=u(w,"P",{"data-svelte-h":!0}),_(A)!=="svelte-mm1jdo"&&(A.innerHTML=Be),je=a(w),d(C.$$.fragment,w),Je=a(w),d(I.$$.fragment,w),w.forEach(n),j.forEach(n),ue=a(e),P=u(e,"P",{}),Me(P).forEach(n),this.h()},h(){ye(r,"name","hf:doc:metadata"),ye(r,"content",qe),ye(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ye(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){J(document.head,r),l(e,Z,t),l(e,f,t),l(e,m,t),M(i,e,t),l(e,s,t),M(b,e,t),l(e,K,t),l(e,X,t),l(e,O,t),M($,e,t),l(e,ee,t),M(B,e,t),l(e,te,t),l(e,k,t),l(e,ne,t),M(v,e,t),l(e,se,t),l(e,W,t),l(e,le,t),M(V,e,t),l(e,oe,t),M(N,e,t),l(e,ae,t),l(e,S,t),l(e,re,t),M(G,e,t),l(e,me,t),l(e,R,t),l(e,ie,t),M(x,e,t),l(e,pe,t),M(z,e,t),l(e,ce,t),l(e,U,t),M(Y,U,null),J(U,ge),J(U,E),J(U,he),J(U,Q),J(U,fe),J(U,H),J(U,be),J(U,T),M(F,T,null),J(T,Ue),J(T,A),J(T,je),M(C,T,null),J(T,Je),M(I,T,null),l(e,ue,t),l(e,P,t),de=!0},p(e,[t]){const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),C.$set(j);const w={};t&2&&(w.$$scope={dirty:t,ctx:e}),I.$set(w)},i(e){de||(y(i.$$.fragment,e),y(b.$$.fragment,e),y($.$$.fragment,e),y(B.$$.fragment,e),y(v.$$.fragment,e),y(V.$$.fragment,e),y(N.$$.fragment,e),y(G.$$.fragment,e),y(x.$$.fragment,e),y(z.$$.fragment,e),y(Y.$$.fragment,e),y(F.$$.fragment,e),y(C.$$.fragment,e),y(I.$$.fragment,e),de=!0)},o(e){g(i.$$.fragment,e),g(b.$$.fragment,e),g($.$$.fragment,e),g(B.$$.fragment,e),g(v.$$.fragment,e),g(V.$$.fragment,e),g(N.$$.fragment,e),g(G.$$.fragment,e),g(x.$$.fragment,e),g(z.$$.fragment,e),g(Y.$$.fragment,e),g(F.$$.fragment,e),g(C.$$.fragment,e),g(I.$$.fragment,e),de=!1},d(e){e&&(n(Z),n(f),n(m),n(s),n(K),n(X),n(O),n(ee),n(te),n(k),n(ne),n(se),n(W),n(le),n(oe),n(ae),n(S),n(re),n(me),n(R),n(ie),n(pe),n(ce),n(U),n(ue),n(P)),n(r),h(i,e),h(b,e),h($,e),h(B,e),h(v,e),h(V,e),h(N,e),h(G,e),h(x,e),h(z,e),h(Y),h(F),h(C),h(I)}}}const qe='{"title":"Sentence Transformers 🤗","local":"sentence-transformers-","sections":[{"title":"Export to Neuron","local":"export-to-neuron","sections":[{"title":"Option 1: CLI","local":"option-1-cli","sections":[],"depth":3},{"title":"Option 2: Python API","local":"option-2-python-api","sections":[],"depth":3}],"depth":2},{"title":"NeuronModelForSentenceTransformers","local":"optimum.neuron.NeuronModelForSentenceTransformers","sections":[],"depth":2}],"depth":1}';function Ee(q){return Ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Oe extends Se{constructor(r){super(),Ge(this,r,Ee,Fe,Ve,{})}}export{Oe as component};
