Instructions to use Synthyra/DPLM-650M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Synthyra/DPLM-650M with Transformers:
# Load model directly from transformers import EsmForDPLM model = EsmForDPLM.from_pretrained("Synthyra/DPLM-650M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Upload modeling_dplm.py with huggingface_hub
Browse files- modeling_dplm.py +3 -3
modeling_dplm.py
CHANGED
|
@@ -367,9 +367,9 @@ import torch
|
|
| 367 |
import torch.nn as nn
|
| 368 |
from torch.nn import functional as F
|
| 369 |
from dataclasses import dataclass
|
| 370 |
-
from typing import
|
| 371 |
|
| 372 |
-
from transformers import
|
| 373 |
from transformers.modeling_outputs import (
|
| 374 |
BaseModelOutputWithPastAndCrossAttentions,
|
| 375 |
BaseModelOutputWithPoolingAndCrossAttentions,
|
|
@@ -1056,7 +1056,7 @@ class DPLMForMaskedLM(DPLMPreTrainedModel, EmbeddingMixin):
|
|
| 1056 |
self.tokenizer = self.__class__.tokenizer
|
| 1057 |
if isinstance(config._name_or_path, str) and len(config._name_or_path) > 0:
|
| 1058 |
try:
|
| 1059 |
-
self.tokenizer =
|
| 1060 |
except Exception:
|
| 1061 |
self.tokenizer = self.__class__.tokenizer
|
| 1062 |
|
|
|
|
| 367 |
import torch.nn as nn
|
| 368 |
from torch.nn import functional as F
|
| 369 |
from dataclasses import dataclass
|
| 370 |
+
from typing import List, Optional, Tuple, Union
|
| 371 |
|
| 372 |
+
from transformers import EsmTokenizer
|
| 373 |
from transformers.modeling_outputs import (
|
| 374 |
BaseModelOutputWithPastAndCrossAttentions,
|
| 375 |
BaseModelOutputWithPoolingAndCrossAttentions,
|
|
|
|
| 1056 |
self.tokenizer = self.__class__.tokenizer
|
| 1057 |
if isinstance(config._name_or_path, str) and len(config._name_or_path) > 0:
|
| 1058 |
try:
|
| 1059 |
+
self.tokenizer = EsmTokenizer.from_pretrained(config._name_or_path)
|
| 1060 |
except Exception:
|
| 1061 |
self.tokenizer = self.__class__.tokenizer
|
| 1062 |
|