-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed.py
More file actions
28 lines (23 loc) · 966 Bytes
/
embed.py
File metadata and controls
28 lines (23 loc) · 966 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
from biocentral_api import BiocentralAPI, CommonEmbedder
biocentral_api = BiocentralAPI()
# Optional: Ensure service availability
biocentral_api = biocentral_api.wait_until_healthy(max_wait_seconds=30)
# OHE
embedder_name = CommonEmbedder.ONE_HOT_ENCODING
reduce = True
sequence_data = {"Seq1": "MMALSLALM",
"Seq2": "PRTEIN",
"Seq3": "PRT",
"Seq4": "SEQWENCE",
"Seq5": "MMPRTEINSEQWENCE",
}
result = biocentral_api.embed(embedder_name=embedder_name, reduce=reduce, sequence_data=sequence_data,
use_half_precision=False).run()
print(result.to_dict())
# ProtT5
embedder_name = CommonEmbedder.ProtT5
result = biocentral_api.embed(embedder_name=embedder_name, reduce=reduce, sequence_data=sequence_data,
use_half_precision=False).run_with_progress()
print(result["Seq1"])
result.save("local_path.h5")
print(result.to_dict())