File size: 21,778 Bytes
ae6cdf5 bf8ec47 ae6cdf5 520c72b ae6cdf5 520c72b ae6cdf5 89b9898 ae6cdf5 520c72b ae6cdf5 520c72b ae6cdf5 520c72b ae6cdf5 520c72b fefd66a 520c72b ae6cdf5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | ---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:39122
- loss:MultipleNegativesRankingLoss
base_model: google/embeddinggemma-300m
widget:
- source_sentence: 组件即将出现时加载收藏商家数据
sentences:
- "static async delete(key: string, preferenceName: string = defaultPreferenceName)\
\ {\n let preferences = await this.getPreferences(preferenceName)\n return\
\ await preferences.delete(key)\n }"
- "async aboutToAppear(): Promise<void> {\n await this.loadFavoriteMerchants();\n\
\ }"
- 'Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'
- source_sentence: "@Builder\n buildBottomNavigation() {\n Tabs({ index: this.currentTabIndex\
\ }) {\n TabContent() {\n // 首页内容在主区域显示\n }\n .tabBar(this.buildTabBarItem('首页',\
\ $r('app.media.ic_home'), 0))\n \n TabContent() {\n // 联系人内容在主区域显示\n\
\ }\n .tabBar(this.buildTabBarItem('联系人', $r('app.media.ic_contacts'),\
\ 1))\n \n TabContent() {\n // 日历内容在主区域显示\n }\n .tabBar(this.buildTabBarItem('日历',\
\ $r('app.media.ic_calendar'), 2))\n \n TabContent() {\n // 祝福语内容在主区域显示\n\
\ }\n .tabBar(this.buildTabBarItem('祝福语', $r('app.media.ic_greetings'),\
\ 3))\n \n TabContent() {\n // 设置内容在主区域显示\n }\n .tabBar(this.buildTabBarItem('设置',\
\ $r('app.media.ic_settings'), 4))\n }\n .onChange((index: number) => {\n\
\ this.onTabChange(index);\n })\n .barPosition(BarPosition.End)\n \
\ .barBackgroundColor('#ffffff')\n .barHeight(60)\n }"
sentences:
- 定义List的builder方法
- 错误相关常量
- 构建底部导航栏
- source_sentence: 插入数据库
sentences:
- "static dateToTimestamp(date: Date): number {\n return date.getTime();\n }"
- "public async insertData(context: common.Context, Contact: Contact): Promise<void>\
\ {\n logger.info(TAG, 'insert begin');\n if (!context) {\n logger.info(TAG,\
\ 'context is null or undefined');\n }\n\n const predicates = new rdb.RdbPredicates(TABLE_NAME);\n\
\ if (predicates === null || predicates === undefined) {\n logger.info(TAG,\
\ 'predicates is null or undefined');\n }\n\n this.rdbStore = await rdb.getRdbStore(context,\
\ STORE_CONFIG);\n\n let value1 = Contact.name;\n let value2 = Contact.phone;\n\
\ let value3 = Contact.email;\n let value4 = Contact.address;\n let value5\
\ = Contact.avatar;\n let value6 = Contact.category;\n\n const valueBucket:\
\ ValuesBucket = {\n 'name': value1,\n 'phone': value2,\n 'email':\
\ value3,\n 'address': value4,\n 'avatar': value5,\n 'category':\
\ value6\n }\n\n if (this.rdbStore != undefined) {\n this.rdbStore.insert(TABLE_NAME,\
\ valueBucket, rdb.ConflictResolution.ON_CONFLICT_REPLACE,\n (err: BusinessError,\
\ rows: number) => {\n if (err) {\n logger.info(TAG, \"Insert\
\ failed, err: \" + err)\n return\n }\n logger.info(TAG,\
\ `insert done:${rows}`);\n promptAction.showToast({\n message:\
\ $r('app.string.operate_rdb_in_taskpool_add_prompt_text', Contact.name),\n \
\ duration: CommonConstants.PROMPT_DURATION_TIME\n });\n \
\ })\n }\n }"
- 日历日期的代办事项
- source_sentence: "private recordOperation(\n type: 'create' | 'update' | 'delete'\
\ | 'complete' | 'cancel',\n todoId: string,\n changes?: ChangeRecord,\n\
\ description?: string\n ): void {\n try {\n const record: TodoOperationRecord\
\ = {\n id: this.generateId(),\n type,\n todoId,\n \
\ changes,\n timestamp: new Date().toISOString(),\n description\n\
\ };\n\n this.operationRecords.unshift(record);\n \n // 只保留最近100条记录\n\
\ if (this.operationRecords.length > 100) {\n this.operationRecords\
\ = this.operationRecords.slice(0, 100);\n }\n\n hilog.info(LogConstants.DOMAIN_APP,\
\ LogConstants.TAG_APP, `Recorded operation: ${type} for todo ${todoId}`);\n \
\ } catch (error) {\n hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,\
\ `Failed to record operation: ${error}`);\n }\n }"
sentences:
- 记录操作
- "export interface DataConfig {\n autoBackup: AutoBackupConfig;\n dataRetention:\
\ DataRetentionConfig;\n syncConfig: SyncConfig;\n}"
- "@Builder\n ExamSwitchModule() {\n Row() {\n Text('切换题库:')\n .fontSize(14)\n\
\ Text( this.guideService.guideData.licenseType !== undefined?licenseTypeName[this.guideService.guideData.licenseType]:'')\n\
\ .fontSize(14)\n .fontColor('#64BB5C')\n Image($r('app.media.right_triangle'))\n\
\ .width(16)\n .height(16)\n .fillColor('rgba(0,0,0,0.9)')\n\
\ }\n .width('100%')\n .justifyContent(FlexAlign.Start)\n .onClick(()\
\ => {\n this.vm.navStack.pushPathByName('guidePage', true)\n })\n }"
- source_sentence: 'resize(size: number): void;'
sentences:
- "Resize the bitVector's length.\n\n@param { number } size - The new size for bitVector.\
\ If count is greater than the current size of bitVector,\nthe additional bit\
\ elements are set to 0.\n@throws { BusinessError } 401 - Parameter error. Possible\
\ causes:\n1.Mandatory parameters are left unspecified.\n2.Incorrect parameter\
\ types.\n@throws { BusinessError } 10200011 - The resize method cannot be bound.\n\
@throws { BusinessError } 10200201 - Concurrent modification error.\n@syscap SystemCapability.Utils.Lang\n\
@atomicservice\n@since 12\n \nResize the bitVector's length.\n\n@param { number\
\ } size - The new size for bitVector. If count is greater than the current size\
\ of bitVector,\nthe additional bit elements are set to 0.\n@throws { BusinessError\
\ } 401 - Parameter error. Possible causes:\n1.Mandatory parameters are left unspecified.\n\
2.Incorrect parameter types.\n@throws { BusinessError } 10200011 - The resize\
\ method cannot be bound.\n@throws { BusinessError } 10200201 - Concurrent modification\
\ error.\n@syscap SystemCapability.Utils.Lang\n@crossplatform\n@atomicservice\n\
@since 18"
- "makeNode(uiContext: UIContext): FrameNode {\n this.rootNode = new FrameNode(uiContext);\n\
\ if (this.rootNode !== null) {\n this.rootRenderNode = this.rootNode.getRenderNode();\n\
\ }\n return this.rootNode;\n }"
- "export interface OnlineLunarYear {\n year: number;\n zodiac: string;\n ganzhi:\
\ string;\n leapMonth: number;\n isLeapYear: boolean;\n leapMonthDays?: number;\n\
\ solarTerms: SolarTermInfo[];\n festivals: LunarFestival[];\n}"
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on google/embeddinggemma-300m
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m). 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:** [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m) <!-- at revision 57c266a740f537b4dc058e1b0cda161fd15afa75 -->
- **Maximum Sequence Length:** 512 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/huggingface/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': 512, 'do_lower_case': False, 'architecture': 'Gemma3TextModel'})
(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})
(2): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(4): Normalize()
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("hreyulog/embedinggemma_arkts")
# Run inference
queries = [
"Transform an array of points with all matrices. VERY IMPORTANT: Keep\nmatrix order \"value-touch-offset\" when transforming.\n\n@param pts",
]
documents = [
"public pointValuesToPixel(pts: number[]) {\n this.mMatrixValueToPx.mapPoints(pts);\n this.mViewPortHandler.getMatrixTouch().mapPoints(pts);\n this.mMatrixOffset.mapPoints(pts);\n }",
'makeNode(uiContext: UIContext): FrameNode {\n this.rootNode = new FrameNode(uiContext);\n if (this.rootNode !== null) {\n this.rootRenderNode = this.rootNode.getRenderNode();\n }\n return this.rootNode;\n }',
'export interface OnlineLunarYear {\n year: number;\n zodiac: string;\n ganzhi: string;\n leapMonth: number;\n isLeapYear: boolean;\n leapMonthDays?: number;\n solarTerms: SolarTermInfo[];\n festivals: LunarFestival[];\n}',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.8923, 0.0264, -0.0212]])
```
<!--
### 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.*
-->
## Evaluation Results
On arkts-code-docstring dataset split test
| Model | Params | MRR | NDCG@5 | Recall@1 | Recall@5 |
|------|--------|-----|--------|----------|----------|
| **embedinggemma_arkts** | 308M | **0.7788** | **0.8034** | **0.7142** | **0.8769** |
| QWEN3-Embedding-0.6B | 596M | 0.6776 | 0.7015 | 0.6141 | 0.7723 |
| embeddinggemma-300m | 308M | 0.6399 | 0.6654 | 0.5740 | 0.7416 |
| BGE-M3 | 567M | 0.5283 | 0.5603 | 0.4464 | 0.6558 |
| BGE-base-zh-v1.5 | 110M | 0.3598 | 0.3903 | 0.2841 | 0.4816 |
| BGE-base-en-v1.5 | 110M | 0.3439 | 0.3637 | 0.2935 | 0.4227 |
| E5-base-v2 | 110M | 0.3073 | 0.3261 | 0.2596 | 0.3823 |
| BM25 (jieba) | – | 0.2043 | 0.2204 | 0.1643 | 0.2690 |
## Training Details
### Training Dataset
Dataset: [hreyulog/arkts-code-docstring](https://huggingface.co/datasets/hreyulog/arkts-code-docstring)
* Size: 39,122 training samples
* Columns: <code>sentence_0</code> and <code>sentence_1</code>
* Approximate statistics based on the first 1000 samples:
| | sentence_0 | sentence_1 |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string |
| details | <ul><li>min: 3 tokens</li><li>mean: 97.17 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 94.4 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
| sentence_0 | sentence_1 |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <code>移除登录状态监听</code> | <code>public removeLoginStateListener(listener: (isLoggedIn: boolean) => void) {\n const index = this.loginStateListeners.indexOf(listener);\n if (index !== -1) {\n this.loginStateListeners.splice(index, 1);\n }\n }</code> |
| <code>PUT请求</code> | <code>static put<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {<br> const putConfig: RequestConfig = {<br> method: http.RequestMethod.PUT,<br> headers: config.headers,<br> timeout: config.timeout,<br> data: data<br> };<br> return HttpUtil.request<T>(url, putConfig);<br> }</code> |
| <code>Transform an array of points with all matrices. VERY IMPORTANT: Keep\nmatrix order \"value-touch-offset\" when transforming.\n\n@param pts</code> | <code>public pointValuesToPixel(pts: number[]) {\n this.mMatrixValueToPx.mapPoints(pts);\n this.mViewPortHandler.getMatrixTouch().mapPoints(pts);\n this.mMatrixOffset.mapPoints(pts);\n }</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",
"gather_across_devices": false
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 32
- `num_train_epochs`: 2
- `multi_dataset_batch_sampler`: round_robin
#### All Hyperparameters
<details><summary>Click to expand</summary>
- `do_predict`: False
- `eval_strategy`: no
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 32
- `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`: 2
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: None
- `warmup_ratio`: None
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `enable_jit_checkpoint`: False
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `use_cpu`: False
- `seed`: 42
- `data_seed`: None
- `bf16`: False
- `fp16`: False
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: -1
- `ddp_backend`: None
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `parallelism_config`: None
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch_fused
- `optim_args`: None
- `group_by_length`: False
- `length_column_name`: length
- `project`: huggingface
- `trackio_space_id`: trackio
- `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
- `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_for_metrics`: []
- `eval_do_concat_batches`: True
- `auto_find_batch_size`: False
- `full_determinism`: False
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `include_num_input_tokens_seen`: no
- `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`: True
- `use_cache`: 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.4088 | 500 | 0.3798 |
| 0.8177 | 1000 | 0.2489 |
| 1.2265 | 1500 | 0.1308 |
| 1.6353 | 2000 | 0.0877 |
### Framework Versions
- Python: 3.10.19
- Sentence Transformers: 5.2.2
- Transformers: 5.0.0
- PyTorch: 2.9.1
- Accelerate: 1.12.0
- Datasets: 4.5.0
- Tokenizers: 0.22.2
## Citation
### BibTeX
#### ArkTS-CodeSearch
```bibtex
@misc{he2026arktscodesearchopensourcearktsdataset,
title={ArkTS-CodeSearch: A Open-Source ArkTS Dataset for Code Retrieval},
author={Yulong He and Artem Ermakov and Sergey Kovalchuk and Artem Aliev and Dmitry Shalymov},
year={2026},
eprint={2602.05550},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2602.05550},
}
```
<!--
## 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.*
--> |