Instructions to use Synthyra/ESMplusplus_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Synthyra/ESMplusplus_large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="Synthyra/ESMplusplus_large", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("Synthyra/ESMplusplus_large", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Upload modeling_esm_plusplus.py with huggingface_hub
Browse files- modeling_esm_plusplus.py +1 -2
modeling_esm_plusplus.py
CHANGED
|
@@ -597,7 +597,7 @@ class ProteinDataset(TorchDataset):
|
|
| 597 |
def build_collator(tokenizer) -> Callable[[list[str]], tuple[torch.Tensor, torch.Tensor]]:
|
| 598 |
def _collate_fn(sequences: list[str]) -> tuple[torch.Tensor, torch.Tensor]:
|
| 599 |
"""Collate function for batching sequences."""
|
| 600 |
-
return tokenizer(sequences, return_tensors="pt", padding='longest'
|
| 601 |
return _collate_fn
|
| 602 |
|
| 603 |
|
|
@@ -755,7 +755,6 @@ class EmbeddingMixin:
|
|
| 755 |
|
| 756 |
return embeddings_dict
|
| 757 |
|
| 758 |
-
|
| 759 |
class PreTrainedESMplusplusModel(PreTrainedModel):
|
| 760 |
"""
|
| 761 |
init weights for ESM++ models
|
|
|
|
| 597 |
def build_collator(tokenizer) -> Callable[[list[str]], tuple[torch.Tensor, torch.Tensor]]:
|
| 598 |
def _collate_fn(sequences: list[str]) -> tuple[torch.Tensor, torch.Tensor]:
|
| 599 |
"""Collate function for batching sequences."""
|
| 600 |
+
return tokenizer(sequences, return_tensors="pt", padding='longest')
|
| 601 |
return _collate_fn
|
| 602 |
|
| 603 |
|
|
|
|
| 755 |
|
| 756 |
return embeddings_dict
|
| 757 |
|
|
|
|
| 758 |
class PreTrainedESMplusplusModel(PreTrainedModel):
|
| 759 |
"""
|
| 760 |
init weights for ESM++ models
|