You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a TypeError while running Chemprop's hyperparameter optimization (hpopt) command. The error occurs during the evaluation phase when calling torch.cat() in the compute() method of metrics.py. It seems that the variable self.TP is not of the expected type (a list or tuple of tensors) but is instead a single tensor or an incompatible object. This issue prevents the training process from completing.
Example(s)
Here is the exact command I used to run the hyperparameter optimization:
The error occurs during the evaluation phase of the training process when computing the metrics.
Expected behavior
The expected behavior is that the training and evaluation processes complete successfully, with the specified metrics (roc, prc, accuracy, f1, binary-mcc) being computed correctly. The torch.cat() function should concatenate a list or tuple of tensors, but it seems self.TP is not being updated or initialized correctly.
Error Stack Trace
Here is the full stack trace of the error:
TypeError: cat() received an invalid combination of arguments - got (Tensor, dim=int), but expected one of:
* (tuple of Tensors tensors, int dim = 0, *, Tensor out = None)
* (tuple of Tensors tensors, name dim, *, Tensor out = None)
File "/gpfs/hpc/home/caodongsh/tianyao/miniconda3/envs/chemprop/lib/python3.11/site-packages/chemprop/nn/metrics.py", line 303, in compute
TP = torch.cat(self.TP, dim=0).sum(0, keepdim=True)
^^^^^^^^^^^^^^^^^^^^^^^^^
This error is raised during the evaluation phase when computing metrics. From the error message, it seems that self.TP is either a single tensor or has not been properly initialized as a list of tensors.
The error occurs in the following context:
TP=torch.cat(self.TP, dim=0).sum(0, keepdim=True)
Environment
Python version: 3.11
Chemprop version:2.1
PyTorch version: 2.5.1
Lightning version: 2.4.0
Ray version: 2.40.0
OS: HPC cluster (Linux-based)
Hardware: CPU but when training in GPU it also comes this bug.
@TianYaoCSU thank you very much for raising this and sorry it took me so long to get a solution. If you have time, I would appreciate if you could checkout my branch (in the PR above) that includes a fix to test if it resolves the bug for you.
Describe the bug
I encountered a
TypeError
while running Chemprop's hyperparameter optimization (hpopt
) command. The error occurs during the evaluation phase when callingtorch.cat()
in thecompute()
method ofmetrics.py
. It seems that the variableself.TP
is not of the expected type (a list or tuple of tensors) but is instead a single tensor or an incompatible object. This issue prevents the training process from completing.Example(s)
Here is the exact command I used to run the hyperparameter optimization:
The error occurs during the evaluation phase of the training process when computing the metrics.
Expected behavior
The expected behavior is that the training and evaluation processes complete successfully, with the specified metrics (
roc
,prc
,accuracy
,f1
,binary-mcc
) being computed correctly. Thetorch.cat()
function should concatenate a list or tuple of tensors, but it seemsself.TP
is not being updated or initialized correctly.Error Stack Trace
Here is the full stack trace of the error:
This error is raised during the evaluation phase when computing metrics. From the error message, it seems that
self.TP
is either a single tensor or has not been properly initialized as a list of tensors.The error occurs in the following context:
Environment
Checklist
Package Version
aimsim_core 2.2.2
aiohappyeyeballs 2.4.4
aiohttp 3.11.9
aiosignal 1.3.1
alembic 1.14.0
astartes 1.3.0
attrs 24.2.0
certifi 2024.8.30
charset-normalizer 3.4.0
chemprop 2.1.0
click 8.1.7
cloudpickle 3.1.0
colorlog 6.9.0
ConfigArgParse 1.7
descriptastorus 2.8.0
dill 0.3.9
filelock 3.16.1
frozenlist 1.5.0
fsspec 2024.10.0
future 1.0.0
greenlet 3.1.1
hyperopt 0.2.7
idna 3.10
Jinja2 3.1.4
joblib 1.4.2
jsonschema 4.23.0
jsonschema-specifications 2024.10.1
lightning 2.4.0
lightning-utilities 0.11.9
Mako 1.3.7
markdown-it-py 3.0.0
MarkupSafe 3.0.2
mdurl 0.1.2
mhfp 1.9.6
mordredcommunity 2.0.6
mpmath 1.3.0
msgpack 1.1.0
multidict 6.1.0
multiprocess 0.70.17
networkx 3.4.2
numpy 1.26.4
nvidia-cublas-cu12 12.4.5.8
nvidia-cuda-cupti-cu12 12.4.127
nvidia-cuda-nvrtc-cu12 12.4.127
nvidia-cuda-runtime-cu12 12.4.127
nvidia-cudnn-cu12 9.1.0.70
nvidia-cufft-cu12 11.2.1.3
nvidia-curand-cu12 10.3.5.147
nvidia-cusolver-cu12 11.6.1.9
nvidia-cusparse-cu12 12.3.1.170
nvidia-nccl-cu12 2.21.5
nvidia-nvjitlink-cu12 12.4.127
nvidia-nvtx-cu12 12.4.127
optuna 4.1.0
packaging 24.2
padelpy 0.1.16
pandas 2.2.3
pandas-flavor 0.6.0
pillow 11.0.0
pip 24.2
propcache 0.2.1
protobuf 5.29.1
psutil 6.1.0
py4j 0.10.9.7
pyarrow 18.1.0
Pygments 2.18.0
python-dateutil 2.9.0.post0
pytorch-lightning 2.4.0
pytz 2024.2
PyYAML 6.0.2
ray 2.40.0
rdkit 2024.3.2
referencing 0.35.1
requests 2.32.3
rich 13.9.4
rpds-py 0.22.3
scikit-learn 1.5.2
scipy 1.14.1
setuptools 75.1.0
six 1.17.0
SQLAlchemy 2.0.36
sympy 1.13.1
tabulate 0.9.0
tensorboardX 2.6.2.2
threadpoolctl 3.5.0
torch 2.5.1
torchmetrics 1.6.0
tqdm 4.67.1
triton 3.1.0
typing_extensions 4.12.2
tzdata 2024.2
urllib3 2.2.3
wheel 0.44.0
xarray 2024.11.0
yarl 1.18.3
packages in environment at /gpfs/hpc/home/caodongsh/tianyao/miniconda3/envs/chemprop:
Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
aimsim-core 2.2.2 pypi_0 pypi
aiohappyeyeballs 2.4.4 pypi_0 pypi
aiohttp 3.11.9 pypi_0 pypi
aiosignal 1.3.1 pypi_0 pypi
alembic 1.14.0 pypi_0 pypi
astartes 1.3.0 pypi_0 pypi
attrs 24.2.0 pypi_0 pypi
bzip2 1.0.8 h5eee18b_6
ca-certificates 2024.11.26 h06a4308_0
certifi 2024.8.30 pypi_0 pypi
charset-normalizer 3.4.0 pypi_0 pypi
chemprop 2.1.0 pypi_0 pypi
click 8.1.7 pypi_0 pypi
cloudpickle 3.1.0 pypi_0 pypi
colorlog 6.9.0 pypi_0 pypi
configargparse 1.7 pypi_0 pypi
descriptastorus 2.8.0 pypi_0 pypi
dill 0.3.9 pypi_0 pypi
filelock 3.16.1 pypi_0 pypi
frozenlist 1.5.0 pypi_0 pypi
fsspec 2024.10.0 pypi_0 pypi
future 1.0.0 pypi_0 pypi
greenlet 3.1.1 pypi_0 pypi
hyperopt 0.2.7 pypi_0 pypi
idna 3.10 pypi_0 pypi
jinja2 3.1.4 pypi_0 pypi
joblib 1.4.2 pypi_0 pypi
jsonschema 4.23.0 pypi_0 pypi
jsonschema-specifications 2024.10.1 pypi_0 pypi
ld_impl_linux-64 2.40 h12ee557_0
libffi 3.4.4 h6a678d5_1
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
libuuid 1.41.5 h5eee18b_0
lightning 2.4.0 pypi_0 pypi
lightning-utilities 0.11.9 pypi_0 pypi
mako 1.3.7 pypi_0 pypi
markdown-it-py 3.0.0 pypi_0 pypi
markupsafe 3.0.2 pypi_0 pypi
mdurl 0.1.2 pypi_0 pypi
mhfp 1.9.6 pypi_0 pypi
mordredcommunity 2.0.6 pypi_0 pypi
mpmath 1.3.0 pypi_0 pypi
msgpack 1.1.0 pypi_0 pypi
multidict 6.1.0 pypi_0 pypi
multiprocess 0.70.17 pypi_0 pypi
ncurses 6.4 h6a678d5_0
networkx 3.4.2 pypi_0 pypi
numpy 1.26.4 pypi_0 pypi
nvidia-cublas-cu12 12.4.5.8 pypi_0 pypi
nvidia-cuda-cupti-cu12 12.4.127 pypi_0 pypi
nvidia-cuda-nvrtc-cu12 12.4.127 pypi_0 pypi
nvidia-cuda-runtime-cu12 12.4.127 pypi_0 pypi
nvidia-cudnn-cu12 9.1.0.70 pypi_0 pypi
nvidia-cufft-cu12 11.2.1.3 pypi_0 pypi
nvidia-curand-cu12 10.3.5.147 pypi_0 pypi
nvidia-cusolver-cu12 11.6.1.9 pypi_0 pypi
nvidia-cusparse-cu12 12.3.1.170 pypi_0 pypi
nvidia-nccl-cu12 2.21.5 pypi_0 pypi
nvidia-nvjitlink-cu12 12.4.127 pypi_0 pypi
nvidia-nvtx-cu12 12.4.127 pypi_0 pypi
openssl 3.0.15 h5eee18b_0
optuna 4.1.0 pypi_0 pypi
packaging 24.2 pypi_0 pypi
padelpy 0.1.16 pypi_0 pypi
pandas 2.2.3 pypi_0 pypi
pandas-flavor 0.6.0 pypi_0 pypi
pillow 11.0.0 pypi_0 pypi
pip 24.2 py311h06a4308_0
propcache 0.2.1 pypi_0 pypi
protobuf 5.29.1 pypi_0 pypi
psutil 6.1.0 pypi_0 pypi
py4j 0.10.9.7 pypi_0 pypi
pyarrow 18.1.0 pypi_0 pypi
pygments 2.18.0 pypi_0 pypi
python 3.11.10 he870216_0
python-dateutil 2.9.0.post0 pypi_0 pypi
pytorch-lightning 2.4.0 pypi_0 pypi
pytz 2024.2 pypi_0 pypi
pyyaml 6.0.2 pypi_0 pypi
ray 2.40.0 pypi_0 pypi
rdkit 2024.3.2 pypi_0 pypi
readline 8.2 h5eee18b_0
referencing 0.35.1 pypi_0 pypi
requests 2.32.3 pypi_0 pypi
rich 13.9.4 pypi_0 pypi
rpds-py 0.22.3 pypi_0 pypi
scikit-learn 1.5.2 pypi_0 pypi
scipy 1.14.1 pypi_0 pypi
setuptools 75.1.0 py311h06a4308_0
six 1.17.0 pypi_0 pypi
sqlalchemy 2.0.36 pypi_0 pypi
sqlite 3.45.3 h5eee18b_0
sympy 1.13.1 pypi_0 pypi
tabulate 0.9.0 pypi_0 pypi
tensorboardx 2.6.2.2 pypi_0 pypi
threadpoolctl 3.5.0 pypi_0 pypi
tk 8.6.14 h39e8969_0
torch 2.5.1 pypi_0 pypi
torchmetrics 1.6.0 pypi_0 pypi
tqdm 4.67.1 pypi_0 pypi
triton 3.1.0 pypi_0 pypi
typing-extensions 4.12.2 pypi_0 pypi
tzdata 2024.2 pypi_0 pypi
urllib3 2.2.3 pypi_0 pypi
wheel 0.44.0 py311h06a4308_0
xarray 2024.11.0 pypi_0 pypi
xz 5.4.6 h5eee18b_1
yarl 1.18.3 pypi_0 pypi
zlib 1.2.13 h5eee18b_1
Thank you for your time and support. Please let me know if additional information is needed to debug this issue.
The text was updated successfully, but these errors were encountered: