Layne-Huang / PMDM

73 stars 16 forks source link

sample_for_pdb.py error #22

Open kathyli2023 opened 1 month ago

kathyli2023 commented 1 month ago

Dear Dr. Huang, I have encountered following errors when applying the sample_for_pdb.py . Would you please help me with it? Many thanks.

python -u sample_for_pdb.py --ckpt pretrained/500.pt --pdb_path 5fc4_md.pdb --num_atom 32 --num_samples 20 --sampling_type generalized sh: module: command not found /home/public/.conda/envs/mol/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: '/home/public/.conda/envs/mol/lib/python3.9/site-packages/torchvision/image.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source? warn( Entropy of n_nodes: H[N] -1.3862943649291992 [2024-05-12 13:49:16,210::test::INFO] Namespace(pdb_path='5fc4_md.pdb', sdf_path=None, num_atom=32, build_method='reconstruct', config=None, cuda=True, ckpt='pretrained/500.pt', save_traj=False, num_samples=20, batch_size=10, resume=None, tag='', clip=1000.0, n_steps=1000, global_start_sigma=inf, w_global_pos=1.0, w_local_pos=1.0, w_global_node=1.0, w_local_node=1.0, sampling_type='generalized', eta=1.0) [2024-05-12 13:49:16,210::test::INFO] {'model': {'type': 'diffusion', 'network': 'MDM_full_pocket_coor_shared', 'hidden_dim': 128, 'protein_hidden_dim': 128, 'num_convs': 3, 'num_convs_local': 3, 'protein_num_convs': 2, 'cutoff': 3.0, 'g_cutoff': 6.0, 'encoder_cutoff': 6.0, 'time_emb': True, 'atom_num_emb': False, 'mlp_act': 'relu', 'beta_schedule': 'sigmoid', 'beta_start': 1e-07, 'beta_end': 0.002, 'num_diffusion_timesteps': 1000, 'edge_order': 3, 'edge_encoder': 'mlp', 'smooth_conv': False, 'num_layer': 9, 'feats_dim': 5, 'soft_edge': True, 'norm_coors': True, 'm_dim': 128, 'context': 'None', 'vae_context': False, 'num_atom': 10, 'protein_feature_dim': 31}, 'train': {'seed': 2021, 'batch_size': 16, 'val_freq': 250, 'max_iters': 500, 'max_grad_norm': 10.0, 'num_workers': 4, 'anneal_power': 2.0, 'optimizer': {'type': 'adam', 'lr': 0.001, 'weight_decay': 0.0, 'beta1': 0.95, 'beta2': 0.999}, 'scheduler': {'type': 'plateau', 'factor': 0.6, 'patience': 10, 'min_lr': 1e-06}, 'transform': {'mask': {'type': 'mixed', 'min_ratio': 0.0, 'max_ratio': 1.2, 'min_num_masked': 1, 'min_num_unmasked': 0, 'p_random': 0.5, 'p_bfs': 0.25, 'p_invbfs': 0.25}, 'contrastive': {'num_real': 50, 'num_fake': 50, 'pos_real_std': 0.05, 'pos_fake_std': 2.0}}}, 'dataset': {'name': 'crossdock', 'type': 'pl', 'path': './data/crossdocked_pocket10', 'split': './data/split_by_name.pt'}} [2024-05-12 13:49:16,211::test::INFO] Loading crossdock data... Entropy of n_nodes: H[N] -3.543935775756836 [2024-05-12 13:49:16,212::test::INFO] Loading data... [2024-05-12 13:49:16,257::test::INFO] Building model... [2024-05-12 13:49:16,257::test::INFO] MDM_full_pocket_coor_shared {'type': 'diffusion', 'network': 'MDM_full_pocket_coor_shared', 'hidden_dim': 128, 'protein_hidden_dim': 128, 'num_convs': 3, 'num_convs_local': 3, 'protein_num_convs': 2, 'cutoff': 3.0, 'g_cutoff': 6.0, 'encoder_cutoff': 6.0, 'time_emb': True, 'atom_num_emb': False, 'mlp_act': 'relu', 'beta_schedule': 'sigmoid', 'beta_start': 1e-07, 'beta_end': 0.002, 'num_diffusion_timesteps': 1000, 'edge_order': 3, 'edge_encoder': 'mlp', 'smooth_conv': False, 'num_layer': 9, 'feats_dim': 5, 'soft_edge': True, 'norm_coors': True, 'm_dim': 128, 'context': 'None', 'vae_context': False, 'num_atom': 10, 'protein_feature_dim': 31} sdf idr: generate_ref Entropy of n_nodes: H[N] -3.543935775756836 100%|████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 147.77it/s] 0%| | 0/4 [00:00<?, ?it/s]1 /disk1/liyan/PMDM-main/models/common.py:485: UserWarning: torch.sparse.SparseTensor(indices, values, shape, , device=) is deprecated. Please use torch.sparse_coo_tensor(indices, values, shape, dtype=, device=). (Triggered internally at ../torch/csrc/utils/tensor_new.cpp:605.) bgraph_adj = torch.sparse.LongTensor( sample: 0it [00:00, ?it/s] 0%| | 0/4 [00:00<?, ?it/s] Traceback (most recent call last): File "/disk1/liyan/PMDM-main/sample_for_pdb.py", line 350, in pos_gen, pos_gen_traj, atom_type, atom_traj = model.langevin_dynamics_sample( File "/disk1/liyan/PMDM-main/models/epsnet/MDM_pocket_coor_shared.py", line 790, in langevin_dynamics_sample net_out = self.net( File "/disk1/liyan/PMDM-main/models/epsnet/MDM_pocket_coor_shared.py", line 478, in net node_attr_global, pos_attr_global = self.encoder_global( File "/home/public/.conda/envs/mol/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/public/.conda/envs/mol/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "/disk1/liyan/PMDM-main/models/encoders/egnn.py", line 476, in forward x = layer(x, edge_index, edge_attr, batch=batch, ligand_batch=ligand_batch, size=bsize, linker_mask=linker_mask) File "/home/public/.conda/envs/mol/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/public/.conda/envs/mol/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "/disk1/liyan/PMDM-main/models/encoders/egnn.py", line 215, in forward hidden_out, coors_out = self.propagate(edge_index, x=feats, edge_attr=edge_attr_feats, ValueError: too many values to unpack (expected 2)

kathyli2023 commented 1 month ago

I tried to increase the "num_samples" or decrease the "num_atom", but still got the above error "File "/disk1/liyan/PMDM-main/models/encoders/egnn.py", line 215, in forward hidden_out, coors_out = self.propagate(edge_index, x=feats, edge_attr=edge_attr_feats, ValueError: too many values to unpack (expected 2)"

There is something wrong with the returned values in the function "self.propagate" of the script "egnn.py"?

Layne-Huang commented 1 month ago

Please use torch-geometric==2.4.0.

kathyli2023 commented 1 month ago

The problem has been solved. Thanks!