Instructions to use ronig/protein_biencoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ronig/protein_biencoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ronig/protein_biencoder", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("ronig/protein_biencoder", trust_remote_code=True) model = AutoModel.from_pretrained("ronig/protein_biencoder", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| language: en | |
| license: mit | |
| datasets: | |
| - ronig/protein_binding_sequences | |
| ## Peptriever: A Bi-Encoder for large-scale protein-peptide binding search | |
| For training details see our [Application Note](https://www.biorxiv.org/content/10.1101/2023.07.13.548811v1). | |
| Training code can be found in our [Github repo](https://github.com/RoniGurvich/Peptriever). | |
| A live demo is available on our [application page](https://peptriever.app) | |
| ## Usage | |
| ```python | |
| import torch | |
| from transformers import AutoModel, AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained("ronig/protein_biencoder") | |
| model = AutoModel.from_pretrained("ronig/protein_biencoder", trust_remote_code=True) | |
| model.eval() | |
| peptide_sequence = "AAA" | |
| protein_sequence = "MMM" | |
| encoded_peptide = tokenizer.encode_plus(peptide_sequence, return_tensors='pt') | |
| encoded_protein = tokenizer.encode_plus(protein_sequence, return_tensors='pt') | |
| with torch.no_grad(): | |
| peptide_output = model.forward1(encoded_peptide) | |
| protein_output = model.forward2(encoded_protein) | |
| print("distance: ", torch.norm(peptide_output - protein_output, p=2)) | |
| ``` | |
| ## Version | |
| Model checkpint: `peptriever_2023-06-23T16:07:24.508460` |