Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when working with Norman pretrained model #93

Open
igrabski opened this issue Mar 12, 2025 · 0 comments
Open

Error when working with Norman pretrained model #93

igrabski opened this issue Mar 12, 2025 · 0 comments

Comments

@igrabski
Copy link

Thanks for making this tool available!

I am trying to run the tutorial located here, but have been encountering some issues. When I run the following code:

from gears import PertData, GEARS
from gears.utils import dataverse_download
from zipfile import ZipFile

dataverse_download('https://dataverse.harvard.edu/api/access/datafile/6979957', 'norman_umi_go.tar.gz')

## Extract and set up dataloader directory
import tarfile
with tarfile.open('norman_umi_go.tar.gz', 'r:gz') as tar:
    tar.extractall()

dataverse_download('https://dataverse.harvard.edu/api/access/datafile/6979956', 'model.zip')

## Extract and set up model directory
with ZipFile(('model.zip'), 'r') as zip:
    zip.extractall(path = './')

data_path = './'
data_name = 'norman_umi_go'
model_name = 'gears_misc_umi_no_test'

pert_data = PertData(data_path)
pert_data.load(data_path = data_path + data_name)
pert_data.prepare_split(split = 'no_test', seed = 1)
pert_data.get_dataloader(batch_size = 32, test_batch_size = 128)

gears_model = GEARS(pert_data, device = 'cpu',
                        weight_bias_track = False,
                        proj_name = 'gears',
                        exp_name = model_name)

I get the error below:

AttributeError: 'Series' object has no attribute 'nonzero'

I was able to resolve the error by running:

pert_data.adata.X = pert_data.adata.X.toarray()

and the gears_model command works. However, when I then run:

gears_model.load_pretrained('./model_ckpt')

I get this error:

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

Please let me know how I can resolve this -- thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant