targetdiff icon indicating copy to clipboard operation
targetdiff copied to clipboard

the error while running sample_for_pocket

Open MachineGUN001 opened this issue 10 months ago • 0 comments

hi, guanjq,

thanks for your good works of new diffusion models.

while I try to run the command line,

python scripts/sample_for_pocket.py configs/sampling.yml --pdb_path examples/1h36_A_rec_1h36_r88_lig_tt_docked_0_pocket10.pdb

the error occured, as below:

[2023-08-23 23:56:23,376::evaluate::INFO] {'model': {'checkpoint': './pretrained_models/pretrained_diffusion.pt'}, 'sample': {'seed': 2021, 'num_samples': 100, 'num_steps': 1000, 'pos_only': False, 'center_pos_mode': 'protein', 'sample_num_atoms': 'prior'}}
[2023-08-23 23:56:27,030::evaluate::INFO] Training Config: {'data': {'name': 'pl', 'path': './data/crossdocked_v1.1_rmsd1.0_pocket10', 'split': './data/crossdocked_pocket10_pose_split.pt', 'transform': {'ligand_atom_mode': 'add_aromatic', 'random_rot': False}}, 'model': {'denoise_type': 'diffusion', 'model_mean_type': 'C0', 'gt_noise_type': 'origin', 'beta_schedule': 'sigmoid', 'beta_start': 1e-07, 'beta_end': 0.002, 'v_beta_schedule': 'cosine', 'v_beta_s': 0.01, 'num_diffusion_timesteps': 1000, 'loss_v_weight': 100.0, 'v_mode': 'categorical', 'v_net_type': 'mlp', 'loss_pos_type': 'mse', 'sample_time_method': 'symmetric', 'time_emb_dim': 0, 'time_emb_mode': 'simple', 'center_pos_mode': 'protein', 'node_indicator': True, 'model_type': 'uni_o2', 'num_blocks': 1, 'num_layers': 9, 'hidden_dim': 128, 'n_heads': 16, 'edge_feat_dim': 4, 'num_r_gaussian': 20, 'knn': 32, 'num_node_types': 8, 'act_fn': 'relu', 'norm': True, 'cutoff_mode': 'knn', 'ew_net_type': 'global', 'r_feat_mode': 'sparse', 'energy_h_mode': 'basic', 'num_x2h': 1, 'num_h2x': 1, 'r_max': 10.0, 'x2h_out_fc': False, 'sync_twoup': False}, 'train': {'seed': 2021, 'batch_size': 4, 'num_workers': 4, 'max_iters': 10000000, 'val_freq': 2000, 'pos_noise_std': 0.1, 'max_grad_norm': 8.0, 'bond_loss_weight': 1.0, 'optimizer': {'type': 'adam', 'lr': 0.0005, 'weight_decay': 0, 'beta1': 0.95, 'beta2': 0.999}, 'scheduler': {'type': 'plateau', 'factor': 0.6, 'patience': 10, 'min_lr': 1e-06}}}
[2023-08-23 23:56:32,218::evaluate::INFO] Successfully load the model! [./pretrained_models/pretrained_diffusion.pt](https://file+.vscode-resource.vscode-cdn.net/d%3A/Cheminfo_Workshop/4_Fragment_Scaffold_Evolution/targetdiff-main/pretrained_models/pretrained_diffusion.pt)
Traceback (most recent call last):
  File "scripts/sample_for_pocket.py", line 75, in <module>
    data = transform(data)
  File "c:\Users\lsy\anaconda3\envs\molgen\lib\site-packages\torch_geometric\transforms\compose.py", line 24, in __call__
    data = transform(data)
  File "d:\Cheminfo_Workshop\4_Fragment_Scaffold_Evolution\targetdiff-main\scripts\utils\transforms.py", line 128, in __call__
    amino_acid = F.one_hot(data.protein_atom_to_aa_type, num_classes=self.max_num_aa)
RuntimeError: one_hot is only applicable to index tensor.

could you please help to provde suggestions how to fix it up? many thanks,

Best, Sh-Y

MachineGUN001 avatar Aug 23 '23 16:08 MachineGUN001