Skip to content

Error when working with Norman pretrained model #93

@igrabski

Description

@igrabski

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions