seyonechithrananda / bert-loves-chemistry

bert-loves-chemistry: a repository of HuggingFace models applied on chemical SMILES data for drug design, chemical modelling, etc.
MIT License
389 stars 60 forks source link

RuntimeError: Found dtype Double but expected Float #57

Open mapengsen opened 1 year ago

mapengsen commented 1 year ago

when i run the command : python chemberta/finetune/finetune.py --datasets=delaney

but get this error: RuntimeError: Found dtype Double but expected Float

zhangky12 commented 1 year ago

I got the same error when trying to finetune for regresssion

tkella47 commented 1 year ago

This is a common and well-known error for the Delaney dataset.. Most of the time it is solved by ensuring at train time, by ensuring that both input and labels are both floats. Ensure that at some point, you at least call X.float() and y.float() (it is usually the label). However, this can be an issue as a double is float64 and a normal float is float32. You have Double the precision of a normal float, hence the name.

YOUNG-JAME commented 8 months ago

Have you worked it out? I avoided this error by modifying the label to float32, but this resulted in another error: TypeError: Object of type float32 is not JSON serializable. The error location is in this code: best_trial = trainer.hyperparameter_search( backend="optuna", direction="minimize", hp_space=custom_hp_space_optuna, n_trials=FLAGS.n_trials, ) Help!