Skip to main content

Module pretrained

Module pretrained 

Source
Expand description

ESMC pretrained model loading.

Downloads weights from biohub/ESMC-{300M,600M,6B} on HuggingFace and wraps the ESMC model for sequence embedding.

§Weight key layout (biohub/ESMC-* safetensors)

The weights are saved from ESMCForMaskedLM, a HuggingFace wrapper that nests the backbone under an esmc attribute. All backbone keys are therefore prefixed with esmc.:

Python (HF safetensors key)Rust VarBuilder path
esmc.embed.weightembed.weight
esmc.transformer.blocks.{i}.attn.layernorm_qkv.0.*transformer.blocks.{i}.attn.layernorm_qkv.0.*
esmc.transformer.blocks.{i}.attn.layernorm_qkv.1.*transformer.blocks.{i}.attn.layernorm_qkv.1.*
esmc.transformer.blocks.{i}.attn.out_proj.weighttransformer.blocks.{i}.attn.out_proj.weight
esmc.transformer.blocks.{i}.attn.q_ln.weighttransformer.blocks.{i}.attn.q_ln.weight
esmc.transformer.blocks.{i}.attn.k_ln.weighttransformer.blocks.{i}.attn.k_ln.weight
esmc.transformer.blocks.{i}.attn.rotary.*transformer.blocks.{i}.attn.rotary.*
esmc.transformer.blocks.{i}.ffn.0.*transformer.blocks.{i}.ffn.0.*
esmc.transformer.blocks.{i}.ffn.1.weighttransformer.blocks.{i}.ffn.1.weight
esmc.transformer.blocks.{i}.ffn.3.weighttransformer.blocks.{i}.ffn.3.weight
esmc.transformer.norm.weighttransformer.norm.weight
esmc.sequence_head.0.weight/biassequence_head.0.weight/bias
esmc.sequence_head.2.weightsequence_head.2.weight
esmc.sequence_head.3.weight/biassequence_head.3.weight/bias

The from_pretrained loader auto-detects whether the esmc. prefix is present and sets the VarBuilder root accordingly, so the same Rust model code works against both the wrapped and unwrapped formats.

Structs§

ESMCRunner
Wraps a loaded ESMC model for sequence embedding inference.

Enums§

ESMCModels
Available ESMC model variants hosted on HuggingFace.