93 void Run(std::string_view sequence,
const std::function<
void(int64_t,
const std::vector<float>&, int64_t)>& on_layer);
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:248
A masked language model: token embeddings (with ESM's token-dropout scaling, when the config has it),...
Definition encoder_lm.hpp:109
A tokenizer: added tokens are split out of the raw text first (longest match, earliest first); each r...
Definition text_tokenizer.hpp:166
Masked-language-model encoders: ESM-2 protein language models (PLM-2), Hugging Face EsmForMaskedLM ch...
Definition acquisition_functions.hpp:16
ContactEvaluation EvaluateContacts(const ContactMap &predicted, const ContactMap &truth)
ContactPrecisions PrecisionAtL(const ContactMap &predicted, const ContactMap &truth, SeparationRange range)
constexpr SeparationRange kLongRange
Definition protein_contacts.hpp:110
constexpr SeparationRange kMediumRange
Definition protein_contacts.hpp:109
EsmContactHead LoadEsmContactHead(const std::string &directory, const EncoderLMConfig &config)
Reads the contact head from an ESM-2 checkpoint directory: esm.contact_head.regression....
ContactMap ContactFeatures(const float *attention, int64_t tokens)
One head's contact features from its attention map over <cls>, L residues and <eos> (tokens x tokens,...
std::vector< HeadPrecision > RankContactHeads(ContactPredictor &predictor, const std::vector< LabeledProtein > &proteins, SeparationRange range=kLongRange)
Every head, best first, by its features' mean precision at L in range over proteins....
double ContactPrecision(const ContactMap &predicted, const ContactMap &truth, SeparationRange range, int64_t top)
The fraction of the top highest-scoring pairs in range that are true contacts.
constexpr SeparationRange kShortRange
CASP's and ESM's ranges: short 6–11, medium 12–23, long 24 and up.
Definition protein_contacts.hpp:108
Protein structures (PLM-4): PDB and mmCIF coordinates, residue distances and true contacts,...
One attention head: layer from 0, head within it from 0.
Definition protein_contacts.hpp:21
int64_t layer
Definition protein_contacts.hpp:22
int64_t head
Definition protein_contacts.hpp:23
The settings of a masked LM, from its Hugging Face config.json.
Definition encoder_lm.hpp:35
Definition protein_contacts.hpp:146
double precision
the mean over the proteins
Definition protein_contacts.hpp:148
AttentionHead head
Definition protein_contacts.hpp:147
A protein with known contacts, to choose heads with.
Definition protein_contacts.hpp:141
ContactMap contacts
TrueContacts, L x L for the sequence's L residues.
Definition protein_contacts.hpp:143
std::string sequence
Definition protein_contacts.hpp:142
Pairs (i, j) counted by separation j - i: at least min, and under max unless max is 0.
Definition protein_contacts.hpp:103
int64_t min
Definition protein_contacts.hpp:104
int64_t max
Definition protein_contacts.hpp:105
The tokenizer interface (TOK-1): a pipeline of normalizer, pre-tokenizer, model, post-processor and d...