Shuu12121/CodeSearch-ModernBERT-Owl-v1
SentenceTransformer based on Shuu12121/CodeModernBERT-Owl-v1
This is a sentence-transformers model finetuned from 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 <!-- 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
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 1024, 'do_lower_case': False}) with Transformer model: 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:
pip install -U sentence-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
'#\nDeletes the cluster, including the Kubernetes endpoint and all worker\nnodes.\n\nFirewalls and routes that were configured during cluster creation\nare also deleted.\n\nOther Google Compute Engine resources that might be in use by the cluster,\nsuch as load balancer resources, are not deleted if they weren\'t present\nwhen the cluster was initially created.\n\n@overload delete_cluster(request, options = nil)\nPass arguments to `delete_cluster` via a request object, either of type\n{::Google::Cloud::Container::V1::DeleteClusterRequest} or an equivalent Hash.\n\n@param request [::Google::Cloud::Container::V1::DeleteClusterRequest, ::Hash]\nA request object representing the call parameters. Required. To specify no\nparameters, or to keep all the default parameter values, pass an empty Hash.\n@param options [::Gapic::CallOptions, ::Hash]\nOverrides the default settings for this call, e.g, timeout, retries, etc. Optional.\n\n@overload delete_cluster(project_id: nil, zone: nil, cluster_id: nil, name: nil)\nPass arguments to `delete_cluster` via keyword arguments. Note that at\nleast one keyword argument is required. To specify no parameters, or to keep all\nthe default parameter values, pass an empty Hash as a request object (see above).\n\n@param project_id [::String]\nDeprecated. The Google Developers Console [project ID or project\nnumber](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\nThis field has been deprecated and replaced by the name field.\n@param zone [::String]\nDeprecated. The name of the Google Compute Engine\n[zone](https://cloud.google.com/compute/docs/zones#available) in which the\ncluster resides. This field has been deprecated and replaced by the name\nfield.\n@param cluster_id [::String]\nDeprecated. The name of the cluster to delete.\nThis field has been deprecated and replaced by the name field.\n@param name [::String]\nThe name (project, location, cluster) of the cluster to delete.\nSpecified in the format `projects/*/locations/*/clusters/*`.\n\n@yield [response, operation] Access the result along with the RPC operation\n@yieldparam response [::Google::Cloud::Container::V1::Operation]\n@yieldparam operation [::GRPC::ActiveCall::Operation]\n\n@return [::Google::Cloud::Container::V1::Operation]\n\n@raise [::Google::Cloud::Error] if the RPC is aborted.\n\n@example Basic example\nrequire "google/cloud/container/v1"\n\n# Create a client object. The client can be reused for multiple calls.\nclient = Google::Cloud::Container::V1::ClusterManager::Client.new\n\n# Create a request. To set request fields, pass in keyword arguments.\nrequest = Google::Cloud::Container::V1::DeleteClusterRequest.new\n\n# Call the delete_cluster method.\nresult = client.delete_cluster request\n\n# The returned object is of type Google::Cloud::Container::V1::Operation.\np result',
'def delete_cluster request, options = nil\n raise ::ArgumentError, "request must be provided" if request.nil?\n\n request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Container::V1::DeleteClusterRequest\n\n # Converts hash and nil to an options object\n options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h\n\n # Customize the options with defaults\n metadata = @config.rpcs.delete_cluster.metadata.to_h\n\n # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers\n metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \\\n lib_name: @config.lib_name, lib_version: @config.lib_version,\n gapic_version: ::Google::Cloud::Container::V1::VERSION\n metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?\n metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id\n\n header_params = {}\n if request.name\n header_params["name"] = request.name\n end\n\n request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")\n metadata[:"x-goog-request-params"] ||= request_params_header\n\n options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,\n metadata: metadata,\n retry_policy: @config.rpcs.delete_cluster.retry_policy\n\n options.apply_defaults timeout: @config.timeout,\n metadata: @config.metadata,\n retry_policy: @config.retry_policy\n\n @cluster_manager_stub.call_rpc :delete_cluster, request, options: options do |response, operation|\n yield response, operation if block_given?\n end\n rescue ::GRPC::BadStatus => e\n raise ::Google::Cloud::Error.from_error(e)\n end',
'device(deviceType, deviceId = 0) {\n\t return new DLDevice(deviceType, deviceId, this.lib);\n\t }',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]<!--
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: 3,999,600 training samples
- Columns: <code>sentence0</code>, <code>sentence1</code>, and <code>label</code>
- Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | label | |:--------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 8 tokens</li><li>mean: 74.13 tokens</li><li>max: 1024 tokens</li></ul> | <ul><li>min: 13 tokens</li><li>mean: 154.33 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: | sentence0 | sentence1 | 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 theunregisterinsetbelow, assuming that<br> //unregisterimmediately 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 offunc. Ifresolveris<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. Thefunc<br>is invoked with thethisbinding of the memoized function.<br><br>Note: The cache is exposed as thecacheproperty 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`<br>method interface ofdelete,get,has, andset.<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(FUNCERROR_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> with these parameters:
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 150per_device_eval_batch_size: 150num_train_epochs: 1fp16: Truemulti_dataset_batch_sampler: round_robin
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 150per_device_eval_batch_size: 150per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin
</details>
Training Logs
Framework Versions
- Python: 3.11.13
- Sentence Transformers: 4.1.0
- Transformers: 4.53.2
- PyTorch: 2.6.0+cu124
- Accelerate: 1.9.0
- Datasets: 3.6.0
- Tokenizers: 0.21.2
Citation
BibTeX
Sentence Transformers
@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
@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. -->
