-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path3utr_model.py
More file actions
32 lines (23 loc) · 837 Bytes
/
3utr_model.py
File metadata and controls
32 lines (23 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""In this example we compute embedding and run masked inference
on Ginkgo's 3'UTR language model."""
from ginkgo_ai_client import (
GinkgoAIClient,
MaskedInferenceQuery,
MeanEmbeddingQuery,
)
client = GinkgoAIClient()
model = "ginkgo-maskedlm-3utr-v1"
# SIMPLE QUERY FOR EMBEDDING COMPUTATION
query = MeanEmbeddingQuery(sequence="ATTGCG", model=model)
prediction = client.send_request(query)
# prediction.embedding == [1.05, -2.34, ...]
# SIMPLE QUERY FOR MASKED INFERENCE
query = MaskedInferenceQuery(sequence="ATT<mask>TAC", model=model)
prediction = client.send_request(query)
# BATCH REQUEST
queries = [
MeanEmbeddingQuery(sequence=sequence, model=model)
for sequence in ["AGCGC", "ATTGCG", "TACCGCA"]
]
predictions = client.send_batch_request(queries)
# predictions[0].embedding == [1.05, -2.34, ...]