Repository navigation
can not use ESMFold2-Fast #422
Description
my code:
test.py
model path:
(esmfold2) root@autodl-container-828249b609-4467efa9:/autodl-tmp/HF_model/hub# cd models--biohub--ESMFold2-Fast//autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast# ls
(esmfold2) root@autodl-container-828249b609-4467efa9:
blobs refs snapshots trees
(esmfold2) root@autodl-container-828249b609-4467efa9:/autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast# cd snapshots//autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots# ls
(esmfold2) root@autodl-container-828249b609-4467efa9:
45fe8656f5b3ef493c17fcf9abe9a2968902e712
(esmfold2) root@autodl-container-828249b609-4467efa9:/autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots# cd 45fe8656f5b3ef493c17fcf9abe9a2968902e712//autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots/45fe8656f5b3ef493c17fcf9abe9a2968902e712# ls
(esmfold2) root@autodl-container-828249b609-4467efa9:
README.md images model-00002-of-00006.safetensors model-00004-of-00006.safetensors model-00006-of-00006.safetensors modeling_esmfold2_remote.py tokenizer_config.json
config.json model-00001-of-00006.safetensors model-00003-of-00006.safetensors model-00005-of-00006.safetensors model.safetensors.index.json tokenizer.json
ERROR:
(esmfold2) root@autodl-container-828249b609-4467efa9:~/autodl-tmp/ESMFold2# python test.py
Loading local model...
Loading weights: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2096/2096 [00:08<00:00, 244.92it/s]
[transformers] EsmFold2Model LOAD REPORT from: /root/autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots/45fe8656f5b3ef493c17fcf9abe9a2968902e712
Key | Status | Details
----------------------------------------------------------------------------+---------+--------
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_emit.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.mlp.gate_up_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_start.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.mlp.down_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_mix.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.o_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.v_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.input_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_start.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_start.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_mix.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_bundle.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.norm_single.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.mlp.down_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_start.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.mlp.gate_up_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_mix.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_bundle.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_emit.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.output_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.norm_single.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_gate.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.output_proj.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_mix.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_gate.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.gate_proj.weight | MISSING |
msa_encoder.project_inputs.weight | MISSING |
msa_encoder.embed.weight | MISSING |
Notes:
- MISSING: those params were newly initialized because missing from the checkpoint. Consider training on your downstream task.
Some parameters are on the meta device because they were offloaded to the cpu.
Model loaded!
Traceback (most recent call last):
File "/root/autodl-tmp/ESMFold2/test.py", line 21, in
output = model.infer_protein(
^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/transformers/models/esmfold2/generation_esmfold2.py", line 312, in infer_protein
return self.fold(**prepare_protein_features(sequence, device=self.device), **forward_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/transformers/models/esmfold2/generation_esmfold2.py", line 157, in fold
trunk = self(
^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1779, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1790, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/hooks.py", line 192, in new_forward
output = module._old_forward(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/transformers/models/esmfold2/modeling_esmfold2.py", line 2324, in forward
pair_states = self._run_trunk_loops(
^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/transformers/models/esmfold2/modeling_esmfold2.py", line 2182, in _run_trunk_loops
pair_states = self.parcae(pair_states, injected_pair_states, state_decay, input_matrix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1779, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1790, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/hooks.py", line 187, in new_forward
args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/hooks.py", line 50, in wrapper
return wrapper._compiled_fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/torch/_dynamo/eval_frame.py", line 1263, in _fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/hooks.py", line 397, in pre_forward
return send_to_device(args, self.execution_device), send_to_device(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/utils/operations.py", line 176, in send_to_device
return honor_type(
^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/utils/operations.py", line 82, in honor_type
return type(obj)(generator)
^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/utils/operations.py", line 177, in
tensor, (send_to_device(t, device, non_blocking=non_blocking, skip_keys=skip_keys) for t in tensor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/esmfold2/lib/python3.12/site-packages/accelerate/utils/operations.py", line 160, in send_to_device
return tensor.to(device, non_blocking=non_blocking)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NotImplementedError: Cannot copy out of meta tensor; no data!
who can tell me why?
Activity
CharlesDDD commentedon Oct 5, 2026
(esmfold2) root@autodl-container-729d4181f4-ae3b2e81:~/autodl-tmp/ESMFold2# python test.py
Loading weights: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2096/2096 [00:08<00:00, 245.67it/s]
[transformers] EsmFold2Model LOAD REPORT from: /root/autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots/45fe8656f5b3ef493c17fcf9abe9a2968902e712
Key | Status | Details
----------------------------------------------------------------------------+---------+--------
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_mix.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.norm_single.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_start.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.mlp.down_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.mlp.gate_up_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_start.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_emit.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.output_proj.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.output_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_gate.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_bundle.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_mix.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_mix.weight | MISSING |
msa_encoder.embed.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.pair_transition.mlp.gate_up_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_mix.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.norm_start.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.gate_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_bundle.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.norm_single.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.proj_emit.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.bias_norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.input_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_in.norm_start.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.norm.bias | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.tri_mul_out.proj_gate.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.mlp.down_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_transition.norm.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.v_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2}.msa_pair_weighted_averaging.o_proj.weight | MISSING |
msa_encoder.layers.{0, 1, 2, 3}.outer_product_mean.norm.bias | MISSING |
msa_encoder.project_inputs.weight | MISSING |
Notes:
pLDDT mean: 0.820, pTM: 0.774
code:
from transformers.models.esmfold2.modeling_esmfold2 import EsmFold2Model
import torch
Ubiquitin (PDB 1UBQ)
sequence = "MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG"
model_path = ("/root/autodl-tmp/HF_model/hub/models--biohub--ESMFold2-Fast/snapshots/45fe8656f5b3ef493c17fcf9abe9a2968902e712"
)
optionally use "biohub/ESMFold2"
model = EsmFold2Model.from_pretrained(model_path, local_files_only=True)
model = model.to("cuda")
model.eval()
with torch.no_grad():
output = model.infer_protein(sequence, num_loops=3, num_sampling_steps=50)
print(f"pLDDT mean: {float(output['plddt'].mean()):.3f}, pTM: {float(output['ptm'].mean()):.3f}")
It works now after upgrading to more video memory (48GB).
Notes:
Does this MISSING note have any impact?
I re-predicted the same sequence using ESMFold, and the results are: length 76
ptm: 0.829 plddt: 90.469
CPU times: user 9.63 s, sys: 8.79 s, total: 18.4 s
Wall time: 50.3 s
af3 results: ipTM = -
pTM = 0.87