Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
text-embeddings-inference
Run this model with HF Jobs
Run yosshstd/ProTrek_650M_UniRef50_text_encoder on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/yosshstd/ProTrek_650M_UniRef50_text_encoder. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/yosshstd/ProTrek_650M_UniRef50_text_encoder on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use yosshstd/ProTrek_650M_UniRef50_text_encoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use yosshstd/ProTrek_650M_UniRef50_text_encoder with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("yosshstd/ProTrek_650M_UniRef50_text_encoder") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files12341 unmodified line6789101112131415167 unmodified lines24252627282930313233343520 unmodified lines5657585960616263646566676869707172737475767778798042 unmodified lines123124125126127128129130---tags:- sentence-transformers- sentence-similarity1 unmodified line- densepipeline_tag: sentence-similaritylibrary_name: sentence-transformers---# SentenceTransformerThis is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.## Model Details7 unmodified lines<!-- - **Language:** Unknown --><!-- - **License:** Unknown -->### Model Sources- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)### Full Model Architecture```20 unmodified linesfrom sentence_transformers import SentenceTransformer# Download from the 🤗 Hubmodel = SentenceTransformer("sentence_transformers_model_id")# Run inferencesentences = ['The weather is lovely today.',"It's so sunny outside!",'He drove to the stadium.',]embeddings = model.encode(sentences)print(embeddings.shape)# [3, 1024]# Get the similarity scores for the embeddingssimilarities = model.similarity(embeddings, embeddings)print(similarities)# tensor([[1.0000, 0.7137, 0.6395],# [0.7137, 1.0000, 0.5949],# [0.6395, 0.5949, 1.0000]])```<!--### Direct Usage (Transformers)42 unmodified lines- Tokenizers: 0.21.2## Citation### BibTeX<!--## Glossary123451 unmodified line7891011121314151617181920217 unmodified lines29303132333420 unmodified lines555657585960616263646566676869707172737475767778798081828384858687888990919242 unmodified lines135136137138139140141142143144145146147148149150---license: mittags:- sentence-transformers- sentence-similarity1 unmodified line- densepipeline_tag: sentence-similaritylibrary_name: sentence-transformersbase_model:- westlake-repl/ProTrek_650M_UniRef50---# ProTrek_650M_UniRef50_text_encoderThis model is a SentenceTransformer-compatible version of ProTrek_650M_UniRef50_text_encoder. It has been converted for use with the sentence-transformers library, enabling easy integration into semantic similarity tasks, such as semantic search, clustering, and feature extraction.**Github repo: https://github.com/westlake-repl/ProTrek****Hugging Face repo https://huggingface.co/westlake-repl/ProTrek_650M_UniRef50**## Model Details7 unmodified lines<!-- - **Language:** Unknown --><!-- - **License:** Unknown -->### Full Model Architecture```20 unmodified linesfrom sentence_transformers import SentenceTransformer# Download from the 🤗 Hubprotein_encoder = SentenceTransformer("yosshstd/ProTrek_650M_UniRef50_protein_encoder")text_encoder = SentenceTransformer("yosshstd/ProTrek_650M_UniRef50_text_encoder")structure_encoder = SentenceTransformer("yosshstd/ProTrek_650M_UniRef50_structure_encoder")# Run inferenceProTrek_650M_UniRef50_temperature = 0.0186767578def sim(a, b): return (a @ b.T / ProTrek_650M_UniRef50_temperature).item()aa_seq = "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"text = 'Insulin decreases blood glucose concentration. It increases cell permeability to monosaccharides, amino acids and fatty acids. It accelerates glycolysis, the pentose phosphate cycle, and glycogen synthesis in liver.'foldseek_seq = 'DVVVVVVVVVVVVCVVPPDDPVPPFDFDFDADVVLVVLLCVLLVPLAFDDDDPDPVVVVVVVVDDDPPDDDPPDPDPDPPVVVVVVVVDDCSVVRRVGIDGSVSSNVRGD'.lower()seq_emb = protein_encoder.encode([aa_seq], convert_to_tensor=True)text_emb = text_encoder.encode([text], convert_to_tensor=True)struc_emb = structure_encoder.encode([foldseek_seq], convert_to_tensor=True)print("Seq-Text similarity:", sim(seq_emb, text_emb))print("Seq-Structure similarity:", sim(seq_emb, struc_emb))print("Text-Structure similarity:", sim(text_emb, struc_emb))```## OverviewProTrek is a multimodal model that integrates protein sequence, protein structure, and text information for betterprotein understanding. It adopts contrastive learning to learn the representations of protein sequence and structure.During the pre-training phase, we calculate the InfoNCE loss for each two modalities as [CLIP](https://arxiv.org/abs/2103.00020)does.## Model architecture**Protein sequence encoder**: [esm2_t33_650M_UR50D](https://huggingface.co/facebook/esm2_t33_650M_UR50D)**Protein structure encoder**: foldseek_t30_150M (identical architecture with esm2 except that the vocabulary only contains 3Di tokens)**Text encoder**: [BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext](https://huggingface.co/microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext)<!--### Direct Usage (Transformers)42 unmodified lines- Tokenizers: 0.21.2## Citation```@article{su2024protrek,title={ProTrek: Navigating the Protein Universe through Tri-Modal Contrastive Learning},author={Su, Jin and Zhou, Xibin and Zhang, Xuting and Yuan, Fajie},journal={bioRxiv},pages={2024--05},year={2024},publisher={Cold Spring Harbor Laboratory}}```<!--## Glossary
README.md+46-26