Skip to content

asymmetric matrix in MSA #19

Description

@chiarinival

Hi!!!

I am trying to run a prediction of Ab-Ag with both MSA and interchain_feat included. mmseq works fine but when I try to run the line

python /nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/predict.py --pid_fpath=/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ab/TFold_$1/$1.txt --fas_dpath=/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/TFold_$1/$1_H_L.fasta --msa_fpath=/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/TFold_$1/target.a3m --icf_dpath=/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/TFold_$1/$1.pt --pdb_dpath=/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/TFold_$1/ --model_ver=ppi > projects/tfold_ag/TFold_$1/log.txt 2>&1

I get this error about inhomogenous array

[2025-04-22 11:41:09,408] [INFO] [real_accelerator.py:158:get_accelerator] Setting ds_accelerator to cuda (auto detect)
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib/python3.9/site-packages/deepspeed/runtime/zero/linear.py:49: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead.
def forward(ctx, input, weight, bias=None):
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib/python3.9/site-packages/deepspeed/runtime/zero/linear.py:67: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead.
def backward(ctx, grad_output):
WARNING:root:using DS4Sci_EvoformerAttention
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/model/module/structure_module.py:90: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead.
@torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)
[04/22 11:41:14 root]: restoring the pre-trained tFold-PPI-SeqPT model ...
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/model/arch/ppi_model.py:59: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state = torch.load(path, map_location='cpu')
[04/22 11:41:24 root]: model weights restored from params/esm_ppi_650m.pth
[04/22 11:41:25 root]: restoring the pre-trained AlphaFold2 model ...
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/deploy/psp_featurizer.py:49: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state = torch.load(path, map_location='cpu')
[04/22 11:44:38 root]: model weights restored from params/alphafold_4_ptm.pth
[04/22 11:44:38 root]: restoring the pre-trained tFold-Ag model ...
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/model/arch/ag_model/model.py:36: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state = torch.load(path, map_location='cpu')
/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/transform/se3.py:33: UserWarning: Using torch.cross without specifying the dim arg is deprecated.
Please either pass the dim explicitly or simply use torch.linalg.cross.
The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at /afs/enea.it/por/user/matfois/public/PeSTo/pytorch/aten/src/ATen/native/Cross.cpp:62.)
e3 = torch.cross(e1, e2)
[04/22 11:45:45 root]: restore the pre-trained tFold-Ag model params/tfold_ag_ppi.pth
[04/22 11:45:57 root]: target antigen feature predicted using pretrained structure prediction model
model:
arch: tfold_ag
docking:
ligand_c_s: 192
ligand_c_z: 128
num_2d_layers: 32
num_2d_recycles: 1
num_3d_layers: 8
num_3d_recycles: 8
num_recycles: 1
receptor_c_s: 256
receptor_c_z: 128
use_icf: true
ligand:
c_s: 192
c_z: 128
init_c_s: 1280
init_c_z: 660
num_2d_layers: 16
num_2d_recycles: 1
num_3d_layers: 8
num_3d_recycles: 8
num_recycles: 1
position_embedding_dim: 64
tm_enabled: true
use_residue_embedding: false
plm:
c_s: 1280
c_z: 660

Traceback (most recent call last):
File "/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/predict.py", line 81, in
main()
File "/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/predict.py", line 73, in main
predict(args.pid_fpath, args.fas_dpath,
File "/nfrab0/scratch_1/usr/chiarini/TFold/projects/tfold_ag/predict.py", line 67, in predict
predictor.run_batch(pid_fpath, fas_dpath, msa_fpath, pdb_dpath, icf_dpath, chunk_size=None)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib64/python3.9/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/deploy/ag_predictor.py", line 133, in run_batch
ag_feat, _ = self.psp_featurizer(msa_path)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/deploy/psp_featurizer.py", line 82, in forward
feature_dict = self._get_feature_dict(msa_path, idx_resd_beg, idx_resd_end)
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/deploy/psp_featurizer.py", line 71, in _get_feature_dict
feature_dict.update(data_pipeline.make_msa_features([MSA], [deletion_matrix]))
File "/afs/enea.it/project/match/xcresco/virtualenv/tFold/tfold/lib64/python3.9/site-packages/openfold/data/data_pipeline.py", line 255, in make_msa_features
features["deletion_matrix_int"] = np.array(deletion_matrix, dtype=np.int32)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (265898,) + inhomogeneous part.

could you help me fix this? or at least understand where should I intervene?

Thanks

Valerio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions