Token Classification
Transformers
Safetensors
big_bird
fill-mask
CodonTransformer
Computational Biology
Machine Learning
Bioinformatics
Synthetic Biology
Instructions to use adibvafa/CodonTransformer-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use adibvafa/CodonTransformer-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="adibvafa/CodonTransformer-base")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("adibvafa/CodonTransformer-base") model = AutoModelForMaskedLM.from_pretrained("adibvafa/CodonTransformer-base") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -38,12 +38,12 @@ import torch
|
|
| 38 |
from transformers import AutoTokenizer, BigBirdForMaskedLM
|
| 39 |
from CodonTransformer.CodonPrediction import predict_dna_sequence
|
| 40 |
from CodonTransformer.CodonJupyter import format_model_output
|
| 41 |
-
|
| 42 |
|
| 43 |
|
| 44 |
# Load model and tokenizer
|
| 45 |
tokenizer = AutoTokenizer.from_pretrained("adibvafa/CodonTransformer")
|
| 46 |
-
model = BigBirdForMaskedLM.from_pretrained("adibvafa/CodonTransformer-base").to(
|
| 47 |
|
| 48 |
|
| 49 |
# Set your input data
|
|
@@ -55,10 +55,11 @@ organism = "Escherichia coli general"
|
|
| 55 |
output = predict_dna_sequence(
|
| 56 |
protein=protein,
|
| 57 |
organism=organism,
|
| 58 |
-
device=
|
| 59 |
tokenizer=tokenizer,
|
| 60 |
model=model,
|
| 61 |
attention_type="original_full",
|
|
|
|
| 62 |
)
|
| 63 |
print(format_model_output(output))
|
| 64 |
```
|
|
|
|
| 38 |
from transformers import AutoTokenizer, BigBirdForMaskedLM
|
| 39 |
from CodonTransformer.CodonPrediction import predict_dna_sequence
|
| 40 |
from CodonTransformer.CodonJupyter import format_model_output
|
| 41 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 42 |
|
| 43 |
|
| 44 |
# Load model and tokenizer
|
| 45 |
tokenizer = AutoTokenizer.from_pretrained("adibvafa/CodonTransformer")
|
| 46 |
+
model = BigBirdForMaskedLM.from_pretrained("adibvafa/CodonTransformer-base").to(device)
|
| 47 |
|
| 48 |
|
| 49 |
# Set your input data
|
|
|
|
| 55 |
output = predict_dna_sequence(
|
| 56 |
protein=protein,
|
| 57 |
organism=organism,
|
| 58 |
+
device=device,
|
| 59 |
tokenizer=tokenizer,
|
| 60 |
model=model,
|
| 61 |
attention_type="original_full",
|
| 62 |
+
deterministic=True
|
| 63 |
)
|
| 64 |
print(format_model_output(output))
|
| 65 |
```
|