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 |
```
|