torchdrug icon indicating copy to clipboard operation
torchdrug copied to clipboard

fpscores file being downloaded

Open parsifal9 opened this issue 1 year ago • 1 comments

Hi torchdrug,

I am working through the tutorial https://torchdrug.ai/docs/tutorials/generation.html and I get an error on the line solver.train(num_epoch=10). See below for details.

A file fpscores.pkl.gz is being downloaded. However I am using torchdrug through a module system ie.

moduel load torchdrug

and do not have write access to the directory that torchdrug is trying to download to. Also, even if I get the files fpscores.pkl.gz and fpscores.pkl put in that directory, it seems that torchdrug still wants to download them.

is there a way to set a local directory for these downloads?

>>> solver.train(num_epoch=10)
11:54:31   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
11:54:31   Epoch 0 begin
11:54:34   Downloading https://github.com/rdkit/rdkit/raw/master/Contrib/SA_Score/fpscores.pkl.gz to /apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/metrics/rdkit/fpscores.pkl.gz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch1/dun280/expressive-graph-gen/script1.Rmd", line 149, in <module>
    
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/core/engine.py", line 155, in train
    loss, metric = model(batch)
  File "/apps/pytorch/1.9.0-py39-cuda112-mpi/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/tasks/generation.py", line 715, in forward
    _loss, _metric = self.reinforce_forward(batch)
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/tasks/generation.py", line 839, in reinforce_forward
    plogp = metrics.penalized_logP(graph)
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/metrics/metric.py", line 113, in penalized_logP
    sa = sascorer.calculateScore(mol)
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/metrics/rdkit/sascorer.py", line 42, in calculateScore
    module.fscores = readFragmentScores()
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/metrics/rdkit/sascorer.py", line 23, in readFragmentScores
    zip_file = utils.download(url, path, md5=md5)
  File "/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/utils/file.py", line 31, in download
    urlretrieve(url, save_file)
  File "/apps/python/3.9.4/lib/python3.9/urllib/request.py", line 249, in urlretrieve
    tfp = open(filename, 'wb')
PermissionError: [Errno 13] Permission denied: '/apps/torchdrug/0.2.0-py39/lib/python3.9/site-packages/torchdrug/metrics/rdkit/fpscores.pkl.gz'
>>> 

parsifal9 avatar Mar 06 '23 01:03 parsifal9

IT support patched the code so that this file is downloaded to a different location. So the issue is fixed for me. I will leave it open for a while. Anyone running the generation tutorial and not having write access to their torchdrug installation is going to run into the same problem.

parsifal9 avatar Mar 10 '23 21:03 parsifal9