Update README.md
Browse files
README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
| 2 |
tags:
|
| 3 |
- sentence-transformers
|
| 4 |
- sentence-similarity
|
| 5 |
-
- feature-extraction
|
| 6 |
-
- generated_from_trainer
|
| 7 |
- dataset_size:901028
|
| 8 |
- loss:CosineSimilarityLoss
|
| 9 |
base_model: Shuu12121/CodeModernBERT-Owl
|
|
@@ -11,7 +9,8 @@ pipeline_tag: sentence-similarity
|
|
| 11 |
library_name: sentence-transformers
|
| 12 |
metrics:
|
| 13 |
- pearson_cosine
|
| 14 |
-
-
|
|
|
|
| 15 |
model-index:
|
| 16 |
- name: SentenceTransformer based on Shuu12121/CodeModernBERT-Owl
|
| 17 |
results:
|
|
@@ -24,386 +23,141 @@ model-index:
|
|
| 24 |
metrics:
|
| 25 |
- type: pearson_cosine
|
| 26 |
value: 0.9481467499740959
|
| 27 |
-
name: Pearson Cosine
|
| 28 |
-
- type:
|
| 29 |
-
value: 0.
|
| 30 |
-
name:
|
|
|
|
|
|
|
|
|
|
| 31 |
license: apache-2.0
|
|
|
|
|
|
|
| 32 |
---
|
| 33 |
|
| 34 |
-
#
|
| 35 |
|
| 36 |
-
This is a
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
- **
|
| 42 |
-
- **
|
| 43 |
-
- **
|
| 44 |
-
- **
|
| 45 |
-
- **Similarity Function:** Cosine Similarity
|
| 46 |
-
<!-- - **Training Dataset:** Unknown -->
|
| 47 |
-
<!-- - **Language:** Unknown -->
|
| 48 |
-
<!-- - **License:** Unknown -->
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
| 54 |
-
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
SentenceTransformer(
|
| 60 |
-
(0): Transformer({'max_seq_length': 2048
|
| 61 |
-
(1): Pooling({
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
)
|
| 63 |
```
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
|
| 71 |
```bash
|
| 72 |
-
pip install -U sentence-transformers
|
| 73 |
```
|
| 74 |
|
| 75 |
-
|
| 76 |
-
```python
|
| 77 |
-
from sentence_transformers import SentenceTransformer
|
| 78 |
|
| 79 |
-
#
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
' protected void runTest(URL pBaseURL, String pName, String pHref) throws Exception {\n URL url = new URL(pBaseURL, pHref);\n XSParser parser = new XSParser();\n parser.setValidating(false);\n InputSource isource = new InputSource(url.openStream());\n isource.setSystemId(url.toString());\n String result;\n try {\n parser.parse(isource);\n ++numOk;\n result = "Ok";\n } catch (Exception e) {\n ++numFailed;\n result = e.getMessage();\n }\n log("Running test " + pName + " with URL " + url + ": " + result);\n }\n',
|
| 85 |
-
' public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException {\n ZipFile zip = new ZipFile(mapPackFile);\n try {\n Enumeration<? extends ZipEntry> entries = zip.entries();\n MessageDigest md5Total = MessageDigest.getInstance("MD5");\n MessageDigest md5 = MessageDigest.getInstance("MD5");\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n if (entry.isDirectory()) continue;\n String name = entry.getName();\n if (name.toUpperCase().startsWith("META-INF")) continue;\n md5.reset();\n InputStream in = zip.getInputStream(entry);\n byte[] data = Utilities.getInputBytes(in);\n in.close();\n byte[] digest = md5.digest(data);\n log.trace("Hashsum " + Hex.encodeHexString(digest) + " includes \\"" + name + "\\"");\n md5Total.update(digest);\n md5Total.update(name.getBytes());\n }\n String md5sum = Hex.encodeHexString(md5Total.digest());\n log.trace("md5sum of " + mapPackFile.getName() + ": " + md5sum);\n return md5sum;\n } finally {\n zip.close();\n }\n }\n',
|
| 86 |
-
]
|
| 87 |
-
embeddings = model.encode(sentences)
|
| 88 |
-
print(embeddings.shape)
|
| 89 |
-
# [3, 768]
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
print(similarities.shape)
|
| 94 |
-
# [3, 3]
|
| 95 |
```
|
| 96 |
|
| 97 |
-
|
| 98 |
-
### Direct Usage (Transformers)
|
| 99 |
|
| 100 |
-
|
| 101 |
|
| 102 |
-
</details>
|
| 103 |
-
-->
|
| 104 |
-
|
| 105 |
-
<!--
|
| 106 |
-
### Downstream Usage (Sentence Transformers)
|
| 107 |
-
|
| 108 |
-
You can finetune this model on your own dataset.
|
| 109 |
-
|
| 110 |
-
<details><summary>Click to expand</summary>
|
| 111 |
-
|
| 112 |
-
</details>
|
| 113 |
-
-->
|
| 114 |
-
|
| 115 |
-
<!--
|
| 116 |
-
### Out-of-Scope Use
|
| 117 |
-
|
| 118 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 119 |
-
-->
|
| 120 |
-
|
| 121 |
-
## Evaluation
|
| 122 |
-
|
| 123 |
-
### Metrics
|
| 124 |
-
|
| 125 |
-
#### Semantic Similarity
|
| 126 |
-
|
| 127 |
-
* Dataset: `val`
|
| 128 |
-
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
|
| 129 |
-
|
| 130 |
-
| Metric | Value |
|
| 131 |
-
|:--------------------|:-----------|
|
| 132 |
-
| pearson_cosine | 0.9481 |
|
| 133 |
-
| **spearman_cosine** | **0.5635** |
|
| 134 |
-
|
| 135 |
-
<!--
|
| 136 |
-
## Bias, Risks and Limitations
|
| 137 |
-
|
| 138 |
-
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 139 |
-
-->
|
| 140 |
-
|
| 141 |
-
<!--
|
| 142 |
-
### Recommendations
|
| 143 |
-
|
| 144 |
-
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 145 |
-
-->
|
| 146 |
-
|
| 147 |
-
## Training Details
|
| 148 |
-
|
| 149 |
-
### Training Dataset
|
| 150 |
-
|
| 151 |
-
#### Unnamed Dataset
|
| 152 |
-
|
| 153 |
-
* Size: 901,028 training samples
|
| 154 |
-
* Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
|
| 155 |
-
* Approximate statistics based on the first 1000 samples:
|
| 156 |
-
| | sentence_0 | sentence_1 | label |
|
| 157 |
-
|:--------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------|
|
| 158 |
-
| type | string | string | float |
|
| 159 |
-
| details | <ul><li>min: 52 tokens</li><li>mean: 332.69 tokens</li><li>max: 2048 tokens</li></ul> | <ul><li>min: 54 tokens</li><li>mean: 353.29 tokens</li><li>max: 2048 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.49</li><li>max: 1.0</li></ul> |
|
| 160 |
-
* Samples:
|
| 161 |
-
| sentence_0 | sentence_1 | label |
|
| 162 |
-
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
|
| 163 |
-
| <code> public static Image load(final InputStream input, String format, Point dimension) throws CoreException {<br> MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);<br> File dotInput = null, dotOutput = null;<br> ByteArrayOutputStream dotContents = new ByteArrayOutputStream();<br> try {<br> dotInput = File.createTempFile(TMP_FILE_PREFIX, DOT_EXTENSION);<br> dotOutput = File.createTempFile(TMP_FILE_PREFIX, "." + format);<br> dotOutput.delete();<br> FileOutputStream tmpDotOutputStream = null;<br> try {<br> IOUtils.copy(input, dotContents);<br> tmpDotOutputStream = new FileOutputStream(dotInput);<br> IOUtils.copy(new ByteArrayInputStream(dotContents.toByteArray()), tmpDotOutputStream);<br> } finally {<br> IOUtils.closeQuietly(tmpDotOutputStream);<br> }<br> IStatus result = runDot(format, dimension, dotInp...</code> | <code> public final Matrix3D<E> read(final URL url) throws IOException {<br> if (url == null) {<br> throw new IllegalArgumentException("url must not be null");<br> }<br> InputStream inputStream = null;<br> try {<br> inputStream = url.openStream();<br> return read(inputStream);<br> } catch (IOException e) {<br> throw e;<br> } finally {<br> MatrixIOUtils.closeQuietly(inputStream);<br> }<br> }<br></code> | <code>0.0</code> |
|
| 164 |
-
| <code> public List<PathObject> fetchPath(BoardObject board) throws NetworkException {<br> if (boardPathMap.containsKey(board.getId())) {<br> return boardPathMap.get(board.getId()).getChildren();<br> }<br> HttpClient client = HttpConfig.newInstance();<br> HttpGet get = new HttpGet(HttpConfig.bbsURL() + HttpConfig.BBS_0AN_BOARD + board.getId());<br> try {<br> HttpResponse response = client.execute(get);<br> HttpEntity entity = response.getEntity();<br> Document doc = XmlOperator.readDocument(entity.getContent());<br> PathObject parent = new PathObject();<br> BBSBodyParseHelper.parsePathList(doc, parent);<br> parent = searchAndCreatePathFromRoot(parent);<br> boardPathMap.put(board.getId(), parent);<br> return parent.getChildren();<br> } catch (Exception e) {<br> e.printStackTrace();<br> throw new NetworkException(e);<br> }<br> }<br></code> | <code> public static void readDefault() {<br> ClassLoader l = Skeleton.class.getClassLoader();<br> URL url;<br> if (l != null) {<br> url = l.getResource(DEFAULT_LOC);<br> } else {<br> url = ClassLoader.getSystemResource(DEFAULT_LOC);<br> }<br> if (url == null) {<br> Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);<br> throw new GeneratorException();<br> }<br> try {<br> InputStreamReader reader = new InputStreamReader(url.openStream());<br> readSkel(new BufferedReader(reader));<br> } catch (IOException e) {<br> Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);<br> throw new GeneratorException();<br> }<br> }<br></code> | <code>0.0</code> |
|
| 165 |
-
| <code> public boolean copyFile(File source, File dest) {<br> try {<br> FileReader in = new FileReader(source);<br> FileWriter out = new FileWriter(dest);<br> int c;<br> while ((c = in.read()) != -1) out.write(c);<br> in.close();<br> out.close();<br> return true;<br> } catch (Exception e) {<br> return false;<br> }<br> }<br></code> | <code> public static boolean encodeFileToFile(String infile, String outfile) {<br> boolean success = false;<br> java.io.InputStream in = null;<br> java.io.OutputStream out = null;<br> try {<br> in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.ENCODE);<br> out = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile));<br> byte[] buffer = new byte[65536];<br> int read = -1;<br> while ((read = in.read(buffer)) >= 0) {<br> out.write(buffer, 0, read);<br> }<br> success = true;<br> } catch (java.io.IOException exc) {<br> exc.printStackTrace();<br> } finally {<br> try {<br> in.close();<br> } catch (Exception exc) {<br> }<br> try {<br> out.close();<br> } catch (Exception exc) {<br> }<br> }<br> return success;<br> }<br></code> | <code>1.0</code> |
|
| 166 |
-
* Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
|
| 167 |
-
```json
|
| 168 |
-
{
|
| 169 |
-
"loss_fct": "torch.nn.modules.loss.MSELoss"
|
| 170 |
-
}
|
| 171 |
-
```
|
| 172 |
-
|
| 173 |
-
### Training Hyperparameters
|
| 174 |
-
#### Non-Default Hyperparameters
|
| 175 |
-
|
| 176 |
-
- `eval_strategy`: steps
|
| 177 |
-
- `per_device_train_batch_size`: 32
|
| 178 |
-
- `per_device_eval_batch_size`: 32
|
| 179 |
-
- `num_train_epochs`: 1
|
| 180 |
-
- `fp16`: True
|
| 181 |
-
- `multi_dataset_batch_sampler`: round_robin
|
| 182 |
-
|
| 183 |
-
#### All Hyperparameters
|
| 184 |
-
<details><summary>Click to expand</summary>
|
| 185 |
-
|
| 186 |
-
- `overwrite_output_dir`: False
|
| 187 |
-
- `do_predict`: False
|
| 188 |
-
- `eval_strategy`: steps
|
| 189 |
-
- `prediction_loss_only`: True
|
| 190 |
-
- `per_device_train_batch_size`: 32
|
| 191 |
-
- `per_device_eval_batch_size`: 32
|
| 192 |
-
- `per_gpu_train_batch_size`: None
|
| 193 |
-
- `per_gpu_eval_batch_size`: None
|
| 194 |
-
- `gradient_accumulation_steps`: 1
|
| 195 |
-
- `eval_accumulation_steps`: None
|
| 196 |
-
- `torch_empty_cache_steps`: None
|
| 197 |
-
- `learning_rate`: 5e-05
|
| 198 |
-
- `weight_decay`: 0.0
|
| 199 |
-
- `adam_beta1`: 0.9
|
| 200 |
-
- `adam_beta2`: 0.999
|
| 201 |
-
- `adam_epsilon`: 1e-08
|
| 202 |
-
- `max_grad_norm`: 1
|
| 203 |
-
- `num_train_epochs`: 1
|
| 204 |
-
- `max_steps`: -1
|
| 205 |
-
- `lr_scheduler_type`: linear
|
| 206 |
-
- `lr_scheduler_kwargs`: {}
|
| 207 |
-
- `warmup_ratio`: 0.0
|
| 208 |
-
- `warmup_steps`: 0
|
| 209 |
-
- `log_level`: passive
|
| 210 |
-
- `log_level_replica`: warning
|
| 211 |
-
- `log_on_each_node`: True
|
| 212 |
-
- `logging_nan_inf_filter`: True
|
| 213 |
-
- `save_safetensors`: True
|
| 214 |
-
- `save_on_each_node`: False
|
| 215 |
-
- `save_only_model`: False
|
| 216 |
-
- `restore_callback_states_from_checkpoint`: False
|
| 217 |
-
- `no_cuda`: False
|
| 218 |
-
- `use_cpu`: False
|
| 219 |
-
- `use_mps_device`: False
|
| 220 |
-
- `seed`: 42
|
| 221 |
-
- `data_seed`: None
|
| 222 |
-
- `jit_mode_eval`: False
|
| 223 |
-
- `use_ipex`: False
|
| 224 |
-
- `bf16`: False
|
| 225 |
-
- `fp16`: True
|
| 226 |
-
- `fp16_opt_level`: O1
|
| 227 |
-
- `half_precision_backend`: auto
|
| 228 |
-
- `bf16_full_eval`: False
|
| 229 |
-
- `fp16_full_eval`: False
|
| 230 |
-
- `tf32`: None
|
| 231 |
-
- `local_rank`: 0
|
| 232 |
-
- `ddp_backend`: None
|
| 233 |
-
- `tpu_num_cores`: None
|
| 234 |
-
- `tpu_metrics_debug`: False
|
| 235 |
-
- `debug`: []
|
| 236 |
-
- `dataloader_drop_last`: False
|
| 237 |
-
- `dataloader_num_workers`: 0
|
| 238 |
-
- `dataloader_prefetch_factor`: None
|
| 239 |
-
- `past_index`: -1
|
| 240 |
-
- `disable_tqdm`: False
|
| 241 |
-
- `remove_unused_columns`: True
|
| 242 |
-
- `label_names`: None
|
| 243 |
-
- `load_best_model_at_end`: False
|
| 244 |
-
- `ignore_data_skip`: False
|
| 245 |
-
- `fsdp`: []
|
| 246 |
-
- `fsdp_min_num_params`: 0
|
| 247 |
-
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
| 248 |
-
- `tp_size`: 0
|
| 249 |
-
- `fsdp_transformer_layer_cls_to_wrap`: None
|
| 250 |
-
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
| 251 |
-
- `deepspeed`: None
|
| 252 |
-
- `label_smoothing_factor`: 0.0
|
| 253 |
-
- `optim`: adamw_torch
|
| 254 |
-
- `optim_args`: None
|
| 255 |
-
- `adafactor`: False
|
| 256 |
-
- `group_by_length`: False
|
| 257 |
-
- `length_column_name`: length
|
| 258 |
-
- `ddp_find_unused_parameters`: None
|
| 259 |
-
- `ddp_bucket_cap_mb`: None
|
| 260 |
-
- `ddp_broadcast_buffers`: False
|
| 261 |
-
- `dataloader_pin_memory`: True
|
| 262 |
-
- `dataloader_persistent_workers`: False
|
| 263 |
-
- `skip_memory_metrics`: True
|
| 264 |
-
- `use_legacy_prediction_loop`: False
|
| 265 |
-
- `push_to_hub`: False
|
| 266 |
-
- `resume_from_checkpoint`: None
|
| 267 |
-
- `hub_model_id`: None
|
| 268 |
-
- `hub_strategy`: every_save
|
| 269 |
-
- `hub_private_repo`: None
|
| 270 |
-
- `hub_always_push`: False
|
| 271 |
-
- `gradient_checkpointing`: False
|
| 272 |
-
- `gradient_checkpointing_kwargs`: None
|
| 273 |
-
- `include_inputs_for_metrics`: False
|
| 274 |
-
- `include_for_metrics`: []
|
| 275 |
-
- `eval_do_concat_batches`: True
|
| 276 |
-
- `fp16_backend`: auto
|
| 277 |
-
- `push_to_hub_model_id`: None
|
| 278 |
-
- `push_to_hub_organization`: None
|
| 279 |
-
- `mp_parameters`:
|
| 280 |
-
- `auto_find_batch_size`: False
|
| 281 |
-
- `full_determinism`: False
|
| 282 |
-
- `torchdynamo`: None
|
| 283 |
-
- `ray_scope`: last
|
| 284 |
-
- `ddp_timeout`: 1800
|
| 285 |
-
- `torch_compile`: False
|
| 286 |
-
- `torch_compile_backend`: None
|
| 287 |
-
- `torch_compile_mode`: None
|
| 288 |
-
- `dispatch_batches`: None
|
| 289 |
-
- `split_batches`: None
|
| 290 |
-
- `include_tokens_per_second`: False
|
| 291 |
-
- `include_num_input_tokens_seen`: False
|
| 292 |
-
- `neftune_noise_alpha`: None
|
| 293 |
-
- `optim_target_modules`: None
|
| 294 |
-
- `batch_eval_metrics`: False
|
| 295 |
-
- `eval_on_start`: False
|
| 296 |
-
- `use_liger_kernel`: False
|
| 297 |
-
- `eval_use_gather_object`: False
|
| 298 |
-
- `average_tokens_across_devices`: False
|
| 299 |
-
- `prompts`: None
|
| 300 |
-
- `batch_sampler`: batch_sampler
|
| 301 |
-
- `multi_dataset_batch_sampler`: round_robin
|
| 302 |
-
|
| 303 |
-
</details>
|
| 304 |
-
|
| 305 |
-
### Training Logs
|
| 306 |
-
| Epoch | Step | Training Loss | val_spearman_cosine |
|
| 307 |
-
|:------:|:-----:|:-------------:|:-------------------:|
|
| 308 |
-
| 0.0178 | 500 | 0.1622 | - |
|
| 309 |
-
| 0.0355 | 1000 | 0.0124 | 0.5702 |
|
| 310 |
-
| 0.0533 | 1500 | 0.0087 | - |
|
| 311 |
-
| 0.0710 | 2000 | 0.0064 | 0.5686 |
|
| 312 |
-
| 0.0888 | 2500 | 0.0048 | - |
|
| 313 |
-
| 0.1065 | 3000 | 0.0046 | 0.5753 |
|
| 314 |
-
| 0.1243 | 3500 | 0.0036 | - |
|
| 315 |
-
| 0.1421 | 4000 | 0.0039 | 0.5745 |
|
| 316 |
-
| 0.1598 | 4500 | 0.0036 | - |
|
| 317 |
-
| 0.1776 | 5000 | 0.0035 | 0.5637 |
|
| 318 |
-
| 0.1953 | 5500 | 0.0036 | - |
|
| 319 |
-
| 0.2131 | 6000 | 0.0027 | 0.5615 |
|
| 320 |
-
| 0.2308 | 6500 | 0.002 | - |
|
| 321 |
-
| 0.2486 | 7000 | 0.0019 | 0.5660 |
|
| 322 |
-
| 0.2664 | 7500 | 0.0017 | - |
|
| 323 |
-
| 0.2841 | 8000 | 0.0017 | 0.5622 |
|
| 324 |
-
| 0.3019 | 8500 | 0.0019 | - |
|
| 325 |
-
| 0.3196 | 9000 | 0.0017 | 0.5583 |
|
| 326 |
-
| 0.3374 | 9500 | 0.0012 | - |
|
| 327 |
-
| 0.3551 | 10000 | 0.0013 | 0.5547 |
|
| 328 |
-
| 0.3729 | 10500 | 0.0015 | - |
|
| 329 |
-
| 0.3907 | 11000 | 0.0011 | 0.5631 |
|
| 330 |
-
| 0.4084 | 11500 | 0.0012 | - |
|
| 331 |
-
| 0.4262 | 12000 | 0.0013 | 0.5630 |
|
| 332 |
-
| 0.4439 | 12500 | 0.001 | - |
|
| 333 |
-
| 0.4617 | 13000 | 0.0009 | 0.5607 |
|
| 334 |
-
| 0.4794 | 13500 | 0.0007 | - |
|
| 335 |
-
| 0.4972 | 14000 | 0.001 | 0.5590 |
|
| 336 |
-
| 0.5150 | 14500 | 0.001 | - |
|
| 337 |
-
| 0.5327 | 15000 | 0.0009 | 0.5572 |
|
| 338 |
-
| 0.5505 | 15500 | 0.0007 | - |
|
| 339 |
-
| 0.5682 | 16000 | 0.0006 | 0.5607 |
|
| 340 |
-
| 0.5860 | 16500 | 0.0007 | - |
|
| 341 |
-
| 0.6037 | 17000 | 0.0006 | 0.5675 |
|
| 342 |
-
| 0.6215 | 17500 | 0.0007 | - |
|
| 343 |
-
| 0.6392 | 18000 | 0.0009 | 0.5610 |
|
| 344 |
-
| 0.6570 | 18500 | 0.0008 | - |
|
| 345 |
-
| 0.6748 | 19000 | 0.0007 | 0.5583 |
|
| 346 |
-
| 0.6925 | 19500 | 0.0006 | - |
|
| 347 |
-
| 0.7103 | 20000 | 0.0006 | 0.5662 |
|
| 348 |
-
| 0.7280 | 20500 | 0.0007 | - |
|
| 349 |
-
| 0.7458 | 21000 | 0.0005 | 0.5659 |
|
| 350 |
-
| 0.7635 | 21500 | 0.0004 | - |
|
| 351 |
-
| 0.7813 | 22000 | 0.0006 | 0.5667 |
|
| 352 |
-
| 0.7991 | 22500 | 0.0006 | - |
|
| 353 |
-
| 0.8168 | 23000 | 0.0006 | 0.5644 |
|
| 354 |
-
| 0.8346 | 23500 | 0.0005 | - |
|
| 355 |
-
| 0.8523 | 24000 | 0.0003 | 0.5629 |
|
| 356 |
-
| 0.8701 | 24500 | 0.0005 | - |
|
| 357 |
-
| 0.8878 | 25000 | 0.0005 | 0.5642 |
|
| 358 |
-
| 0.9056 | 25500 | 0.0006 | - |
|
| 359 |
-
| 0.9234 | 26000 | 0.0006 | 0.5640 |
|
| 360 |
-
| 0.9411 | 26500 | 0.0004 | - |
|
| 361 |
-
| 0.9589 | 27000 | 0.0007 | 0.5634 |
|
| 362 |
-
| 0.9766 | 27500 | 0.0004 | - |
|
| 363 |
-
| 0.9944 | 28000 | 0.0005 | 0.5635 |
|
| 364 |
-
| 1.0 | 28158 | - | 0.5635 |
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
### Framework Versions
|
| 368 |
-
- Python: 3.11.11
|
| 369 |
-
- Sentence Transformers: 4.0.1
|
| 370 |
-
- Transformers: 4.50.3
|
| 371 |
-
- PyTorch: 2.6.0+cu124
|
| 372 |
-
- Accelerate: 1.5.2
|
| 373 |
-
- Datasets: 3.5.0
|
| 374 |
-
- Tokenizers: 0.21.1
|
| 375 |
-
|
| 376 |
-
## Citation
|
| 377 |
-
|
| 378 |
-
### BibTeX
|
| 379 |
-
|
| 380 |
-
#### Sentence Transformers
|
| 381 |
```bibtex
|
| 382 |
@inproceedings{reimers-2019-sentence-bert,
|
| 383 |
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 384 |
author = "Reimers, Nils and Gurevych, Iryna",
|
| 385 |
-
booktitle = "
|
| 386 |
-
|
| 387 |
-
year = "2019",
|
| 388 |
-
publisher = "Association for Computational Linguistics",
|
| 389 |
-
url = "https://arxiv.org/abs/1908.10084",
|
| 390 |
}
|
| 391 |
```
|
| 392 |
|
| 393 |
-
|
| 394 |
-
## Glossary
|
| 395 |
-
|
| 396 |
-
*Clearly define terms in order to be accessible across audiences.*
|
| 397 |
-
-->
|
| 398 |
-
|
| 399 |
-
<!--
|
| 400 |
-
## Model Card Authors
|
| 401 |
|
| 402 |
-
|
| 403 |
-
-->
|
| 404 |
|
| 405 |
-
|
| 406 |
-
## Model Card Contact
|
| 407 |
|
| 408 |
-
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 409 |
-
-->
|
|
|
|
| 2 |
tags:
|
| 3 |
- sentence-transformers
|
| 4 |
- sentence-similarity
|
|
|
|
|
|
|
| 5 |
- dataset_size:901028
|
| 6 |
- loss:CosineSimilarityLoss
|
| 7 |
base_model: Shuu12121/CodeModernBERT-Owl
|
|
|
|
| 9 |
library_name: sentence-transformers
|
| 10 |
metrics:
|
| 11 |
- pearson_cosine
|
| 12 |
+
- accuracy
|
| 13 |
+
- f1
|
| 14 |
model-index:
|
| 15 |
- name: SentenceTransformer based on Shuu12121/CodeModernBERT-Owl
|
| 16 |
results:
|
|
|
|
| 23 |
metrics:
|
| 24 |
- type: pearson_cosine
|
| 25 |
value: 0.9481467499740959
|
| 26 |
+
name: Training Pearson Cosine
|
| 27 |
+
- type: accuracy
|
| 28 |
+
value: 0.9900051996071408
|
| 29 |
+
name: Test Accuracy
|
| 30 |
+
- type: f1
|
| 31 |
+
value: 0.963323498754483
|
| 32 |
+
name: Test F1 Score
|
| 33 |
license: apache-2.0
|
| 34 |
+
datasets:
|
| 35 |
+
- google/code_x_glue_cc_clone_detection_big_clone_bench
|
| 36 |
---
|
| 37 |
|
| 38 |
+
# SentenceTransformer based on `Shuu12121/CodeModernBERT-Owl🦉`
|
| 39 |
|
| 40 |
+
This model is a SentenceTransformer fine-tuned from [`Shuu12121/CodeModernBERT-Owl🦉`](https://huggingface.co/Shuu12121/CodeModernBERT-Owl) on the [BigCloneBench](https://huggingface.co/datasets/google/code_x_glue_cc_clone_detection_big_clone_bench) dataset for **code clone detection**. It maps code snippets into a 768-dimensional dense vector space for semantic similarity tasks.
|
| 41 |
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 📌 Model Overview
|
| 45 |
+
|
| 46 |
+
- **Architecture**: Sentence-BERT (SBERT)
|
| 47 |
+
- **Base Model**: `Shuu12121/CodeModernBERT-Owl`
|
| 48 |
+
- **Output Dimension**: 768
|
| 49 |
+
- **Max Sequence Length**: 2048 tokens
|
| 50 |
+
- **Pooling Method**: CLS token pooling
|
| 51 |
+
- **Similarity Function**: Cosine Similarity
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## 🏋️♂️ Training Configuration
|
| 56 |
|
| 57 |
+
- **Loss Function**: `CosineSimilarityLoss`
|
| 58 |
+
- **Epochs**: 1
|
| 59 |
+
- **Batch Size**: 32
|
| 60 |
+
- **Warmup Steps**: 3% of training steps
|
| 61 |
+
- **Evaluator**: `EmbeddingSimilarityEvaluator` (on validation)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## 📊 Evaluation Metrics
|
| 66 |
+
|
| 67 |
+
| Metric | Score |
|
| 68 |
+
|---------------------------|--------------------|
|
| 69 |
+
| Pearson Cosine (Train) | `0.9481` |
|
| 70 |
+
| Accuracy (Test) | `0.9900` |
|
| 71 |
+
| F1 Score (Test) | `0.9633` |
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
|
| 75 |
+
## 📚 Dataset
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
- [Google BigCloneBench](https://huggingface.co/datasets/google/code_x_glue_cc_clone_detection_big_clone_bench)
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## 🧪 How to Use
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
from sentence_transformers import SentenceTransformer
|
| 85 |
+
|
| 86 |
+
model = SentenceTransformer("your-model-id")
|
| 87 |
+
sentences = [
|
| 88 |
+
"def add(a, b): return a + b",
|
| 89 |
+
"def sum(x, y): return x + y"
|
| 90 |
+
]
|
| 91 |
+
embeddings = model.encode(sentences)
|
| 92 |
|
| 93 |
+
from torch.nn.functional import cosine_similarity
|
| 94 |
+
import torch
|
| 95 |
+
|
| 96 |
+
score = cosine_similarity(torch.tensor([embeddings[0]]), torch.tensor([embeddings[1]]))
|
| 97 |
+
print(f"Cosine similarity: {score.item():.4f}")
|
| 98 |
```
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## 🛠️ Model Architecture
|
| 103 |
+
|
| 104 |
+
```python
|
| 105 |
SentenceTransformer(
|
| 106 |
+
(0): Transformer({'max_seq_length': 2048}) with model 'ModernBertModel'
|
| 107 |
+
(1): Pooling({
|
| 108 |
+
'word_embedding_dimension': 768,
|
| 109 |
+
'pooling_mode_cls_token': True,
|
| 110 |
+
...
|
| 111 |
+
})
|
| 112 |
)
|
| 113 |
```
|
| 114 |
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## 📦 Dependencies
|
| 118 |
|
| 119 |
+
- Python: `3.11.11`
|
| 120 |
+
- sentence-transformers: `4.0.1`
|
| 121 |
+
- transformers: `4.50.3`
|
| 122 |
+
- torch: `2.6.0+cu124`
|
| 123 |
+
- datasets: `3.5.0`
|
| 124 |
+
- tokenizers: `0.21.1`
|
| 125 |
+
- flash-attn: ✅ Installed
|
| 126 |
|
| 127 |
+
### Install Required Libraries
|
| 128 |
|
| 129 |
```bash
|
| 130 |
+
pip install -U sentence-transformers transformers>=4.48.0 flash-attn datasets
|
| 131 |
```
|
| 132 |
|
| 133 |
+
---
|
|
|
|
|
|
|
| 134 |
|
| 135 |
+
## 🔐 Optional: Authentication
|
| 136 |
+
|
| 137 |
+
```python
|
| 138 |
+
from huggingface_hub import login
|
| 139 |
+
login("your_huggingface_token")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
+
import wandb
|
| 142 |
+
wandb.login(key="your_wandb_token")
|
|
|
|
|
|
|
| 143 |
```
|
| 144 |
|
| 145 |
+
---
|
|
|
|
| 146 |
|
| 147 |
+
## 🧾 Citation
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
```bibtex
|
| 150 |
@inproceedings{reimers-2019-sentence-bert,
|
| 151 |
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 152 |
author = "Reimers, Nils and Gurevych, Iryna",
|
| 153 |
+
booktitle = "EMNLP 2019",
|
| 154 |
+
url = "https://arxiv.org/abs/1908.10084"
|
|
|
|
|
|
|
|
|
|
| 155 |
}
|
| 156 |
```
|
| 157 |
|
| 158 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
+
## 🔓 License
|
|
|
|
| 161 |
|
| 162 |
+
Apache License 2.0
|
|
|
|
| 163 |
|
|
|
|
|
|