Instructions to use MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| from transformers import PretrainedConfig | |
| from transformers.utils import logging | |
| from transformers.models.esm import EsmConfig | |
| logger = logging.get_logger(__name__) | |
| class ProtSTConfig(PretrainedConfig): | |
| r""" | |
| This is the configuration class to store the configuration of a [`ProtSTModel`]. | |
| Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the | |
| documentation from [`PretrainedConfig`] for more information. | |
| Args: | |
| protein_config (`dict`, *optional*): | |
| Dictionary of configuration options used to initialize [`EsmForProteinRepresentation`]. | |
| ```""" | |
| model_type = "protst" | |
| def __init__( | |
| self, | |
| protein_config=None, | |
| **kwargs, | |
| ): | |
| super().__init__(**kwargs) | |
| if protein_config is None: | |
| protein_config = {} | |
| logger.info("`protein_config` is `None`. Initializing the `ProtSTProteinConfig` with default values.") | |
| self.protein_config = EsmConfig(**protein_config) | |
| def from_protein_text_configs( | |
| cls, protein_config: EsmConfig, **kwargs | |
| ): | |
| r""" | |
| Instantiate a [`ProtSTConfig`] (or a derived class) from ProtST text model configuration. Returns: | |
| [`ProtSTConfig`]: An instance of a configuration object | |
| """ | |
| return cls(protein_config=protein_config.to_dict(), **kwargs) |