snap-stanford / GEARS

GEARS is a geometric deep learning model that predicts outcomes of novel multi-gene perturbations
MIT License
189 stars 38 forks source link

tutorial_inference_Norman.ipynb is out-of-date #44

Closed jzqin closed 2 weeks ago

jzqin commented 7 months ago

When trying to run the tutorial_inference_Norman.ipynb file, loading the pretrained model generates the following error:

TypeError                                 Traceback (most recent call last)
Cell In[111], line 6
      1 gears_model = GEARS(pert_data, 
      2                     device = 'cpu',
      3                     weight_bias_track = False,
      4                     proj_name = 'gears',
      5                     exp_name = 'test')
----> 6 gears_model.load_pretrained('../model/model_ckpt')

File ~/miniconda3/envs/gears/lib/python3.10/site-packages/gears/gears.py:257, in GEARS.load_pretrained(self, path)
    254     config = pickle.load(f)
    256 del config['device'], config['num_genes'], config['num_perts']
--> 257 self.model_initialize(**config)
    258 self.config = config
    260 state_dict = torch.load(os.path.join(path, 'model.pt'), map_location = torch.device('cpu'))

TypeError: GEARS.model_initialize() got an unexpected keyword argument 'cell_fitness_pred'

This is because the model.py file was updated with the commit 8da5e36, which removed the cell_fitness_pred argument, but the model checkpoint provided via dataverse_download('https://dataverse.harvard.edu/api/access/datafile/6979956', './model.zip') does not use the updated model.

yhr91 commented 2 weeks ago

Sorry for the dealyed response! I've updated the tutorial files and this should now work out of the box.