Transformers
Safetensors
t5
text2text-generation
protein-language-model
fastplms
custom_code
text-generation-inference
Instructions to use Synthyra/ANKH3_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Synthyra/ANKH3_large with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Synthyra/ANKH3_large", trust_remote_code=True) model = AutoModelForSeq2SeqLM.from_pretrained("Synthyra/ANKH3_large", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -41,6 +41,31 @@ outputs = model(**inputs)
|
|
| 41 |
embeddings = outputs.last_hidden_state # (batch, seq_len, hidden_dim)
|
| 42 |
```
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
## Batch Embedding
|
| 45 |
|
| 46 |
```python
|
|
|
|
| 41 |
embeddings = outputs.last_hidden_state # (batch, seq_len, hidden_dim)
|
| 42 |
```
|
| 43 |
|
| 44 |
+
## Experimental Test-Time Training
|
| 45 |
+
|
| 46 |
+
TTT is disabled by default. Normal ANKH inference, embeddings, and
|
| 47 |
+
`state_dict()` keys are unchanged unless you explicitly call `model.ttt(...)`.
|
| 48 |
+
The current implementation is experimental and trains only local LoRA adapters
|
| 49 |
+
with masked language modeling on the test protein. ANKH's FastPLMs MaskedLM
|
| 50 |
+
head is encoder-only and not pretrained for standard MLM, so treat TTT results
|
| 51 |
+
with extra caution.
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from transformers import AutoModelForMaskedLM
|
| 55 |
+
|
| 56 |
+
mlm = AutoModelForMaskedLM.from_pretrained(
|
| 57 |
+
"Synthyra/ANKH_base",
|
| 58 |
+
trust_remote_code=True,
|
| 59 |
+
).cuda().eval()
|
| 60 |
+
|
| 61 |
+
metrics = mlm.ttt(
|
| 62 |
+
seq="MSTNPKPQRKTKRNT",
|
| 63 |
+
ttt_config={"steps": 3, "ags": 1, "batch_size": 1},
|
| 64 |
+
)
|
| 65 |
+
mlm.ttt_reset()
|
| 66 |
+
print(metrics["losses"])
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
## Batch Embedding
|
| 70 |
|
| 71 |
```python
|