Transformers
Safetensors
English
esmfold2
biology
esm
protein
protein-structure-prediction
structure-prediction
protein-design
3d-structure
confidence-estimation
molecular-dynamics
custom_code
Run this model with HF Jobs
Run biohub/ESMFold2-Fast on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/biohub/ESMFold2-Fast. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/biohub/ESMFold2-Fast on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use biohub/ESMFold2-Fast with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use biohub/ESMFold2-Fast with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("biohub/ESMFold2-Fast", trust_remote_code=True) model = AutoModel.from_pretrained("biohub/ESMFold2-Fast", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse filesFiles changed (11)
- config.json+309-84
- model-00001-of-00006.safetensorsAdded+3
- model-00002-of-00006.safetensorsAdded+3
- model-00003-of-00006.safetensorsAdded+3
- model-00004-of-00006.safetensorsAdded+3
- model-00005-of-00006.safetensorsAdded+3
- model-00006-of-00006.safetensorsAdded+3
- model.safetensors.index.jsonAdded
- modeling_esmfold2_remote.pyAdded+80
- tokenizer.jsonAdded+167
- tokenizer_config.jsonAdded+13
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105{"architectures": ["ESMFold2Model"],"confidence_head": {"distogram_bins": 39,"enabled": true,"folding_trunk": {"dropout": 0.25,"n_heads": 8,"n_layers": 4},"max_dist": 50.75,"min_dist": 3.25,"num_pae_bins": 64,"num_pde_bins": 64,"num_plddt_bins": 50},"d_pair": 256,"d_single": 384,"disable_msa_features": false,"dtype": "float32","esmc_id": "biohub/ESMC-6B","folding_trunk": {"dropout": 0.25,"n_heads": 8,"n_layers": 24},"force_lm_dropout_during_inference": false,"inputs": {"atom_encoder": {"d_atom": 128,"d_token": 768,"expansion_ratio": 2,"n_blocks": 3,"n_heads": 4,"n_spatial_rope_pairs_per_axis": 2,"n_uid_rope_pairs": 10,"spatial_rope_base_frequency": 20.0,"swa_window_size": 128,"uid_rope_base_frequency": 10000.0},"d_inputs": 451},"lm_d_model": 2560,"lm_dropout": 0.0,"lm_encoder": {"enabled": true,"lm_dropout": 0.25,"n_layers": 4,"per_loop_lm_dropout": true},"lm_num_layers": 80,"model_type": "esmfold2","msa_encoder": {"d_hidden": 32,"d_msa": 128,"enabled": false,"msa_head_width": 32,"n_heads_msa": 8,"n_layers": 4},"msa_encoder_overwrite": true,"n_relative_chain_bins": 2,"n_relative_residx_bins": 32,"num_diffusion_samples": 32,"num_loops": 3,"parcae": {"coda_n_layers": 2,"enabled": true,"max_steps": 6,"min_steps": 1,"poisson_mean": 3.0},"structure_head": {"diffusion_module": {"atom_num_blocks": 3,"atom_num_heads": 4,"c_atom": 128,"c_s_inputs": 451,"c_token": 768,"c_z": 256,"fourier_dim": 256,"relpos_r_max": 32,"relpos_s_max": 2,"sigma_data": 16.0,"token_num_blocks": 12,"token_num_heads": 16,"transition_multiplier": 2},"distogram_bins": 64,"gamma_0": 0.8,"gamma_min": 1.0,"inference_num_steps": 14,"inference_p": 7.0,"inference_s_max": 160.0,"inference_s_min": 0.0004,"noise_scale": 1.003,"step_scale": 1.5,"train_noise_log_mean": -1.2,"train_noise_log_std": 1.5},"transformers_version": "4.57.6","type": "release"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330{"transformers_version": "5.16.0.dev0","architectures": ["EsmFold2Model"],"output_hidden_states": false,"return_dict": true,"dtype": "float32","chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"hidden_size": 384,"pairwise_hidden_size": 256,"single_inputs_size": 451,"pair_transition_intermediate_size": 1024,"sliding_window": 128,"chunk_size": 64,"num_relative_residx_bins": 32,"num_relative_chain_bins": 2,"num_loops": 20,"num_res_types": 33,"max_atomic_number": 128,"char_vocab_size": 64,"max_chars": 4,"max_atoms_per_token": 23,"atom_feature_dim": 389,"folding_trunk_num_hidden_layers": 24,"parcae_num_coda_layers": 2,"atom_encoder": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"hidden_size": 128,"output_dim": 384,"num_hidden_layers": 3,"num_attention_heads": 4,"head_dim": 32,"intermediate_size": 256,"spatial_rope_base_frequency": 20.0,"num_spatial_rope_pairs_per_axis": 2,"num_uid_rope_pairs": 10,"uid_rope_base_frequency": 10000.0,"_name_or_path": "","model_type": "","output_attentions": false,"n_spatial_rope_pairs_per_axis": 2,"n_uid_rope_pairs": 10,"expansion_ratio": 2,"token_hidden_size": 768},"structure_head": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"diffusion_module": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"sigma_data": 16.0,"hidden_size": 768,"fourier_dim": 256,"num_hidden_layers": 12,"num_attention_heads": 16,"head_dim": 48,"intermediate_size": 1536,"pair_intermediate_size": 512,"atom_encoder": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"hidden_size": 128,"output_dim": 768,"num_hidden_layers": 3,"num_attention_heads": 4,"head_dim": 32,"intermediate_size": 256,"spatial_rope_base_frequency": 20.0,"num_spatial_rope_pairs_per_axis": 2,"num_uid_rope_pairs": 10,"uid_rope_base_frequency": 10000.0,"_name_or_path": "","model_type": "","output_attentions": false},"_name_or_path": "","model_type": "","output_attentions": false,"token_hidden_size": 768,"token_num_blocks": 12,"token_num_heads": 16,"transition_multiplier": 2,"c_z": 256,"c_s_inputs": 451,"relpos_r_max": 32,"relpos_s_max": 2},"num_distogram_bins": 64,"num_diffusion_samples": 32,"gamma_0": 0.8,"gamma_min": 1.0,"noise_scale": 1.003,"step_scale": 1.5,"inference_sigma_max_ratio": 160.0,"inference_sigma_min_ratio": 0.0004,"inference_exponent": 7.0,"inference_num_steps": 14,"inference_sigma_cap": 256.0,"_name_or_path": "","model_type": "","output_attentions": false,"distogram_bins": 64,"inference_s_max": 160.0,"inference_s_min": 0.0004,"inference_p": 7.0,"train_noise_log_mean": -1.2,"train_noise_log_std": 1.5},"confidence_head": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"num_hidden_layers": 4,"num_plddt_bins": 50,"num_pde_bins": 64,"num_pae_bins": 64,"min_dist": 3.25,"max_dist": 50.75,"distogram_bins": 39,"eps": 1e-06,"_name_or_path": "","model_type": "","output_attentions": false,"enabled": true,"num_attention_heads": 8,"dropout": 0.25},"msa_encoder": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"hidden_size": 128,"outer_hidden_size": 32,"num_hidden_layers": 4,"num_attention_heads": 8,"head_dim": 32,"intermediate_size": 512,"outer_product_chunk_size": null,"_name_or_path": "","model_type": "","output_attentions": false,"head_width": 32,"enabled": false,"overwrite": true,"max_depth": 1024,"column_mask_rate": 0.1},"lm_encoder": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": null,"chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"num_hidden_layers": 4,"lm_dropout": 0.25,"per_loop_lm_dropout": true,"_name_or_path": "","model_type": "","output_attentions": false,"enabled": true},"esmc_config": {"architectures": null,"output_hidden_states": false,"return_dict": true,"dtype": "float32","chunk_size_feed_forward": 0,"is_encoder_decoder": false,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"label2id": {"LABEL_0": 0,"LABEL_1": 1},"problem_type": null,"vocab_size": 64,"hidden_size": 2560,"intermediate_size": 6912,"num_hidden_layers": 80,"num_attention_heads": 40,"num_key_value_heads": 40,"hidden_act": "silu","max_position_embeddings": 2048,"initializer_range": 0.02,"pad_token_id": 1,"bos_token_id": 0,"eos_token_id": 2,"tie_word_embeddings": false,"rope_parameters": {"rope_theta": 10000.0,"rope_type": "default"},"attention_bias": false,"attention_dropout": 0.0,"mlp_bias": false,"head_dim": 64,"mask_token_id": 32,"classifier_dropout": 0.1,"_name_or_path": "","model_type": "esmc","output_attentions": false},"_name_or_path": "","model_type": "esmfold2","output_attentions": false,"n_relative_residx_bins": 32,"n_relative_chain_bins": 2,"type": "release","folding_trunk_num_attention_heads": 8,"folding_trunk_dropout": 0.25,"disable_msa_features": true,"lm_dropout": 0.0,"force_lm_dropout_during_inference": false,"lm_d_model": 2560,"lm_num_layers": 80,"lm_mask_pct": 0.0,"num_diffusion_samples": 32,"parcae": {"enabled": true,"poisson_mean": 3.0,"min_steps": 1,"max_steps": 6,"coda_n_layers": 2},"auto_map": {"AutoConfig": "modeling_esmfold2_remote.EsmFold2RemoteConfig","AutoModel": "modeling_esmfold2_remote.EsmFold2RemoteModel"}}
123version https://git-lfs.github.com/spec/v1oid sha256:2bbc3d3b6d48dd39a698ef5bf8f1bea659ce8b19f4444145503a4785af962618size 4983974660123version https://git-lfs.github.com/spec/v1oid sha256:999157d7d20926c54f2ee02c4ee7e46eddc16bbf8963850e6b59d718b36afa59size 4997408792123version https://git-lfs.github.com/spec/v1oid sha256:d8a3d8121d4c0d41d9fdac2b7d093048a7d54b569840f6f639eb060e7ebd9211size 4979069192123version https://git-lfs.github.com/spec/v1oid sha256:f28625f5d104e7ce0fafbdb2eacedb53c4e5fbfb2fb080f26995e81f0858348bsize 4934556472123version https://git-lfs.github.com/spec/v1oid sha256:2e15b21fcedab793eebc39301bb608765023824a54a5dc6b748b6e7e0d946203size 4997460576123version https://git-lfs.github.com/spec/v1oid sha256:34fc8868f3af8a0bf3e624996eb451906054889b3e7247b03c5ac2f9f838d8dasize 12427933521234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980"""Load this checkpoint with the ``esm`` package instead of the transformers port.
Shipped inside each ``biohub/ESMFold2*`` repo and named by its ``config.json````auto_map``, so ``AutoModel.from_pretrained(repo, trust_remote_code=True)``returns an ``esm.models.esmfold2`` model. Without the flag transformers keepsusing its own port.
Runs from the Hub module cache in the user's environment, so it imports nothingbut ``transformers``, ``packaging`` and ``esm``."""
from typing import Any
from packaging.version import Versionfrom transformers.configuration_utils import PretrainedConfigfrom transformers.modeling_utils import PreTrainedModel
#: Inclusive floor. Older esm cannot read the bundled single-checkpoint layout.MIN_ESM_VERSION = "3.4.1"
#: Everything esm's from_pretrained consumes, directly or via resolve_model_dir._ESM_KWARGS = frozenset( { "load_esmc", "esmc_precision", "device", "dtype", "revision", "cache_dir", "token", "local_files_only", "force_download", })
def esmfold2_class() -> Any: """Return esm's ``EsmFold2Model``, or raise ``ImportError`` naming the pip command.""" try: import esm from esm.models.esmfold2 import EsmFold2Model except ImportError as exc: raise ImportError( f"trust_remote_code=True runs the esm package, which failed to " f"import ({exc}). Install it with:\n\n" f" pip install 'esm>={MIN_ESM_VERSION}'\n\n" "Or drop the flag to use the ESMFold2 port in transformers." ) from exc if Version(esm.__version__) < Version(MIN_ESM_VERSION): raise ImportError( f"esm {esm.__version__} is installed, but this checkpoint needs " f"{MIN_ESM_VERSION} or newer. Upgrade with:\n\n" f" pip install --upgrade 'esm>={MIN_ESM_VERSION}'" ) return EsmFold2Model
class EsmFold2RemoteConfig(PretrainedConfig): """Holds config.json verbatim. esm re-reads the file and builds its own config."""
model_type = "esmfold2"
class EsmFold2RemoteModel(PreTrainedModel): """Loader shim; ``from_pretrained`` returns an esm model, not one of these.
A ``PreTrainedModel`` subclass only because the Auto classes call ``register_for_auto_class`` on what they load and check its ``config_class``. """
config_class = EsmFold2RemoteConfig
@classmethod def from_pretrained(cls, pretrained_model_name_or_path, *args, **kwargs): # type: ignore[override] # esm forwards leftover kwargs to resolve_model_dir, whose signature is # fixed, so transformers' trust_remote_code / _from_auto would TypeError. forwarded = {k: v for k, v in kwargs.items() if k in _ESM_KWARGS} return esmfold2_class().from_pretrained( pretrained_model_name_or_path, *args, **forwarded )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167{ "version": "1.0", "truncation": null, "padding": null, "added_tokens": [ { "id": 0, "content": "<cls>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, { "id": 1, "content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, { "id": 2, "content": "<eos>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, { "id": 3, "content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, { "id": 31, "content": "|", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, { "id": 32, "content": "<mask>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true } ], "normalizer": null, "pre_tokenizer": null, "post_processor": { "type": "TemplateProcessing", "single": [ { "SpecialToken": { "id": "<cls>", "type_id": 0 } }, { "Sequence": { "id": "A", "type_id": 0 } }, { "SpecialToken": { "id": "<eos>", "type_id": 0 } } ], "pair": [ { "Sequence": { "id": "A", "type_id": 0 } }, { "Sequence": { "id": "B", "type_id": 1 } } ], "special_tokens": { "<cls>": { "id": "<cls>", "ids": [ 0 ], "tokens": [ "<cls>" ] }, "<eos>": { "id": "<eos>", "ids": [ 2 ], "tokens": [ "<eos>" ] } } }, "decoder": null, "model": { "type": "BPE", "dropout": null, "unk_token": "<unk>", "continuing_subword_prefix": null, "end_of_word_suffix": null, "fuse_unk": false, "byte_fallback": false, "ignore_merges": false, "vocab": { "<cls>": 0, "<pad>": 1, "<eos>": 2, "<unk>": 3, "L": 4, "A": 5, "G": 6, "V": 7, "S": 8, "E": 9, "R": 10, "T": 11, "I": 12, "D": 13, "P": 14, "K": 15, "Q": 16, "N": 17, "F": 18, "Y": 19, "M": 20, "H": 21, "W": 22, "C": 23, "X": 24, "B": 25, "U": 26, "Z": 27, "O": 28, ".": 29, "-": 30, "|": 31, "<mask>": 32 }, "merges": [] }}12345678910111213{ "backend": "tokenizers", "bos_token": "<cls>", "chain_break_token": "|", "cls_token": "<cls>", "eos_token": "<eos>", "extra_special_tokens": [], "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "pad_token": "<pad>", "tokenizer_class": "EsmcTokenizer", "unk_token": "<unk>"}config.json+309-84
model-00001-of-00006.safetensorsAdded+3
model-00002-of-00006.safetensorsAdded+3
model-00003-of-00006.safetensorsAdded+3
model-00004-of-00006.safetensorsAdded+3
model-00005-of-00006.safetensorsAdded+3
model-00006-of-00006.safetensorsAdded+3
model.safetensors.index.jsonAdded
modeling_esmfold2_remote.pyAdded+80
tokenizer.jsonAdded+167
tokenizer_config.jsonAdded+13