Update README.md
Browse files
README.md
CHANGED
@@ -2,551 +2,112 @@
|
|
2 |
tags:
|
3 |
- sentence-transformers
|
4 |
- sentence-similarity
|
5 |
-
-
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
|
|
|
|
|
|
|
|
9 |
base_model: Shuu12121/CodeModernBERT-Owl-1.0
|
10 |
-
widget:
|
11 |
-
- source_sentence: 'Releases any resources allocated by `mountComponent`.
|
12 |
-
|
13 |
-
|
14 |
-
@final
|
15 |
-
|
16 |
-
@internal'
|
17 |
-
sentences:
|
18 |
-
- "private Range<RowKeyWrapper> rowRangeToRange(RowRange btRange) {\n final BoundType\
|
19 |
-
\ startBound;\n final ByteString startKey;\n\n switch (btRange.getStartKeyCase())\
|
20 |
-
\ {\n case START_KEY_OPEN:\n startBound = BoundType.OPEN;\n \
|
21 |
-
\ startKey = btRange.getStartKeyOpen();\n break;\n case START_KEY_CLOSED:\n\
|
22 |
-
\ startBound = BoundType.CLOSED;\n startKey = btRange.getStartKeyClosed();\n\
|
23 |
-
\ break;\n case STARTKEY_NOT_SET:\n startBound = BoundType.CLOSED;\n\
|
24 |
-
\ startKey = ByteString.EMPTY;\n break;\n default:\n \
|
25 |
-
\ throw new IllegalArgumentException(\"Unexpected start key case: \" +\n \
|
26 |
-
\ btRange.getStartKeyCase());\n }\n\n final BoundType endBound;\n\
|
27 |
-
\ final ByteString endKey;\n switch (btRange.getEndKeyCase()) {\n case\
|
28 |
-
\ END_KEY_OPEN:\n endBound = BoundType.OPEN;\n endKey = btRange.getEndKeyOpen();\n\
|
29 |
-
\ break;\n case END_KEY_CLOSED:\n endBound = BoundType.CLOSED;\n\
|
30 |
-
\ endKey = btRange.getEndKeyClosed();\n break;\n case ENDKEY_NOT_SET:\n\
|
31 |
-
\ endBound = BoundType.OPEN;\n endKey = ByteString.EMPTY;\n \
|
32 |
-
\ break;\n default:\n throw new IllegalArgumentException(\"Unexpected\
|
33 |
-
\ end key case: \" + btRange.getEndKeyCase());\n }\n\n return boundedRange(startBound,\
|
34 |
-
\ startKey, endBound, endKey);\n }"
|
35 |
-
- "public static FacesMessage getMessage(FacesMessage.Severity severity,\n \
|
36 |
-
\ String messageId,\n \
|
37 |
-
\ Object arg)\n {\n return getMessage(severity,\n\
|
38 |
-
\ messageId,\n new Object[]{arg},\n\
|
39 |
-
\ FacesContext.getCurrentInstance());\n }"
|
40 |
-
- "function() {\n var inst = this._instance;\n\n if (inst.componentWillUnmount)\
|
41 |
-
\ {\n var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;\n\
|
42 |
-
\ ReactLifeCycle.currentlyUnmountingInstance = this;\n try {\n \
|
43 |
-
\ inst.componentWillUnmount();\n } finally {\n ReactLifeCycle.currentlyUnmountingInstance\
|
44 |
-
\ = previouslyUnmounting;\n }\n }\n\n ReactReconciler.unmountComponent(this._renderedComponent);\n\
|
45 |
-
\ this._renderedComponent = null;\n\n // Reset pending fields\n this._pendingStateQueue\
|
46 |
-
\ = null;\n this._pendingReplaceState = false;\n this._pendingForceUpdate\
|
47 |
-
\ = false;\n this._pendingCallbacks = null;\n this._pendingElement = null;\n\
|
48 |
-
\n // These fields do not really need to be reset since this object is no\n\
|
49 |
-
\ // longer accessible.\n this._context = null;\n this._rootNodeID =\
|
50 |
-
\ null;\n\n // Delete the reference from the instance to this internal representation\n\
|
51 |
-
\ // which allow the internals to be properly cleaned up even if the user\n\
|
52 |
-
\ // leaks a reference to the public instance.\n ReactInstanceMap.remove(inst);\n\
|
53 |
-
\n // Some existing components rely on inst.props even after they've been\n\
|
54 |
-
\ // destroyed (in event handlers).\n // TODO: inst.props = null;\n //\
|
55 |
-
\ TODO: inst.state = null;\n // TODO: inst.context = null;\n }"
|
56 |
-
- source_sentence: '// NewRandomForest generates and return a new random forests
|
57 |
-
|
58 |
-
// forestSize controls the number of trees that get built
|
59 |
-
|
60 |
-
// features controls the number of features used to build each tree.'
|
61 |
-
sentences:
|
62 |
-
- "function initShaders() {\n var fragmentShader = getShader(gl, fragmentShaderSource,\
|
63 |
-
\ false);\n var vertexShader = getShader(gl, vertexShaderSource, true);\n\n \
|
64 |
-
\ // Create the shader program\n\n shaderProgram = gl.createProgram();\n gl.attachShader(shaderProgram,\
|
65 |
-
\ vertexShader);\n gl.attachShader(shaderProgram, fragmentShader);\n gl.linkProgram(shaderProgram);\n\
|
66 |
-
\n // If creating the shader program failed, alert\n\n if (!gl.getProgramParameter(shaderProgram,\
|
67 |
-
\ gl.LINK_STATUS)) {\n alert(\"Unable to initialize the shader program: \"\
|
68 |
-
\ + gl.getProgramInfoLog(shader));\n }\n\n gl.useProgram(shaderProgram);\n\n\
|
69 |
-
\ vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\"\
|
70 |
-
);\n gl.enableVertexAttribArray(vertexPositionAttribute);\n}"
|
71 |
-
- "func (s *UpdateStackInput) SetConfigurationManager(v *StackConfigurationManager)\
|
72 |
-
\ *UpdateStackInput {\n\ts.ConfigurationManager = v\n\treturn s\n}"
|
73 |
-
- "func NewRandomForest(forestSize int, features int) *RandomForest {\n\tret :=\
|
74 |
-
\ &RandomForest{\n\t\tbase.BaseClassifier{},\n\t\tforestSize,\n\t\tfeatures,\n\
|
75 |
-
\t\tnil,\n\t}\n\treturn ret\n}"
|
76 |
-
- source_sentence: // defaultQueueURL is a method returns the default queue url
|
77 |
-
sentences:
|
78 |
-
- "public static int parseUnsignedInt(String s, int radix)\n throws\
|
79 |
-
\ NumberFormatException {\n if (s == null) {\n throw new NumberFormatException(\"\
|
80 |
-
null\");\n }\n\n int len = s.length();\n if (len > 0) {\n\
|
81 |
-
\ char firstChar = s.charAt(0);\n if (firstChar == '-')\
|
82 |
-
\ {\n throw new\n NumberFormatException(String.format(\"\
|
83 |
-
Illegal leading minus sign \" +\n \
|
84 |
-
\ \"on unsigned string %s.\", s));\n } else {\n \
|
85 |
-
\ if (len <= 5 || // Integer.MAX_VALUE in Character.MAX_RADIX is 6 digits\n\
|
86 |
-
\ (radix == 10 && len <= 9) ) { // Integer.MAX_VALUE in base\
|
87 |
-
\ 10 is 10 digits\n return parseInt(s, radix);\n \
|
88 |
-
\ } else {\n long ell = Long.parseLong(s, radix);\n \
|
89 |
-
\ if ((ell & 0xffff_ffff_0000_0000L) == 0) {\n \
|
90 |
-
\ return (int) ell;\n } else {\n \
|
91 |
-
\ throw new\n NumberFormatException(String.format(\"\
|
92 |
-
String value %s exceeds \" +\n \
|
93 |
-
\ \"range of unsigned int.\", s));\n }\n \
|
94 |
-
\ }\n }\n } else {\n throw NumberFormatException.forInputString(s);\n\
|
95 |
-
\ }\n }"
|
96 |
-
- "func (f *Filter) shouldNamePass(key string) bool {\n\tpass := func(f *Filter)\
|
97 |
-
\ bool {\n\t\tif f.namePass.Match(key) {\n\t\t\treturn true\n\t\t}\n\t\treturn\
|
98 |
-
\ false\n\t}\n\n\tdrop := func(f *Filter) bool {\n\t\tif f.nameDrop.Match(key)\
|
99 |
-
\ {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tif f.namePass != nil\
|
100 |
-
\ && f.nameDrop != nil {\n\t\treturn pass(f) && drop(f)\n\t} else if f.namePass\
|
101 |
-
\ != nil {\n\t\treturn pass(f)\n\t} else if f.nameDrop != nil {\n\t\treturn drop(f)\n\
|
102 |
-
\t}\n\n\treturn true\n}"
|
103 |
-
- "func (b *Broker) defaultQueueURL() *string {\n\tif b.queueUrl != nil {\n\t\t\
|
104 |
-
return b.queueUrl\n\t} else {\n\t\treturn aws.String(b.GetConfig().Broker + \"\
|
105 |
-
/\" + b.GetConfig().DefaultQueue)\n\t}\n\n}"
|
106 |
-
- source_sentence: Check if the input `node` is a binding identifier.
|
107 |
-
sentences:
|
108 |
-
- "function isBinding(node, parent) {\n var keys = _retrievers.getBindingIdentifiers.keys[parent.type];\n\
|
109 |
-
\ if (keys) {\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\
|
110 |
-
\ var val = parent[key];\n if (Array.isArray(val)) {\n if (val.indexOf(node)\
|
111 |
-
\ >= 0) return true;\n } else {\n if (val === node) return true;\n\
|
112 |
-
\ }\n }\n }\n\n return false;\n}"
|
113 |
-
- "public Type build(Type givenType){\n final ClassType javersType = mapper.getJaversClassType(givenType);\n\
|
114 |
-
\n //for Generics, we have list of type arguments to dehydrate\n \
|
115 |
-
\ if (javersType.isGenericType()) {\n List<Type> actualDehydratedTypeArguments\
|
116 |
-
\ = extractAndDehydrateTypeArguments(javersType);\n return new ParametrizedDehydratedType(javersType.getBaseJavaClass(),\
|
117 |
-
\ actualDehydratedTypeArguments);\n }\n\n if (javersType instanceof\
|
118 |
-
\ ArrayType){\n Type dehydratedItemType = build( javersType.getConcreteClassTypeArguments().get(0)\
|
119 |
-
\ );\n if (dehydratedItemType == GlobalId.class){\n \
|
120 |
-
\ return GLOBAL_ID_ARRAY_TYPE;\n }\n return givenType;\n\
|
121 |
-
\ }\n\n return javersType.getRawDehydratedType();\n }"
|
122 |
-
- "public function getMemoryUsage()\n {\n $size = memory_get_usage(true);\n\
|
123 |
-
\ $unit = array('b','kb','mb','gb','tb','pb');\n \n \
|
124 |
-
\ return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];\n\
|
125 |
-
\ }"
|
126 |
-
- source_sentence: // SetGameSessionQueueArns sets the GameSessionQueueArns field's
|
127 |
-
value.
|
128 |
-
sentences:
|
129 |
-
- "func (s *MatchmakingConfiguration) SetGameSessionQueueArns(v []*string) *MatchmakingConfiguration\
|
130 |
-
\ {\n\ts.GameSessionQueueArns = v\n\treturn s\n}"
|
131 |
-
- "protected function getRelationXmlHashFromDB(array $destinationContentIds)\n \
|
132 |
-
\ {\n if (empty($destinationContentIds)) {\n return array();\n\
|
133 |
-
\ }\n\n $q = $this->db->createSelectQuery();\n $q\n \
|
134 |
-
\ ->select(\n $this->db->aliasedColumn($q, 'id', 'ezcontentobject'),\n\
|
135 |
-
\ $this->db->aliasedColumn($q, 'remote_id', 'ezcontentobject'),\n\
|
136 |
-
\ $this->db->aliasedColumn($q, 'current_version', 'ezcontentobject'),\n\
|
137 |
-
\ $this->db->aliasedColumn($q, 'contentclass_id', 'ezcontentobject'),\n\
|
138 |
-
\ $this->db->aliasedColumn($q, 'node_id', 'ezcontentobject_tree'),\n\
|
139 |
-
\ $this->db->aliasedColumn($q, 'parent_node_id', 'ezcontentobject_tree'),\n\
|
140 |
-
\ $this->db->aliasedColumn($q, 'identifier', 'ezcontentclass')\n\
|
141 |
-
\ )\n ->from($this->db->quoteTable('ezcontentobject'))\n\
|
142 |
-
\ ->leftJoin(\n $this->db->quoteTable('ezcontentobject_tree'),\n\
|
143 |
-
\ $q->expr->lAnd(\n $q->expr->eq(\n \
|
144 |
-
\ $this->db->quoteColumn('contentobject_id', 'ezcontentobject_tree'),\n\
|
145 |
-
\ $this->db->quoteColumn('id', 'ezcontentobject')\n \
|
146 |
-
\ ),\n $q->expr->eq(\n \
|
147 |
-
\ $this->db->quoteColumn('node_id', 'ezcontentobject_tree'),\n \
|
148 |
-
\ $this->db->quoteColumn('main_node_id', 'ezcontentobject_tree')\n\
|
149 |
-
\ )\n )\n )\n ->leftJoin(\n\
|
150 |
-
\ $this->db->quoteTable('ezcontentclass'),\n $q->expr->lAnd(\n\
|
151 |
-
\ $q->expr->eq(\n $this->db->quoteColumn('id',\
|
152 |
-
\ 'ezcontentclass'),\n $this->db->quoteColumn('contentclass_id',\
|
153 |
-
\ 'ezcontentobject')\n ),\n $q->expr->eq(\n\
|
154 |
-
\ $this->db->quoteColumn('version', 'ezcontentclass'),\n\
|
155 |
-
\ $q->bindValue(ContentType::STATUS_DEFINED, null, PDO::PARAM_INT)\n\
|
156 |
-
\ )\n )\n )\n ->where(\n\
|
157 |
-
\ $q->expr->in(\n $this->db->quoteColumn('id',\
|
158 |
-
\ 'ezcontentobject'),\n $destinationContentIds\n \
|
159 |
-
\ )\n );\n $stmt = $q->prepare();\n $stmt->execute();\n\
|
160 |
-
\n return $stmt->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);\n }"
|
161 |
-
- "protected function _beforeDispatch(DispatcherContext $context)\n {\n \
|
162 |
-
\ // Check if the user has been explicitly authenticated for this request\n\
|
163 |
-
\ if (!$this->getUser()->isAuthentic(true))\n {\n foreach($this->__authenticator_queue\
|
164 |
-
\ as $authenticator)\n {\n if($authenticator->authenticateRequest($context)\
|
165 |
-
\ === true) {\n break;\n }\n }\n\
|
166 |
-
\ }\n\n }"
|
167 |
pipeline_tag: sentence-similarity
|
168 |
library_name: sentence-transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
---
|
170 |
|
171 |
-
#
|
172 |
-
|
173 |
-
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Shuu12121/CodeModernBERT-Owl-1.0](https://huggingface.co/Shuu12121/CodeModernBERT-Owl-1.0). 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.
|
174 |
-
|
175 |
-
## Model Details
|
176 |
-
|
177 |
-
### Model Description
|
178 |
-
- **Model Type:** Sentence Transformer
|
179 |
-
- **Base model:** [Shuu12121/CodeModernBERT-Owl-1.0](https://huggingface.co/Shuu12121/CodeModernBERT-Owl-1.0) <!-- at revision e76a6056791a4f60962d3f2ce4cc7d94bd719485 -->
|
180 |
-
- **Maximum Sequence Length:** 1024 tokens
|
181 |
-
- **Output Dimensionality:** 768 dimensions
|
182 |
-
- **Similarity Function:** Cosine Similarity
|
183 |
-
<!-- - **Training Dataset:** Unknown -->
|
184 |
-
<!-- - **Language:** Unknown -->
|
185 |
-
<!-- - **License:** Unknown -->
|
186 |
-
|
187 |
-
### Model Sources
|
188 |
-
|
189 |
-
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
190 |
-
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
191 |
-
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
192 |
-
|
193 |
-
### Full Model Architecture
|
194 |
-
|
195 |
-
```
|
196 |
-
SentenceTransformer(
|
197 |
-
(0): Transformer({'max_seq_length': 1024, 'do_lower_case': False}) with Transformer model: ModernBertModel
|
198 |
-
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
199 |
-
)
|
200 |
-
```
|
201 |
-
|
202 |
-
## Usage
|
203 |
-
|
204 |
-
### Direct Usage (Sentence Transformers)
|
205 |
-
|
206 |
-
First install the Sentence Transformers library:
|
207 |
-
|
208 |
-
```bash
|
209 |
-
pip install -U sentence-transformers
|
210 |
-
```
|
211 |
-
|
212 |
-
Then you can load this model and run inference.
|
213 |
-
```python
|
214 |
-
from sentence_transformers import SentenceTransformer
|
215 |
-
|
216 |
-
# Download from the π€ Hub
|
217 |
-
model = SentenceTransformer("sentence_transformers_model_id")
|
218 |
-
# Run inference
|
219 |
-
sentences = [
|
220 |
-
"// SetGameSessionQueueArns sets the GameSessionQueueArns field's value.",
|
221 |
-
'func (s *MatchmakingConfiguration) SetGameSessionQueueArns(v []*string) *MatchmakingConfiguration {\n\ts.GameSessionQueueArns = v\n\treturn s\n}',
|
222 |
-
'protected function _beforeDispatch(DispatcherContext $context)\n {\n // Check if the user has been explicitly authenticated for this request\n if (!$this->getUser()->isAuthentic(true))\n {\n foreach($this->__authenticator_queue as $authenticator)\n {\n if($authenticator->authenticateRequest($context) === true) {\n break;\n }\n }\n }\n\n }',
|
223 |
-
]
|
224 |
-
embeddings = model.encode(sentences)
|
225 |
-
print(embeddings.shape)
|
226 |
-
# [3, 768]
|
227 |
-
|
228 |
-
# Get the similarity scores for the embeddings
|
229 |
-
similarities = model.similarity(embeddings, embeddings)
|
230 |
-
print(similarities.shape)
|
231 |
-
# [3, 3]
|
232 |
-
```
|
233 |
-
|
234 |
-
<!--
|
235 |
-
### Direct Usage (Transformers)
|
236 |
-
|
237 |
-
<details><summary>Click to see the direct usage in Transformers</summary>
|
238 |
|
239 |
-
|
240 |
-
-->
|
241 |
|
242 |
-
|
243 |
-
### Downstream Usage (Sentence Transformers)
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
<details><summary>Click to expand</summary>
|
248 |
-
|
249 |
-
</details>
|
250 |
-
-->
|
251 |
-
|
252 |
-
<!--
|
253 |
-
### Out-of-Scope Use
|
254 |
-
|
255 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
256 |
-
-->
|
257 |
|
258 |
-
|
259 |
-
## Bias, Risks and Limitations
|
260 |
|
261 |
-
*
|
262 |
-
|
|
|
|
|
|
|
263 |
|
264 |
-
|
265 |
-
### Recommendations
|
266 |
|
267 |
-
|
268 |
-
-->
|
269 |
|
270 |
-
##
|
271 |
|
272 |
-
|
273 |
|
274 |
-
|
|
|
275 |
|
276 |
-
|
277 |
-
* Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
|
278 |
-
* Approximate statistics based on the first 1000 samples:
|
279 |
-
| | sentence_0 | sentence_1 | label |
|
280 |
-
|:--------|:------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:--------------------------------------------------------------|
|
281 |
-
| type | string | string | float |
|
282 |
-
| details | <ul><li>min: 3 tokens</li><li>mean: 48.85 tokens</li><li>max: 1024 tokens</li></ul> | <ul><li>min: 30 tokens</li><li>mean: 171.5 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> |
|
283 |
-
* Samples:
|
284 |
-
| sentence_0 | sentence_1 | label |
|
285 |
-
|:--------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
|
286 |
-
| <code>// convDataValidationOperatior get excel data validation operator.</code> | <code>func convDataValidationOperatior(o DataValidationOperator) string {<br> typeMap := map[DataValidationOperator]string{<br> DataValidationOperatorBetween: "between",<br> DataValidationOperatorEqual: "equal",<br> DataValidationOperatorGreaterThan: "greaterThan",<br> DataValidationOperatorGreaterThanOrEqual: "greaterThanOrEqual",<br> DataValidationOperatorLessThan: "lessThan",<br> DataValidationOperatorLessThanOrEqual: "lessThanOrEqual",<br> DataValidationOperatorNotBetween: "notBetween",<br> DataValidationOperatorNotEqual: "notEqual",<br> }<br><br> return typeMap[o]<br><br>}</code> | <code>1.0</code> |
|
287 |
-
| <code>// Convert_v1_PodSecurityPolicyReview_To_security_PodSecurityPolicyReview is an autogenerated conversion function.</code> | <code>func Convert_v1_PodSecurityPolicyReview_To_security_PodSecurityPolicyReview(in *v1.PodSecurityPolicyReview, out *security.PodSecurityPolicyReview, s conversion.Scope) error {<br> return autoConvert_v1_PodSecurityPolicyReview_To_security_PodSecurityPolicyReview(in, out, s)<br>}</code> | <code>1.0</code> |
|
288 |
-
| <code>// Of note, removeSegments() keeps the ordering of the results stable.</code> | <code>func removeSegments(segments []Segment, toRemove []Segment) []Segment {<br> rv := make([]Segment, 0, len(segments)-len(toRemove))<br>OUTER:<br> for _, segment := range segments {<br> for _, r := range toRemove {<br> if segment == r {<br> continue OUTER<br> }<br> }<br> rv = append(rv, segment)<br> }<br> return rv<br>}</code> | <code>1.0</code> |
|
289 |
-
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
|
290 |
-
```json
|
291 |
-
{
|
292 |
-
"scale": 20.0,
|
293 |
-
"similarity_fct": "cos_sim"
|
294 |
-
}
|
295 |
-
```
|
296 |
|
297 |
-
###
|
298 |
-
#### Non-Default Hyperparameters
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
|
|
305 |
|
306 |
-
|
307 |
-
<details><summary>Click to expand</summary>
|
308 |
|
309 |
-
|
310 |
-
- `do_predict`: False
|
311 |
-
- `eval_strategy`: no
|
312 |
-
- `prediction_loss_only`: True
|
313 |
-
- `per_device_train_batch_size`: 256
|
314 |
-
- `per_device_eval_batch_size`: 256
|
315 |
-
- `per_gpu_train_batch_size`: None
|
316 |
-
- `per_gpu_eval_batch_size`: None
|
317 |
-
- `gradient_accumulation_steps`: 1
|
318 |
-
- `eval_accumulation_steps`: None
|
319 |
-
- `torch_empty_cache_steps`: None
|
320 |
-
- `learning_rate`: 5e-05
|
321 |
-
- `weight_decay`: 0.0
|
322 |
-
- `adam_beta1`: 0.9
|
323 |
-
- `adam_beta2`: 0.999
|
324 |
-
- `adam_epsilon`: 1e-08
|
325 |
-
- `max_grad_norm`: 1
|
326 |
-
- `num_train_epochs`: 5
|
327 |
-
- `max_steps`: -1
|
328 |
-
- `lr_scheduler_type`: linear
|
329 |
-
- `lr_scheduler_kwargs`: {}
|
330 |
-
- `warmup_ratio`: 0.0
|
331 |
-
- `warmup_steps`: 0
|
332 |
-
- `log_level`: passive
|
333 |
-
- `log_level_replica`: warning
|
334 |
-
- `log_on_each_node`: True
|
335 |
-
- `logging_nan_inf_filter`: True
|
336 |
-
- `save_safetensors`: True
|
337 |
-
- `save_on_each_node`: False
|
338 |
-
- `save_only_model`: False
|
339 |
-
- `restore_callback_states_from_checkpoint`: False
|
340 |
-
- `no_cuda`: False
|
341 |
-
- `use_cpu`: False
|
342 |
-
- `use_mps_device`: False
|
343 |
-
- `seed`: 42
|
344 |
-
- `data_seed`: None
|
345 |
-
- `jit_mode_eval`: False
|
346 |
-
- `use_ipex`: False
|
347 |
-
- `bf16`: False
|
348 |
-
- `fp16`: True
|
349 |
-
- `fp16_opt_level`: O1
|
350 |
-
- `half_precision_backend`: auto
|
351 |
-
- `bf16_full_eval`: False
|
352 |
-
- `fp16_full_eval`: False
|
353 |
-
- `tf32`: None
|
354 |
-
- `local_rank`: 0
|
355 |
-
- `ddp_backend`: None
|
356 |
-
- `tpu_num_cores`: None
|
357 |
-
- `tpu_metrics_debug`: False
|
358 |
-
- `debug`: []
|
359 |
-
- `dataloader_drop_last`: False
|
360 |
-
- `dataloader_num_workers`: 0
|
361 |
-
- `dataloader_prefetch_factor`: None
|
362 |
-
- `past_index`: -1
|
363 |
-
- `disable_tqdm`: False
|
364 |
-
- `remove_unused_columns`: True
|
365 |
-
- `label_names`: None
|
366 |
-
- `load_best_model_at_end`: False
|
367 |
-
- `ignore_data_skip`: False
|
368 |
-
- `fsdp`: []
|
369 |
-
- `fsdp_min_num_params`: 0
|
370 |
-
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
371 |
-
- `tp_size`: 0
|
372 |
-
- `fsdp_transformer_layer_cls_to_wrap`: None
|
373 |
-
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
374 |
-
- `deepspeed`: None
|
375 |
-
- `label_smoothing_factor`: 0.0
|
376 |
-
- `optim`: adamw_torch
|
377 |
-
- `optim_args`: None
|
378 |
-
- `adafactor`: False
|
379 |
-
- `group_by_length`: False
|
380 |
-
- `length_column_name`: length
|
381 |
-
- `ddp_find_unused_parameters`: None
|
382 |
-
- `ddp_bucket_cap_mb`: None
|
383 |
-
- `ddp_broadcast_buffers`: False
|
384 |
-
- `dataloader_pin_memory`: True
|
385 |
-
- `dataloader_persistent_workers`: False
|
386 |
-
- `skip_memory_metrics`: True
|
387 |
-
- `use_legacy_prediction_loop`: False
|
388 |
-
- `push_to_hub`: False
|
389 |
-
- `resume_from_checkpoint`: None
|
390 |
-
- `hub_model_id`: None
|
391 |
-
- `hub_strategy`: every_save
|
392 |
-
- `hub_private_repo`: None
|
393 |
-
- `hub_always_push`: False
|
394 |
-
- `gradient_checkpointing`: False
|
395 |
-
- `gradient_checkpointing_kwargs`: None
|
396 |
-
- `include_inputs_for_metrics`: False
|
397 |
-
- `include_for_metrics`: []
|
398 |
-
- `eval_do_concat_batches`: True
|
399 |
-
- `fp16_backend`: auto
|
400 |
-
- `push_to_hub_model_id`: None
|
401 |
-
- `push_to_hub_organization`: None
|
402 |
-
- `mp_parameters`:
|
403 |
-
- `auto_find_batch_size`: False
|
404 |
-
- `full_determinism`: False
|
405 |
-
- `torchdynamo`: None
|
406 |
-
- `ray_scope`: last
|
407 |
-
- `ddp_timeout`: 1800
|
408 |
-
- `torch_compile`: False
|
409 |
-
- `torch_compile_backend`: None
|
410 |
-
- `torch_compile_mode`: None
|
411 |
-
- `include_tokens_per_second`: False
|
412 |
-
- `include_num_input_tokens_seen`: False
|
413 |
-
- `neftune_noise_alpha`: None
|
414 |
-
- `optim_target_modules`: None
|
415 |
-
- `batch_eval_metrics`: False
|
416 |
-
- `eval_on_start`: False
|
417 |
-
- `use_liger_kernel`: False
|
418 |
-
- `eval_use_gather_object`: False
|
419 |
-
- `average_tokens_across_devices`: False
|
420 |
-
- `prompts`: None
|
421 |
-
- `batch_sampler`: batch_sampler
|
422 |
-
- `multi_dataset_batch_sampler`: round_robin
|
423 |
|
424 |
-
|
425 |
|
426 |
-
|
427 |
-
|
|
428 |
-
|
429 |
-
|
|
430 |
-
|
|
431 |
-
|
|
432 |
-
|
|
433 |
-
| 0.3686 | 2500 | 0.0968 |
|
434 |
-
| 0.4423 | 3000 | 0.0954 |
|
435 |
-
| 0.5161 | 3500 | 0.0894 |
|
436 |
-
| 0.5898 | 4000 | 0.0913 |
|
437 |
-
| 0.6635 | 4500 | 0.0894 |
|
438 |
-
| 0.7372 | 5000 | 0.0858 |
|
439 |
-
| 0.8110 | 5500 | 0.0878 |
|
440 |
-
| 0.8847 | 6000 | 0.0839 |
|
441 |
-
| 0.9584 | 6500 | 0.0813 |
|
442 |
-
| 1.0321 | 7000 | 0.0607 |
|
443 |
-
| 1.1059 | 7500 | 0.0293 |
|
444 |
-
| 1.1796 | 8000 | 0.0301 |
|
445 |
-
| 1.2533 | 8500 | 0.03 |
|
446 |
-
| 1.3270 | 9000 | 0.0332 |
|
447 |
-
| 1.4008 | 9500 | 0.032 |
|
448 |
-
| 1.4745 | 10000 | 0.0339 |
|
449 |
-
| 1.5482 | 10500 | 0.0317 |
|
450 |
-
| 1.6219 | 11000 | 0.0336 |
|
451 |
-
| 1.6957 | 11500 | 0.0334 |
|
452 |
-
| 1.7694 | 12000 | 0.0341 |
|
453 |
-
| 1.8431 | 12500 | 0.0335 |
|
454 |
-
| 1.9168 | 13000 | 0.0341 |
|
455 |
-
| 1.9906 | 13500 | 0.0335 |
|
456 |
-
| 2.0643 | 14000 | 0.0137 |
|
457 |
-
| 2.1380 | 14500 | 0.0107 |
|
458 |
-
| 2.2117 | 15000 | 0.0106 |
|
459 |
-
| 2.2855 | 15500 | 0.0108 |
|
460 |
-
| 2.3592 | 16000 | 0.0111 |
|
461 |
-
| 2.4329 | 16500 | 0.0113 |
|
462 |
-
| 2.5066 | 17000 | 0.011 |
|
463 |
-
| 2.5804 | 17500 | 0.0114 |
|
464 |
-
| 2.6541 | 18000 | 0.0115 |
|
465 |
-
| 2.7278 | 18500 | 0.0117 |
|
466 |
-
| 2.8015 | 19000 | 0.0115 |
|
467 |
-
| 2.8753 | 19500 | 0.0116 |
|
468 |
-
| 2.9490 | 20000 | 0.0116 |
|
469 |
-
| 3.0227 | 20500 | 0.0102 |
|
470 |
-
| 3.0964 | 21000 | 0.0062 |
|
471 |
-
| 3.1702 | 21500 | 0.0064 |
|
472 |
-
| 3.2439 | 22000 | 0.0065 |
|
473 |
-
| 3.3176 | 22500 | 0.0067 |
|
474 |
-
| 3.3913 | 23000 | 0.0064 |
|
475 |
-
| 3.4651 | 23500 | 0.0062 |
|
476 |
-
| 3.5388 | 24000 | 0.0063 |
|
477 |
-
| 3.6125 | 24500 | 0.0062 |
|
478 |
-
| 3.6862 | 25000 | 0.0063 |
|
479 |
-
| 3.7600 | 25500 | 0.0063 |
|
480 |
-
| 3.8337 | 26000 | 0.0063 |
|
481 |
-
| 3.9074 | 26500 | 0.006 |
|
482 |
-
| 3.9811 | 27000 | 0.0061 |
|
483 |
-
| 4.0549 | 27500 | 0.0048 |
|
484 |
-
| 4.1286 | 28000 | 0.0043 |
|
485 |
-
| 4.2023 | 28500 | 0.0044 |
|
486 |
-
| 4.2760 | 29000 | 0.0043 |
|
487 |
-
| 4.3497 | 29500 | 0.0043 |
|
488 |
-
| 4.4235 | 30000 | 0.0044 |
|
489 |
-
| 4.4972 | 30500 | 0.0043 |
|
490 |
-
| 4.5709 | 31000 | 0.004 |
|
491 |
-
| 4.6446 | 31500 | 0.0043 |
|
492 |
-
| 4.7184 | 32000 | 0.0042 |
|
493 |
-
| 4.7921 | 32500 | 0.0043 |
|
494 |
-
| 4.8658 | 33000 | 0.0043 |
|
495 |
-
| 4.9395 | 33500 | 0.004 |
|
496 |
|
|
|
497 |
|
498 |
-
|
499 |
-
- Python: 3.11.12
|
500 |
-
- Sentence Transformers: 3.4.1
|
501 |
-
- Transformers: 4.51.3
|
502 |
-
- PyTorch: 2.6.0+cu124
|
503 |
-
- Accelerate: 1.6.0
|
504 |
-
- Datasets: 3.5.1
|
505 |
-
- Tokenizers: 0.21.1
|
506 |
|
507 |
-
|
508 |
|
509 |
-
|
|
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
@inproceedings{reimers-2019-sentence-bert,
|
514 |
-
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
515 |
-
author = "Reimers, Nils and Gurevych, Iryna",
|
516 |
-
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
517 |
-
month = "11",
|
518 |
-
year = "2019",
|
519 |
-
publisher = "Association for Computational Linguistics",
|
520 |
-
url = "https://arxiv.org/abs/1908.10084",
|
521 |
-
}
|
522 |
```
|
523 |
|
524 |
-
|
525 |
-
```bibtex
|
526 |
-
@misc{henderson2017efficient,
|
527 |
-
title={Efficient Natural Language Response Suggestion for Smart Reply},
|
528 |
-
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},
|
529 |
-
year={2017},
|
530 |
-
eprint={1705.00652},
|
531 |
-
archivePrefix={arXiv},
|
532 |
-
primaryClass={cs.CL}
|
533 |
-
}
|
534 |
-
```
|
535 |
|
536 |
-
|
537 |
-
## Glossary
|
538 |
|
539 |
-
*
|
540 |
-
|
|
|
|
|
|
|
541 |
|
542 |
-
|
543 |
-
## Model Card Authors
|
544 |
|
545 |
-
|
546 |
-
-->
|
547 |
|
548 |
-
|
549 |
-
## Model Card Contact
|
550 |
|
551 |
-
|
552 |
-
|
|
|
2 |
tags:
|
3 |
- sentence-transformers
|
4 |
- sentence-similarity
|
5 |
+
- code
|
6 |
+
- python
|
7 |
+
- php
|
8 |
+
- javascript
|
9 |
+
- ruby
|
10 |
+
- rust
|
11 |
+
- go
|
12 |
+
- java
|
13 |
base_model: Shuu12121/CodeModernBERT-Owl-1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
pipeline_tag: sentence-similarity
|
15 |
library_name: sentence-transformers
|
16 |
+
license: apache-2.0
|
17 |
+
language:
|
18 |
+
- en
|
19 |
+
datasets:
|
20 |
+
- Shuu12121/python-codesearch-filtered
|
21 |
+
- Shuu12121/java-codesearch-filtered
|
22 |
+
- Shuu12121/javascript-codesearch-filtered
|
23 |
+
- Shuu12121/go-codesearch-filtered
|
24 |
+
- Shuu12121/php-codesearch-filtered
|
25 |
+
- Shuu12121/ruby-codesearch-filtered
|
26 |
+
- Shuu12121/rust-codesearch-filtered
|
27 |
+
- code-search-net/code_search_net
|
28 |
---
|
29 |
|
30 |
+
# **π¦ CodeSearch-ModernBERT-Owl-Plus: High-Performance Sentence-BERT for Code Search**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
**CodeSearch-ModernBERT-Owl-Plus** is a high-performance code search model fine-tuned in a Sentence-BERT architecture, based on the pretrained **CodeModernBERT-Owl v1.0**.
|
|
|
33 |
|
34 |
+
This model is optimized for function-level search within codebases and natural language queries, achieving state-of-the-art results on the MTEB benchmark.
|
|
|
35 |
|
36 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
# **π Features**
|
|
|
39 |
|
40 |
+
* β
Fine-tuned in Sentence-BERT format from CodeModernBERT-Owl
|
41 |
+
* β
Supports multiple languages (Python, Java, JavaScript, etc.)
|
42 |
+
* β
Specialized encoder for high-accuracy code search
|
43 |
+
* β
Ideal for multi-stage (dual encoder) retrieval setups
|
44 |
+
* β
Generates rich semantic embeddings for code and queries
|
45 |
|
46 |
+
---
|
|
|
47 |
|
48 |
+
# **π Evaluation on MTEB Benchmark**
|
|
|
49 |
|
50 |
+
## **π Main Scores in MTEB**
|
51 |
|
52 |
+
This model achieved the following **main scores** (based on NDCG\@10):
|
53 |
|
54 |
+
* **CodeSearchNetRetrieval**: `main_score = 0.8918`
|
55 |
+
* **COIR-CodeSearchNetRetrieval**: `main_score = 0.8013`
|
56 |
|
57 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
### π§ͺ **CodeSearchNetRetrieval (MTEB)**
|
|
|
60 |
|
61 |
+
| Metric | Score |
|
62 |
+
| ------------- | ---------- |
|
63 |
+
| **MRR\@10** | **0.8704** |
|
64 |
+
| **NDCG\@10** | 0.8918 |
|
65 |
+
| MAP\@10 | 0.8704 |
|
66 |
+
| Recall\@10 | 0.9563 |
|
67 |
+
| Precision\@10 | 0.0956 |
|
68 |
|
69 |
+
This model achieves strong performance across all ranking metrics and demonstrates balanced retrieval capability.
|
|
|
70 |
|
71 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
### π§ͺ **COIR-CodeSearchNetRetrieval (MTEB)**
|
74 |
|
75 |
+
| Metric | Score |
|
76 |
+
| ------------- | ---------- |
|
77 |
+
| **MRR\@10** | **0.7751** |
|
78 |
+
| **NDCG\@10** | 0.8013 |
|
79 |
+
| MAP\@10 | 0.7751 |
|
80 |
+
| Recall\@10 | 0.8826 |
|
81 |
+
| Precision\@10 | 0.0883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
Robust and consistent performance is also maintained on the COIR dataset, demonstrating strong generalization.
|
84 |
|
85 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
# **π₯ Usage Example**
|
88 |
|
89 |
+
```python
|
90 |
+
from sentence_transformers import SentenceTransformer
|
91 |
|
92 |
+
model = SentenceTransformer("Shuu12121/CodeSearch-ModernBERT-Owl-Plus")
|
93 |
+
embeddings = model.encode(["binary search function", "def binary_search(arr, target): ..."])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
```
|
95 |
|
96 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
# **π Conclusion**
|
|
|
99 |
|
100 |
+
* β
An optimized Sentence-BERT model based on CodeModernBERT-Owl
|
101 |
+
* β
Achieves MRR\@10 > 0.87 on MTEB CodeSearchNetRetrieval
|
102 |
+
* β
Ready for integration in production-level code search systems
|
103 |
+
|
104 |
+
---
|
105 |
|
106 |
+
# **π License**
|
|
|
107 |
|
108 |
+
π Apache-2.0
|
|
|
109 |
|
110 |
+
# **π§ Contact**
|
|
|
111 |
|
112 |
+
For questions or inquiries, feel free to reach out:
|
113 |
+
π§ **[[email protected]](mailto:[email protected])**
|