Sentence Similarity
sentence-transformers
Safetensors
modernbert
feature-extraction
dense
Generated from Trainer
dataset_size:799680
loss:MultipleNegativesRankingLoss
text-embeddings-inference
Run this model with HF Jobs
Run Shuu12121/CodeSearch-ModernBERT-Owl-ph2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Shuu12121/CodeSearch-ModernBERT-Owl-ph2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Shuu12121/CodeSearch-ModernBERT-Owl-ph2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Shuu12121/CodeSearch-ModernBERT-Owl-ph2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Shuu12121/CodeSearch-ModernBERT-Owl-ph2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Shuu12121/CodeSearch-ModernBERT-Owl-ph2") sentences = [ "Disconnects the pool.\n\nDoes everything that +clear+ does, except if the pool is closed\nthis method does nothing but +clear+ would raise PoolClosedError.\n\n@since 2.1.0\n@api private", "def disconnect!(options = nil)\n do_clear(options)\n rescue Error::PoolClosedError\n # The \"disconnected\" state is between closed and paused.\n # When we are trying to disconnect the pool, permit the pool to be\n # already closed.\n end", "func TestNamedTupleWithEscapedColumns(t *testing.T) {\n\tTestProtocols(t, func(t *testing.T, protocol clickhouse.Protocol) {\n\t\tconn, err := GetNativeConnection(t, protocol, nil, nil, nil)\n\t\tctx := context.Background()\n\t\trequire.NoError(t, err)\n\t\t// https://github.com/ClickHouse/ClickHouse/pull/36544\n\t\tif !CheckMinServerServerVersion(conn, 22, 5, 0) {\n\t\t\tt.Skip(fmt.Errorf(\"unsupported clickhouse version\"))\n\t\t\treturn\n\t\t}\n\t\tconst ddl = \"CREATE TABLE test_tuple (Col1 Tuple(`56` String, `a22\\\\`` Int64)) Engine MergeTree() ORDER BY tuple()\"\n\t\tdefer func() {\n\t\t\tconn.Exec(ctx, \"DROP TABLE IF EXISTS test_tuple\")\n\t\t}()\n\t\trequire.NoError(t, conn.Exec(ctx, ddl))\n\t\tbatch, err := conn.PrepareBatch(ctx, \"INSERT INTO test_tuple\")\n\t\trequire.NoError(t, err)\n\t\tvar (\n\t\t\tcol1Data = map[string]any{\"56\": \"A\", \"a22`\": int64(1)}\n\t\t)\n\t\trequire.NoError(t, batch.Append(col1Data))\n\t\trequire.Equal(t, 1, batch.Rows())\n\t\trequire.NoError(t, batch.Send())\n\t\tvar col1 map[string]any\n\t\trequire.NoError(t, conn.QueryRow(ctx, \"SELECT * FROM test_tuple\").Scan(&col1))\n\t\tassert.Equal(t, col1Data, col1)\n\t})\n}", "def parse_region(url)\n parts = URI.parse(url).host.split('.')\n parts.each_with_index do |part, index|\n if part == 'sqs'\n # assume region is the part right after the 'sqs' part\n return parts[index + 1]\n end\n end\n nil # no region found\n end" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Upload ModernBERT model
Browse filesFiles changed (13)
- 1_Pooling/config.jsonAdded+10
- README.mdAdded+593
- added_tokens.jsonAdded+7
- config.jsonAdded+48
- config_sentence_transformers.jsonAdded+14
- merges.txtAdded
- model.safetensorsAdded+3
- modules.jsonAdded+14
- sentence_bert_config.jsonAdded+4
- special_tokens_map.jsonAdded+51
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+62
- vocab.jsonAdded
12345678910{ "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, "pooling_mode_weightedmean_tokens": false, "pooling_mode_lasttoken": false, "include_prompt": true}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593---tags:- sentence-transformers- sentence-similarity- feature-extraction- dense- generated_from_trainer- dataset_size:799680- loss:MultipleNegativesRankingLossbase_model: Shuu12121/CodeModernBERT-Owl-v1widget:- source_sentence: 'Disconnects the pool.
Does everything that +clear+ does, except if the pool is closed
this method does nothing but +clear+ would raise PoolClosedError.
@since 2.1.0
@api private' sentences: - "def disconnect!(options = nil)\n do_clear(options)\n rescue Error::PoolClosedError\n\ \ # The \"disconnected\" state is between closed and paused.\n #\ \ When we are trying to disconnect the pool, permit the pool to be\n #\ \ already closed.\n end" - "func TestNamedTupleWithEscapedColumns(t *testing.T) {\n\tTestProtocols(t, func(t\ \ *testing.T, protocol clickhouse.Protocol) {\n\t\tconn, err := GetNativeConnection(t,\ \ protocol, nil, nil, nil)\n\t\tctx := context.Background()\n\t\trequire.NoError(t,\ \ err)\n\t\t// https://github.com/ClickHouse/ClickHouse/pull/36544\n\t\tif !CheckMinServerServerVersion(conn,\ \ 22, 5, 0) {\n\t\t\tt.Skip(fmt.Errorf(\"unsupported clickhouse version\"))\n\t\ \t\treturn\n\t\t}\n\t\tconst ddl = \"CREATE TABLE test_tuple (Col1 Tuple(`56`\ \ String, `a22\\\\`` Int64)) Engine MergeTree() ORDER BY tuple()\"\n\t\tdefer\ \ func() {\n\t\t\tconn.Exec(ctx, \"DROP TABLE IF EXISTS test_tuple\")\n\t\t}()\n\ \t\trequire.NoError(t, conn.Exec(ctx, ddl))\n\t\tbatch, err := conn.PrepareBatch(ctx,\ \ \"INSERT INTO test_tuple\")\n\t\trequire.NoError(t, err)\n\t\tvar (\n\t\t\t\ col1Data = map[string]any{\"56\": \"A\", \"a22`\": int64(1)}\n\t\t)\n\t\trequire.NoError(t,\ \ batch.Append(col1Data))\n\t\trequire.Equal(t, 1, batch.Rows())\n\t\trequire.NoError(t,\ \ batch.Send())\n\t\tvar col1 map[string]any\n\t\trequire.NoError(t, conn.QueryRow(ctx,\ \ \"SELECT * FROM test_tuple\").Scan(&col1))\n\t\tassert.Equal(t, col1Data, col1)\n\ \t})\n}" - "def parse_region(url)\n parts = URI.parse(url).host.split('.')\n \ \ parts.each_with_index do |part, index|\n if part == 'sqs'\n\ \ # assume region is the part right after the 'sqs' part\n \ \ return parts[index + 1]\n end\n end\n \ \ nil # no region found\n end"- source_sentence: "Cancel a running workflow by sync job ID.\n\n This will\ \ search for workflows with IDs matching the pattern sync-{sync_job_id}-*\n \ \ and cancel them. The workflow will catch the CancelledError and update\ \ the\n sync job status to CANCELLED.\n\n Args:\n sync_job_id:\ \ The sync job ID to cancel\n\n Returns:\n True if a workflow\ \ was found and cancelled, False otherwise" sentences: - "async def cancel_sync_job_workflow(self, sync_job_id: str) -> bool:\n \ \ \"\"\"\n \"\"\"\n try:\n client = await temporal_client.get_client()\n\ \n # List workflows to find the one matching our sync job\n \ \ # Note: In production, you might want to store the workflow ID\n \ \ # when starting it for direct lookup\n workflows = []\n \ \ async for workflow in client.list_workflows(\n query=f'WorkflowId\ \ STARTS_WITH \"sync-{sync_job_id}-\"'\n ):\n workflows.append(workflow)\n\ \n if not workflows:\n logger.warning(f\"No running\ \ workflow found for sync job {sync_job_id}\")\n return False\n\ \n # Cancel the workflow(s)\n for workflow in workflows:\n\ \ handle = client.get_workflow_handle(workflow.id)\n \ \ await handle.cancel()\n logger.info(\n \ \ f\"Successfully cancelled workflow {workflow.id} for sync job {sync_job_id}\"\ \n )\n\n return True\n\n except Exception as\ \ e:\n logger.error(f\"Failed to cancel workflow for sync job {sync_job_id}:\ \ {e}\")\n raise" - "def __init__(name, account):\n \"\"\"\n \n \"\"\"" - "renderRows = async (\n table,\n viewname,\n { columns, layout },\n extra,\n\ \ rows,\n state\n) => {\n //console.log(columns);\n //console.log(layout);\n\ \ if (!columns || !layout) return \"View not yet built\";\n\n const fields =\ \ table.getFields();\n\n const role = extra.req.user ? extra.req.user.role_id\ \ : 100;\n var views = {};\n const getView = async (name, relation) => {\n \ \ if (views[name]) return views[name];\n const view_select = parse_view_select(name,\ \ relation);\n const view = View.findOne({ name: view_select.viewname });\n\ \ if (!view) return false;\n if (view.table_id === table.id) view.table\ \ = table;\n else view.table = Table.findOne({ id: view.table_id });\n view.view_select\ \ = view_select;\n views[name] = view;\n return view;\n };\n await set_load_actions_join_fieldviews({\n\ \ table,\n layout,\n fields,\n req: extra.req,\n res: extra.res,\n\ \ });\n\n const owner_field = await table.owner_fieldname();\n const subviewExtra\ \ = { ...extra };\n if (extra.req?.generate_email) {\n // no mjml markup for\ \ for nested subviews, only for the top view\n subviewExtra.req = { ...extra.req,\ \ isSubView: true };\n }\n return await asyncMap(rows, async (row) => {\n \ \ await eachView(layout, async (segment) => {\n // do all the parsing with\ \ data here? make a factory\n const view = await getView(segment.view, segment.relation);\n\ \ if (!view)\n throw new InvalidConfiguration(\n `View ${viewname}\ \ incorrectly configured: cannot find view ${segment.view}`\n );\n \ \ view.check_viewtemplate();\n if (view.viewtemplateObj.renderRows && view.view_select.type\ \ === \"Own\") {\n segment.contents = (\n await view.viewtemplateObj.renderRows(\n\ \ view.table,\n view.name,\n view.configuration,\n\ \ subviewExtra,\n [row],\n state\n )\n\ \ )[0];\n } else {\n let state1 = {};\n const pk_name\ \ = table.pk_name;\n const get_row_val = (k) => {\n //handle expanded\ \ joinfields\n if (row[k] === null) return null;\n if (row[k]?.id\ \ === null) return null;\n return row[k]?.id || row[k];\n };\n\ \ const get_user_id = () => (extra.req.user ? extra.req.user.id : 0);\n\ \ if (view.view_select.type === \"RelationPath\" && view.table_id) {\n\ \ const targetTbl = Table.findOne({ id: view.table_id });\n \ \ const relation = new Relation(\n segment.relation,\n targetTbl.name,\n\ \ displayType(await view.get_state_fields())\n );\n \ \ state1 = pathToState(\n relation,\n relation.isFixedRelation()\ \ ? get_user_id : get_row_val\n );\n } else {\n switch\ \ (view.view_select.type) {\n case \"Own\":\n state1 =\ \ { [pk_name]: get_row_val(pk_name) };\n break;\n case\ \ \"Independent\":\n state1 = {};\n break;\n \ \ case \"ChildList\":\n case \"OneToOneShow\":\n state1\ \ = {\n [view.view_select.through\n ? `${view.view_select.throughTable}.${view.view_select.through}.${view.view_select.table_name}.${view.view_select.field_name}`\n\ \ : view.view_select.field_name]: get_row_val(pk_name),\n \ \ };\n break;\n case \"ParentShow\":\n \ \ //todo set by pk name of parent tablr\n state1 = {\n \ \ id: get_row_val(view.view_select.field_name),\n };\n\ \ break;\n }\n }\n const extra_state = segment.extra_state_fml\n\ \ ? eval_expression(\n segment.extra_state_fml,\n \ \ {\n ...dollarizeObject(state),\n session_id:\ \ getSessionId(extra.req),\n ...row,\n },\n \ \ extra.req.user,\n `Extra state formula for view ${view.name}`\n\ \ )\n : {};\n const { id, ...outerState } = state;\n\ \ //console.log(segment);\n if (segment.state === \"local\") {\n\ \ const state2 = { ...state1, ...extra_state };\n const qs =\ \ stateToQueryString(state2, true);\n if (\n view.name ===\ \ viewname &&\n JSON.stringify(state) === JSON.stringify(state2)\n\ \ )\n throw new InvalidConfiguration(\n `View\ \ ${view.name} embeds itself with same state; inifinite loop detected`\n \ \ );\n segment.contents = div(\n {\n class:\ \ \"d-inline\",\n \"data-sc-embed-viewname\": view.name,\n \ \ \"data-sc-local-state\": `/view/${view.name}${qs}`,\n },\n\ \ await view.run(state2, subviewExtra, view.isRemoteTable())\n \ \ );\n } else {\n const state2 = { ...outerState, ...state1,\ \ ...extra_state };\n const qs = stateToQueryString(state2, true);\n\n\ \ if (\n view.name === viewname &&\n JSON.stringify(state)\ \ === JSON.stringify(state2)\n )\n throw new InvalidConfiguration(\n\ \ `View ${view.name} embeds itself with same state; inifinite loop\ \ detected`\n );\n segment.contents = div(\n {\n\ \ class: \"d-inline\",\n \"data-sc-embed-viewname\"\ : view.name,\n \"data-sc-view-source\": `/view/${view.name}${qs}`,\n\ \ },\n await view.run(state2, subviewExtra, view.isRemoteTable())\n\ \ );\n }\n }\n });\n const user_id = extra.req.user\ \ ? extra.req.user.id : null;\n\n const is_owner =\n table.ownership_formula\ \ && user_id && role > table.min_role_read\n ? await table.is_owner(extra.req.user,\ \ row)\n : owner_field && user_id && row[owner_field] === user_id;\n\n\ \ return render(\n row,\n fields,\n layout,\n viewname,\n\ \ table,\n role,\n extra.req,\n is_owner,\n state,\n\ \ extra\n );\n });\n}"- source_sentence: AddFlags adds flags related to NodeLifecycleController for controller manager to the specified FlagSet. sentences: - "func (o *NodeLifecycleControllerOptions) AddFlags(fs *pflag.FlagSet) {\n\tif\ \ o == nil {\n\t\treturn\n\t}\n\n\tfs.DurationVar(&o.NodeStartupGracePeriod.Duration,\ \ \"node-startup-grace-period\", o.NodeStartupGracePeriod.Duration,\n\t\t\"Amount\ \ of time which we allow starting Node to be unresponsive before marking it unhealthy.\"\ )\n\tfs.DurationVar(&o.NodeMonitorGracePeriod.Duration, \"node-monitor-grace-period\"\ , o.NodeMonitorGracePeriod.Duration,\n\t\t\"Amount of time which we allow running\ \ Node to be unresponsive before marking it unhealthy. \"+\n\t\t\t\"Must be N\ \ times more than kubelet's nodeStatusUpdateFrequency, \"+\n\t\t\t\"where N means\ \ number of retries allowed for kubelet to post node status. \"+\n\t\t\t\"This\ \ value should also be greater than the sum of HTTP2_PING_TIMEOUT_SECONDS and\ \ HTTP2_READ_IDLE_TIMEOUT_SECONDS\")\n\tfs.Float32Var(&o.NodeEvictionRate, \"\ node-eviction-rate\", 0.1, \"Number of nodes per second on which pods are deleted\ \ in case of node failure when a zone is healthy (see --unhealthy-zone-threshold\ \ for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone\ \ clusters.\")\n\tfs.Float32Var(&o.SecondaryNodeEvictionRate, \"secondary-node-eviction-rate\"\ , 0.01, \"Number of nodes per second on which pods are deleted in case of node\ \ failure when a zone is unhealthy (see --unhealthy-zone-threshold for definition\ \ of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters.\ \ This value is implicitly overridden to 0 if the cluster size is smaller than\ \ --large-cluster-size-threshold.\")\n\tfs.Int32Var(&o.LargeClusterSizeThreshold,\ \ \"large-cluster-size-threshold\", 50, fmt.Sprintf(\"Number of nodes from which\ \ %s treats the cluster as large for the eviction logic purposes. --secondary-node-eviction-rate\ \ is implicitly overridden to 0 for clusters this size or smaller. Notice: If\ \ nodes reside in multiple zones, this threshold will be considered as zone node\ \ size threshold for each zone to determine node eviction rate independently.\"\ , names.NodeLifecycleController))\n\tfs.Float32Var(&o.UnhealthyZoneThreshold,\ \ \"unhealthy-zone-threshold\", 0.55, \"Fraction of Nodes in a zone which needs\ \ to be not Ready (minimum 3) for zone to be treated as unhealthy. \")\n}" - "func (v Value) IsNull() bool {\n\treturn v.Val == nil || v.Typ == querypb.Type_NULL_TYPE\n\ }" - "public function response(array $errors)\n {\n if ($this->ajax() ||\ \ $this->wantsJson()) {\n return new JsonResponse($errors, 422);\n\ \ }\n\n return $this->redirector->to($this->getRedirectUrl())\n\ \ ->withInput($this->except($this->dontFlash))\n\ \ ->withErrors($errors, $this->errorBag);\n\ \ }"- source_sentence: 'Count of all the processing errors in this task and its subtasks.
Generated from protobuf field <code>int32 total_processing_error_count = 21;</code>
@return int' sentences: - "fn add_helper(&self, msg: SignedMessage) -> Result<(), Error> {\n let\ \ from = msg.from();\n let cur_ts = self.cur_tipset.lock().clone();\n \ \ add_helper(\n self.api.as_ref(),\n self.bls_sig_cache.as_ref(),\n\ \ self.pending.as_ref(),\n msg,\n self.get_state_sequence(&from,\ \ &cur_ts)?,\n )\n }" - "public function getTotalProcessingErrorCount()\n {\n return $this->total_processing_error_count;\n\ \ }" - "def datetime_utc_to_local(dt):\n\t\"\"\"\n\t\n\t\"\"\"\n\tdt = dt.replace(tzinfo=dateutil.tz.tzutc())\n\ \tdt = dt.astimezone(dateutil.tz.tzlocal())\n\treturn dt.replace(tzinfo=None)"- source_sentence: "Computes the absolute value of each element retrieved from a strided\ \ input array `x` via a callback function and assigns each result to an element\ \ in a strided output array `y`.\n\n@param {NonNegativeInteger} N - number of\ \ indexed elements\n@param {Collection} x - input array/collection\n@param {integer}\ \ strideX - `x` stride length\n@param {NonNegativeInteger} offsetX - starting\ \ `x` index\n@param {Collection} y - destination array/collection\n@param {integer}\ \ strideY - `y` stride length\n@param {NonNegativeInteger} offsetY - starting\ \ `y` index\n@param {Callback} clbk - callback\n@param {*} [thisArg] - callback\ \ execution context\n@returns {Collection} `y`\n\n@example\nfunction accessor(\ \ v ) {\n return v * 2.0;\n}\n\nvar x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\nvar\ \ y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n\nabsBy( x.length, x, 1, 0, y, 1, 0, accessor\ \ );\n\nconsole.log( y );\n// => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]" sentences: - "public ArrayList<Skyline> findSkyline(int start, int end) {\n // Base\ \ case: only one building, return its skyline.\n if (start == end) {\n\ \ ArrayList<Skyline> list = new ArrayList<>();\n list.add(new\ \ Skyline(building[start].left, building[start].height));\n list.add(new\ \ Skyline(building[end].right, 0)); // Add the end of the building\n \ \ return list;\n }\n\n int mid = (start + end) / 2;\n\n \ \ ArrayList<Skyline> sky1 = this.findSkyline(start, mid); // Find the skyline\ \ of the left half\n ArrayList<Skyline> sky2 = this.findSkyline(mid + 1,\ \ end); // Find the skyline of the right half\n return this.mergeSkyline(sky1,\ \ sky2); // Merge the two skylines\n }" - "def get_supported_systems_info\n request(\n :expects =>\ \ 200,\n :idempotent => true,\n :method => 'GET',\n\ \ :parser => Fog::ToHashDocument.new,\n :path \ \ => 'supportedSystemsInfo'\n )\n end" - "function absBy( N, x, strideX, offsetX, y, strideY, offsetY, clbk, thisArg )\ \ {\n\treturn mapBy( N, x, strideX, offsetX, y, strideY, offsetY, abs, clbk, thisArg\ \ ); // eslint-disable-line max-len\n}"pipeline_tag: sentence-similaritylibrary_name: sentence-transformers---
# SentenceTransformer based on Shuu12121/CodeModernBERT-Owl-v1
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Shuu12121/CodeModernBERT-Owl-v1](https://huggingface.co/Shuu12121/CodeModernBERT-Owl-v1). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description- **Model Type:** Sentence Transformer- **Base model:** [Shuu12121/CodeModernBERT-Owl-v1](https://huggingface.co/Shuu12121/CodeModernBERT-Owl-v1) <!-- at revision 33220abe62ef7d02fc36c62487e77751459d8c1a -->- **Maximum Sequence Length:** 1024 tokens- **Output Dimensionality:** 768 dimensions- **Similarity Function:** Cosine Similarity<!-- - **Training Dataset:** Unknown --><!-- - **Language:** Unknown --><!-- - **License:** Unknown -->
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```SentenceTransformer( (0): Transformer({'max_seq_length': 1024, 'do_lower_case': False, 'architecture': 'ModernBertModel'}) (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, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True}))```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bashpip install -U sentence-transformers```
Then you can load this model and run inference.```pythonfrom sentence_transformers import SentenceTransformer
# Download from the 🤗 Hubmodel = SentenceTransformer("sentence_transformers_model_id")# Run inferencesentences = [ 'Computes the absolute value of each element retrieved from a strided input array `x` via a callback function and assigns each result to an element in a strided output array `y`.\n\n@param {NonNegativeInteger} N - number of indexed elements\n@param {Collection} x - input array/collection\n@param {integer} strideX - `x` stride length\n@param {NonNegativeInteger} offsetX - starting `x` index\n@param {Collection} y - destination array/collection\n@param {integer} strideY - `y` stride length\n@param {NonNegativeInteger} offsetY - starting `y` index\n@param {Callback} clbk - callback\n@param {*} [thisArg] - callback execution context\n@returns {Collection} `y`\n\n@example\nfunction accessor( v ) {\n return v * 2.0;\n}\n\nvar x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];\nvar y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n\nabsBy( x.length, x, 1, 0, y, 1, 0, accessor );\n\nconsole.log( y );\n// => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]', 'function absBy( N, x, strideX, offsetX, y, strideY, offsetY, clbk, thisArg ) {\n\treturn mapBy( N, x, strideX, offsetX, y, strideY, offsetY, abs, clbk, thisArg ); // eslint-disable-line max-len\n}', 'public ArrayList<Skyline> findSkyline(int start, int end) {\n // Base case: only one building, return its skyline.\n if (start == end) {\n ArrayList<Skyline> list = new ArrayList<>();\n list.add(new Skyline(building[start].left, building[start].height));\n list.add(new Skyline(building[end].right, 0)); // Add the end of the building\n return list;\n }\n\n int mid = (start + end) / 2;\n\n ArrayList<Skyline> sky1 = this.findSkyline(start, mid); // Find the skyline of the left half\n ArrayList<Skyline> sky2 = this.findSkyline(mid + 1, end); // Find the skyline of the right half\n return this.mergeSkyline(sky1, sky2); // Merge the two skylines\n }',]embeddings = model.encode(sentences)print(embeddings.shape)# [3, 768]
# Get the similarity scores for the embeddingssimilarities = model.similarity(embeddings, embeddings)print(similarities)# tensor([[1.0000, 0.8429, 0.0136],# [0.8429, 1.0000, 0.1084],# [0.0136, 0.1084, 1.0000]])```
<!--### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>-->
<!--### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>-->
<!--### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*-->
<!--## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*-->
<!--### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*-->
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 799,680 training samples* Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>* Approximate statistics based on the first 1000 samples: | | sentence_0 | sentence_1 | label | |:--------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 8 tokens</li><li>mean: 72.08 tokens</li><li>max: 1024 tokens</li></ul> | <ul><li>min: 13 tokens</li><li>mean: 165.78 tokens</li><li>max: 1024 tokens</li></ul> | <ul><li>min: 1.0</li><li>mean: 1.0</li><li>max: 1.0</li></ul> |* Samples: | sentence_0 | sentence_1 | label | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------| | <code>Set the column title<br><br>@param column - column number (first column is: 0)<br>@param title - new column title</code> | <code>setHeader = function(column, newValue) {<br> const obj = this;<br><br> if (obj.headers[column]) {<br> const oldValue = obj.headers[column].textContent;<br> const onchangeheaderOldValue = (obj.options.columns && obj.options.columns[column] && obj.options.columns[column].title) || '';<br><br> if (! newValue) {<br> newValue = getColumnName(column);<br> }<br><br> obj.headers[column].textContent = newValue;<br> // Keep the title property<br> obj.headers[column].setAttribute('title', newValue);<br> // Update title<br> if (!obj.options.columns) {<br> obj.options.columns = [];<br> }<br> if (!obj.options.columns[column]) {<br> obj.options.columns[column] = {};<br> }<br> obj.options.columns[column].title = newValue;<br><br> setHistory.call(obj, {<br> action: 'setHeader',<br> column: column,<br> oldValue: oldValue,<br> newValue: newValue<br> });<br><br> // On onchange header<br> dispatch.c...</code> | <code>1.0</code> | | <code>Elsewhere this is known as a "Weak Value Map". Whereas a std JS WeakMap<br>is weak on its keys, this map is weak on its values. It does not retain these<br>values strongly. If a given value disappears, then the entries for it<br>disappear from every weak-value-map that holds it as a value.<br><br>Just as a WeakMap only allows gc-able values as keys, a weak-value-map<br>only allows gc-able values as values.<br><br>Unlike a WeakMap, a weak-value-map unavoidably exposes the non-determinism of<br>gc to its clients. Thus, both the ability to create one, as well as each<br>created one, must be treated as dangerous capabilities that must be closely<br>held. A program with access to these can read side channels though gc that do<br>not* rely on the ability to measure duration. This is a separate, and bad,<br>timing-independent side channel.<br><br>This non-determinism also enables code to escape deterministic replay. In a<br>blockchain context, this could cause validators to differ from each other,<br>preventing consensus, and thus preventing ...</code> | <code>makeFinalizingMap = (finalizer, opts) => {<br> const { weakValues = false } = opts || {};<br> if (!weakValues || !WeakRef || !FinalizationRegistry) {<br> /** @type Map<K, V> */<br> const keyToVal = new Map();<br> return Far('fakeFinalizingMap', {<br> clearWithoutFinalizing: keyToVal.clear.bind(keyToVal),<br> get: keyToVal.get.bind(keyToVal),<br> has: keyToVal.has.bind(keyToVal),<br> set: (key, val) => {<br> keyToVal.set(key, val);<br> },<br> delete: keyToVal.delete.bind(keyToVal),<br> getSize: () => keyToVal.size,<br> });<br> }<br> /** @type Map<K, WeakRef<any>> */<br> const keyToRef = new Map();<br> const registry = new FinalizationRegistry(key => {<br> // Because this will delete the current binding of `key`, we need to<br> // be sure that it is not called because a previous binding was collected.<br> // We do this with the `unregister` in `set` below, assuming that<br> // `unregister` *immediately* suppresses the finalization of the thing<br> // it unregisters. TODO If this is...</code> | <code>1.0</code> | | <code>Creates a function that memoizes the result of `func`. If `resolver` is<br>provided, it determines the cache key for storing the result based on the<br>arguments provided to the memoized function. By default, the first argument<br>provided to the memoized function is used as the map cache key. The `func`<br>is invoked with the `this` binding of the memoized function.<br><br>**Note:** The cache is exposed as the `cache` property on the memoized<br>function. Its creation may be customized by replacing the `_.memoize.Cache`<br>constructor with one whose instances implement the<br>[`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)<br>method interface of `delete`, `get`, `has`, and `set`.<br><br>@static<br>@memberOf _<br>@since 0.1.0<br>@category Function<br>@param {Function} func The function to have its output memoized.<br>@param {Function} [resolver] The function to resolve the cache key.<br>@returns {Function} Returns the new memoized function.<br>@example<br><br>var object = { 'a': 1, 'b': 2 };<br>var othe...</code> | <code>function memoize(func, resolver) {<br> if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {<br> throw new TypeError(FUNC_ERROR_TEXT);<br> }<br> var memoized = function() {<br> var args = arguments,<br> key = resolver ? resolver.apply(this, args) : args[0],<br> cache = memoized.cache;<br><br> if (cache.has(key)) {<br> return cache.get(key);<br> }<br> var result = func.apply(this, args);<br> memoized.cache = cache.set(key, result);<br> return result;<br> };<br> memoized.cache = new (memoize.Cache || MapCache);<br> return memoized;<br> }</code> | <code>1.0</code> |* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters: ```json { "scale": 20.0, "similarity_fct": "cos_sim" } ```
### Training Hyperparameters#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 120- `per_device_eval_batch_size`: 120- `fp16`: True- `multi_dataset_batch_sampler`: round_robin
#### All Hyperparameters<details><summary>Click to expand</summary>
- `overwrite_output_dir`: False- `do_predict`: False- `eval_strategy`: no- `prediction_loss_only`: True- `per_device_train_batch_size`: 120- `per_device_eval_batch_size`: 120- `per_gpu_train_batch_size`: None- `per_gpu_eval_batch_size`: None- `gradient_accumulation_steps`: 1- `eval_accumulation_steps`: None- `torch_empty_cache_steps`: None- `learning_rate`: 5e-05- `weight_decay`: 0.0- `adam_beta1`: 0.9- `adam_beta2`: 0.999- `adam_epsilon`: 1e-08- `max_grad_norm`: 1- `num_train_epochs`: 3- `max_steps`: -1- `lr_scheduler_type`: linear- `lr_scheduler_kwargs`: {}- `warmup_ratio`: 0.0- `warmup_steps`: 0- `log_level`: passive- `log_level_replica`: warning- `log_on_each_node`: True- `logging_nan_inf_filter`: True- `save_safetensors`: True- `save_on_each_node`: False- `save_only_model`: False- `restore_callback_states_from_checkpoint`: False- `no_cuda`: False- `use_cpu`: False- `use_mps_device`: False- `seed`: 42- `data_seed`: None- `jit_mode_eval`: False- `use_ipex`: False- `bf16`: False- `fp16`: True- `fp16_opt_level`: O1- `half_precision_backend`: auto- `bf16_full_eval`: False- `fp16_full_eval`: False- `tf32`: None- `local_rank`: 0- `ddp_backend`: None- `tpu_num_cores`: None- `tpu_metrics_debug`: False- `debug`: []- `dataloader_drop_last`: False- `dataloader_num_workers`: 0- `dataloader_prefetch_factor`: None- `past_index`: -1- `disable_tqdm`: False- `remove_unused_columns`: True- `label_names`: None- `load_best_model_at_end`: False- `ignore_data_skip`: False- `fsdp`: []- `fsdp_min_num_params`: 0- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}- `fsdp_transformer_layer_cls_to_wrap`: None- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}- `deepspeed`: None- `label_smoothing_factor`: 0.0- `optim`: adamw_torch- `optim_args`: None- `adafactor`: False- `group_by_length`: False- `length_column_name`: length- `ddp_find_unused_parameters`: None- `ddp_bucket_cap_mb`: None- `ddp_broadcast_buffers`: False- `dataloader_pin_memory`: True- `dataloader_persistent_workers`: False- `skip_memory_metrics`: True- `use_legacy_prediction_loop`: False- `push_to_hub`: False- `resume_from_checkpoint`: None- `hub_model_id`: None- `hub_strategy`: every_save- `hub_private_repo`: None- `hub_always_push`: False- `hub_revision`: None- `gradient_checkpointing`: False- `gradient_checkpointing_kwargs`: None- `include_inputs_for_metrics`: False- `include_for_metrics`: []- `eval_do_concat_batches`: True- `fp16_backend`: auto- `push_to_hub_model_id`: None- `push_to_hub_organization`: None- `mp_parameters`: - `auto_find_batch_size`: False- `full_determinism`: False- `torchdynamo`: None- `ray_scope`: last- `ddp_timeout`: 1800- `torch_compile`: False- `torch_compile_backend`: None- `torch_compile_mode`: None- `include_tokens_per_second`: False- `include_num_input_tokens_seen`: False- `neftune_noise_alpha`: None- `optim_target_modules`: None- `batch_eval_metrics`: False- `eval_on_start`: False- `use_liger_kernel`: False- `liger_kernel_config`: None- `eval_use_gather_object`: False- `average_tokens_across_devices`: False- `prompts`: None- `batch_sampler`: batch_sampler- `multi_dataset_batch_sampler`: round_robin- `router_mapping`: {}- `learning_rate_mapping`: {}
</details>
### Training Logs| Epoch | Step | Training Loss ||:------:|:-----:|:-------------:|| 0.0750 | 500 | 0.2167 || 0.1501 | 1000 | 0.1158 || 0.2251 | 1500 | 0.1081 || 0.3001 | 2000 | 0.1079 || 0.3752 | 2500 | 0.0994 || 0.4502 | 3000 | 0.0941 || 0.5252 | 3500 | 0.0873 || 0.6002 | 4000 | 0.0967 || 0.6753 | 4500 | 0.0863 || 0.7503 | 5000 | 0.0829 || 0.8253 | 5500 | 0.0821 || 0.9004 | 6000 | 0.0821 || 0.9754 | 6500 | 0.0794 || 1.0504 | 7000 | 0.0418 || 1.1255 | 7500 | 0.0237 || 1.2005 | 8000 | 0.0233 || 1.2755 | 8500 | 0.0231 || 1.3505 | 9000 | 0.0248 || 1.4256 | 9500 | 0.0245 || 1.5006 | 10000 | 0.0237 || 1.5756 | 10500 | 0.025 || 1.6507 | 11000 | 0.0232 || 1.7257 | 11500 | 0.0231 || 1.8007 | 12000 | 0.0218 || 1.8758 | 12500 | 0.0233 || 1.9508 | 13000 | 0.0221 || 2.0258 | 13500 | 0.0177 || 2.1008 | 14000 | 0.0072 || 2.1759 | 14500 | 0.0066 || 2.2509 | 15000 | 0.0068 || 2.3259 | 15500 | 0.0069 || 2.4010 | 16000 | 0.0062 || 2.4760 | 16500 | 0.0068 || 2.5510 | 17000 | 0.0064 || 2.6261 | 17500 | 0.0061 || 2.7011 | 18000 | 0.0062 || 2.7761 | 18500 | 0.0058 || 2.8511 | 19000 | 0.0057 || 2.9262 | 19500 | 0.0058 |
### Framework Versions- Python: 3.10.12- Sentence Transformers: 5.0.0- Transformers: 4.53.1- PyTorch: 2.7.0+cu128- Accelerate: 1.7.0- Datasets: 3.6.0- Tokenizers: 0.21.2
## Citation
### BibTeX
#### Sentence Transformers```bibtex@inproceedings{reimers-2019-sentence-bert, title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks", author = "Reimers, Nils and Gurevych, Iryna", booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing", month = "11", year = "2019", publisher = "Association for Computational Linguistics", url = "https://arxiv.org/abs/1908.10084",}```
#### MultipleNegativesRankingLoss```bibtex@misc{henderson2017efficient, title={Efficient Natural Language Response Suggestion for Smart Reply}, author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil}, year={2017}, eprint={1705.00652}, archivePrefix={arXiv}, primaryClass={cs.CL}}```
<!--## Glossary
*Clearly define terms in order to be accessible across audiences.*-->
<!--## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*-->
<!--## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*-->1234567{ "</s>": 50001, "<mask>": 50004, "<pad>": 50003, "<s>": 50000, "<unk>": 50002}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748{ "architectures": [ "ModernBertModel" ], "attention_bias": false, "attention_dropout": 0.0, "attention_probs_dropout_prob": 0.1, "bos_token_id": 50000, "classifier_activation": "gelu", "classifier_bias": false, "classifier_dropout": 0.0, "classifier_pooling": "cls", "cls_token_id": 50281, "decoder_bias": true, "deterministic_flash_attn": false, "embedding_dropout": 0.0, "eos_token_id": 50001, "global_attn_every_n_layers": 3, "global_rope_theta": 160000.0, "hidden_activation": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "initializer_cutoff_factor": 2.0, "initializer_range": 0.02, "intermediate_size": 1152, "local_attention": 128, "local_attention_rope_theta": 10000, "local_attention_window": 128, "local_rope_theta": 10000.0, "max_position_embeddings": 8192, "mlp_bias": false, "mlp_dropout": 0.0, "model_type": "modernbert", "norm_bias": false, "norm_eps": 1e-05, "num_attention_heads": 12, "num_hidden_layers": 22, "pad_token_id": 1, "repad_logits_with_grad": false, "rope_theta": 160000, "sep_token_id": 50282, "sparse_pred_ignore_index": -100, "sparse_prediction": false, "torch_dtype": "float32", "transformers_version": "4.53.1", "type_vocab_size": 2, "vocab_size": 50005}1234567891011121314{ "model_type": "SentenceTransformer", "__version__": { "sentence_transformers": "5.0.0", "transformers": "4.53.1", "pytorch": "2.7.0+cu128" }, "prompts": { "query": "", "document": "" }, "default_prompt_name": null, "similarity_fn_name": "cosine"}123version https://git-lfs.github.com/spec/v1oid sha256:03f7359aa09221cf3a7ec864f0a040aa737d6dd73765eccf3e48df569d5bb99asize 5949550001234567891011121314[ { "idx": 0, "name": "0", "path": "", "type": "sentence_transformers.models.Transformer" }, { "idx": 1, "name": "1", "path": "1_Pooling", "type": "sentence_transformers.models.Pooling" }]1234{ "max_seq_length": 1024, "do_lower_case": false}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051{ "bos_token": { "content": "<s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "cls_token": { "content": "<s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "eos_token": { "content": "</s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "mask_token": { "content": "<mask>", "lstrip": true, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "<pad>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "sep_token": { "content": "</s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "unk_token": { "content": "<unk>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162{ "add_prefix_space": false, "added_tokens_decoder": { "50000": { "content": "<s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": true }, "50001": { "content": "</s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": true }, "50002": { "content": "<unk>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": true }, "50003": { "content": "<pad>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": true }, "50004": { "content": "<mask>", "lstrip": true, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "bos_token": "<s>", "clean_up_tokenization_spaces": false, "cls_token": "<s>", "eos_token": "</s>", "errors": "replace", "extra_special_tokens": {}, "mask_token": "<mask>", "max_length": 256, "model_max_length": 1000000000000000019884624838656, "pad_token": "<pad>", "sep_token": "</s>", "stride": 0, "tokenizer_class": "RobertaTokenizer", "trim_offsets": true, "truncation_side": "right", "truncation_strategy": "longest_first", "unk_token": "<unk>"}1_Pooling/config.jsonAdded+10
README.mdAdded+593
added_tokens.jsonAdded+7
config.jsonAdded+48
config_sentence_transformers.jsonAdded+14
merges.txtAdded
model.safetensorsAdded+3
modules.jsonAdded+14
sentence_bert_config.jsonAdded+4
special_tokens_map.jsonAdded+51
tokenizer.jsonAdded
tokenizer_config.jsonAdded+62
vocab.jsonAdded