Instructions to use Synthyra/ESM2-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Synthyra/ESM2-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="Synthyra/ESM2-3B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("Synthyra/ESM2-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -82,6 +82,24 @@ with torch.no_grad():
|
|
| 82 |
print(logits.shape) # (2, 11, 33)
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
### For working with attention maps
|
| 86 |
```python
|
| 87 |
import torch
|
|
@@ -193,4 +211,4 @@ Note:
|
|
| 193 |
booktitle={Advances in Neural Information Processing Systems 32},
|
| 194 |
year={2019}
|
| 195 |
}
|
| 196 |
-
```
|
|
|
|
| 82 |
print(logits.shape) # (2, 11, 33)
|
| 83 |
```
|
| 84 |
|
| 85 |
+
### Experimental test-time training
|
| 86 |
+
|
| 87 |
+
TTT is disabled by default. Normal inference, embeddings, logits, and
|
| 88 |
+
`state_dict()` keys are unchanged unless you explicitly call `model.ttt(...)`.
|
| 89 |
+
The current implementation is experimental and trains only local LoRA adapters
|
| 90 |
+
on the ESM2 backbone using masked language modeling on the test protein. It can
|
| 91 |
+
help difficult proteins, but it adds test-time compute and can hurt already
|
| 92 |
+
confident predictions.
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
metrics = model.ttt(
|
| 96 |
+
seq="MSTNPKPQRKTKRNT",
|
| 97 |
+
ttt_config={"steps": 3, "ags": 1, "batch_size": 1},
|
| 98 |
+
)
|
| 99 |
+
model.ttt_reset()
|
| 100 |
+
print(metrics["losses"])
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
### For working with attention maps
|
| 104 |
```python
|
| 105 |
import torch
|
|
|
|
| 211 |
booktitle={Advances in Neural Information Processing Systems 32},
|
| 212 |
year={2019}
|
| 213 |
}
|
| 214 |
+
```
|