lhallee commited on
Commit
c5f3bd0
·
verified ·
1 Parent(s): 90425e1

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +4 -4
  2. __init__.py +1 -9
  3. modeling_esmfold2.py +6 -19
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
  library_name: transformers
3
  tags:
4
- - biology
5
- - protein-structure
6
- - esmfold2
7
- - multimodal-protein-model
8
  ---
9
 
10
  # FastPLMs ESMFold2
 
1
  ---
2
  library_name: transformers
3
  tags:
4
+ - biology
5
+ - protein-structure
6
+ - esmfold2
7
+ - multimodal-protein-model
8
  ---
9
 
10
  # FastPLMs ESMFold2
__init__.py CHANGED
@@ -1,12 +1,4 @@
1
- import importlib
2
- import sys
3
-
4
  from .configuration_esmfold2 import ESMFold2Config
5
  from .modeling_esmfold2 import ESMFold2Model
6
 
7
-
8
- def ensure_vendored_esm() -> None:
9
- sys.modules["esm"] = importlib.import_module(f"{__name__}.esm")
10
-
11
-
12
- __all__ = ["ESMFold2Config", "ESMFold2Model", "ensure_vendored_esm"]
 
 
 
 
1
  from .configuration_esmfold2 import ESMFold2Config
2
  from .modeling_esmfold2 import ESMFold2Model
3
 
4
+ __all__ = ["ESMFold2Config", "ESMFold2Model"]
 
 
 
 
 
modeling_esmfold2.py CHANGED
@@ -7,13 +7,12 @@ Quickstart::
7
  model = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval()
8
  open("ubq.pdb", "w").write(model.infer_protein_as_pdb("MQIFVKTLTGKT..."))
9
 
10
- For multi-chain / ligand / MSA inputs see ``ESMFold2InputBuilder`` in the
11
- companion ``esm`` package.
12
  """
13
 
14
  import importlib
15
  import math
16
- import sys
17
  from contextlib import contextmanager
18
  from pathlib import Path
19
  from typing import Any, cast
@@ -102,13 +101,6 @@ _NONPOLYMER_ID = 4
102
  _DEFAULT_CHUNK_SIZE = 64
103
 
104
 
105
- def _ensure_vendored_esm_alias() -> None:
106
- package = __package__
107
- assert package is not None
108
- vendored_esm = importlib.import_module(f"{package}.esm")
109
- sys.modules["esm"] = vendored_esm
110
-
111
-
112
  class PairTransition(nn.Module):
113
  """LayerNorm + SwiGLU feed-forward residual block on the pair representation."""
114
 
@@ -678,15 +670,10 @@ class ESMFold2Model(PreTrainedModel):
678
  pretrained_model_name_or_path, **kwargs
679
  )
680
  if config.type == "experimental":
681
- experimental_module = importlib.import_module(
682
- f"{__package__}.modeling_esmfold2_experimental"
683
- )
684
- return experimental_module.ESMFold2ExperimentalModel.from_pretrained(
685
- pretrained_model_name_or_path,
686
- *args,
687
- config=config,
688
- load_esmc=load_esmc,
689
- **kwargs,
690
  )
691
  kwargs["config"] = config
692
  # Pop the precision knob before forwarding to the HF loader.
 
7
  model = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval()
8
  open("ubq.pdb", "w").write(model.infer_protein_as_pdb("MQIFVKTLTGKT..."))
9
 
10
+ For multi-chain, ligand, and MSA inputs, use ``model.input_types`` together
11
+ with ``model.fold(...)`` or ``model.prepare_structure_input(...)``.
12
  """
13
 
14
  import importlib
15
  import math
 
16
  from contextlib import contextmanager
17
  from pathlib import Path
18
  from typing import Any, cast
 
101
  _DEFAULT_CHUNK_SIZE = 64
102
 
103
 
 
 
 
 
 
 
 
104
  class PairTransition(nn.Module):
105
  """LayerNorm + SwiGLU feed-forward residual block on the pair representation."""
106
 
 
670
  pretrained_model_name_or_path, **kwargs
671
  )
672
  if config.type == "experimental":
673
+ raise ValueError(
674
+ "FastPLMs ESMFold2 supports the released ESMFold2 and "
675
+ "ESMFold2-Fast checkpoints. Experimental ESMFold2 configs "
676
+ "are not part of the self-contained AutoModel package."
 
 
 
 
 
677
  )
678
  kwargs["config"] = config
679
  # Pop the precision knob before forwarding to the HF loader.