pengxingang / Pocket2Mol

Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
MIT License
242 stars 65 forks source link

sampling issues #32

Closed MachineGUN001 closed 10 months ago

MachineGUN001 commented 10 months ago

hi,

thanks for your great effots on this highly interesting works.

when I try to run the sample_for_pdb.py with configs file below

model:
    checkpoint: ./ckpt/pretrained_Pocket2Mol.pt

sample:
  seed: 2023
  num_samples: 200
  beam_size: 50
  max_steps: 50
  threshold:
    focal_threshold: 0.5
    pos_threshold: 0.25
    element_threshold: 0.3
    hasatom_threshold: 0.6
    bond_threshold: 0.4

the script works but some errors occured,

the error info is below


100%|██████████| 50/50 [00:05<00:00,  8.60it/s]
100%|██████████| 50/50 [00:05<00:00,  8.57it/s]
Traceback (most recent call last):
  File "sample_for_pdb.py", line 209, in <module>
    next_idx = np.random.choice(np.arange(n_tmp), p=prob, size=min(config.sample.beam_size, n_tmp), replace=False)
  File "mtrand.pyx", line 939, in numpy.random.mtrand.RandomState.choice
ValueError: probabilities do not sum to 1

Could you please see the issue and how to fix it up? Many Thanks,

Best,

Sh-Y

surendraphd commented 3 months ago

Hi, How did you solve the above issue. I am also getting the same issue.

MachineGUN001 commented 3 months ago

add

if n_tmp <> 0:
   next_idx = np.random.choice(np.arange(n_tmp), p=prob, size=min(config.sample.beam_size, n_tmp), replace=False)