Cannot create 2 Crabnet models in the same code #73
-
I stumbled upon crabnet recently, and I'm using it in a catalysis project. It's been a good addition to the project, but I've found a problem. I'm not sure if this should be considered a bug or an enhancement, so that's why I opened the discussion. The problem is I wanted to train crabnet in different subsets of my dataset (filtering on reaction conditions) to try to see if that gave better results (I have sometimes the same composition but with different reaction conditions, which gives different results). The problem seems to be that when you instantiate 2 instances of crabnet, some parts seem to be shared. Here's a Minimal Working example of how to replicate the problem: """Basic usage of CrabNet regression on elasticity dataset."""
from crabnet.utils.data import get_data
from crabnet.data.materials_data import elasticity, example_materials_property
from crabnet.crabnet_ import CrabNet
train_df, val_df = get_data(elasticity, "train.csv", dummy=True)
train_df_2, val_df_2 = get_data(example_materials_property, "train.csv", dummy=True)
cb = CrabNet(mat_prop="elasticity")
cb.fit(train_df)
val_pred, val_sigma = cb.predict(val_df, return_uncertainty=True)
cbn = CrabNet(mat_prop="example_materials_property")
cbn.fit(train_df_2)
val_pred_2, val_sigma_2 = cbn.predict(val_df_2, return_uncertainty=True) The example is just the Basic Usage example in Crabnet's Docs but with each step repeated (and changing the dataset just in case). This returns this error: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I've been doing some more testing, and it seems the error only happens if there are 2 |
Beta Was this translation helpful? Give feedback.
-
Hi @DavidSiretMarques, this is likely due to #70. The fix is to install a PyTorch version less than 2.0. |
Beta Was this translation helpful? Give feedback.
I found out why it worked in my old mac and not in my newer, usual computer. Turns out my old mac seems to be too old to have pytorch 2.0, so it has pytorch 1.9.3 (I think), but my newer computer has pytorch 2.0.1, so it turns out it was because of #70 all along.
I also checked, and the code seems to work in my old mac, so it should work in the newer computer too. I'm going to try and install pytorch 1.9.something and see if it gives any problems.
Thanks for everything