Downloads · 30 days
19
25% of all-time downloads
opnsrcntrbtrian/csne-minilm-retrieval-50k
csne-minilm-retrieval-50k is a sentence similarity model from opnsrcntrbtrian. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for retrieval.
Downloads · 30 days
19
25% of all-time downloads
All-time downloads
77
Public
Parameters
22.7M
90.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.9 MB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for retrieval.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("opnsrcntrbtrian/csne-minilm-retrieval-50k")
# Run inference
queries = [
'Go straight down and turn off the motors. Do not call this function if you use the with keyword. Landing is done automatically when the context goes out of scope.',
]
documents = [
'MotionCommander.land def land(self, velocity=VELOCITY): pass if self._is_flying: self.down(self._thread.get_height(), velocity) self._thread.stop() self._thread = None self._cf.commander.send_stop_setpoint() self._is_flying = False',
"issuer_create_credential async def issuer_create_credential(wallet_handle: int, cred_offer_json: str, cred_req_json: str, cred_values_json: str, rev_reg_id: Optional[str], blob_storage_reader_handle: Optional[int]) -> (str, Optional[str], Optional[str]): pass logger = logging.getLogger(__name__) logger.debug('issuer_create_credential: >>> wallet_handle: %r, cred_offer_json: %r, cred_req_json: %r, cred_values_json: %r, rev_reg_id: %r, blob_storage_reader_handle: %r', wallet_handle, cred_offer_json, cred_req_json, cred_values_json, rev_reg_id, blob_storage_reader_handle) if not hasattr(issuer_create_credential, 'cb'): logger.debug('issuer_create_credential: Creating callback') issuer_create_credential.cb = create_cb(CFUNCTYPE(None, c_int32, c_int32, c_char_p, c_char_p, c_char_p)) c_wallet_handle = c_int32(wallet_handle) c_cred_offer_json = c_char_p(cred_offer_json.encode('utf-8')) c_cred_req_json = c_char_p(cred_req_json.encode('utf-8')) c_cred_values_json = c_char_p(cred_values_json.encode('utf-8')) c_rev_reg_id = c_char_p(rev_reg_id.encode('utf-8')) if rev_reg_id is not None else None c_blob_storage_reader_handle = c_int32(blob_storage_reader_handle) if blob_storage_reader_handle else -1 cred_json, cred_revoc_id, revoc_reg_delta_json = await do_call('indy_issuer_create_credential', c_wallet_handle, c_cred_offer_json, c_cred_req_json, c_cred_values_json, c_rev_reg_id, c_blob_storage_reader_handle, issuer_create_credential.cb) cred_json = cred_json.decode() cred_revoc_id = cred_revoc_id.decode() if cred_revoc_id else None revoc_reg_delta_json = revoc_reg_delta_json.decode() if revoc_reg_delta_json else None res = (cred_json, cred_revoc_id, revoc_reg_delta_json) logger.debug('issuer_create_credential: <<< res: %r', res) return res",
'EventPlayer.project_events def project_events(self, initial_state, domain_events): pass return reduce(self._mutator_func or self.mutate, domain_events, initial_state)',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 384] [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.5800, -0.1288, 0.1306]])
<!--
### 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.*
-->
| query | code | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details | <ul><li>min: 6 tokens</li><li>mean: 33.5 tokens</li><li>max: 187 tokens</li></ul> | <ul><li>min: 37 tokens</li><li>mean: 134.54 tokens</li><li>max: 256 tokens</li></ul> |
| query | code |
|---|---|
| <code>Deal with the response url from a Discovery Service</code> | <code>Base.parse_discovery_service_response def parse_discovery_service_response(url='', query='', returnIDParam='entityID'): pass if url: part = urlparse(url) qsd = parse_qs(part[4]) elif query: qsd = parse_qs(query) else: qsd = {} try: return qsd[returnIDParam][0] except KeyError: return ''</code> |
| <code>Given a set of argument tuples, set their value in a data dictionary if not blank</code> | <code>arg_tup_to_dict def arg_tup_to_dict(argument_tuples): pass data = dict() for arg_name, arg_val in argument_tuples: if arg_val is not None: if arg_val is True: arg_val = 'true' elif arg_val is False: arg_val = 'false' data[arg_name] = arg_val return data</code> |
| <code>Returns a generator over the (phenotypeAssociationSet, nextPageToken) pairs defined by the specified request</code> | <code>Backend.phenotypeAssociationSetsGenerator def phenotypeAssociationSetsGenerator(self, request): pass dataset = self.getDataRepository().getDataset(request.dataset_id) return self._topLevelObjectGenerator(request, dataset.getNumPhenotypeAssociationSets(), dataset.getPhenotypeAssociationSetByIndex)</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
per_device_train_batch_size: 64num_train_epochs: 1learning_rate: 2e-05warmup_steps: 0.1dataloader_drop_last: Trueper_device_train_batch_size: 64num_train_epochs: 1max_steps: -1learning_rate: 2e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Truedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.6402 | 500 | 0.2286 |
@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",
}
@misc{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}
<!--
## 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.*
-->