scvi-tools icon indicating copy to clipboard operation
scvi-tools copied to clipboard

Incompability between Pandas <2 and >=2 saved models

Open martinkim0 opened this issue 6 months ago • 2 comments

Error occurs when a model is saved with Pandas <2 and is attempted to be loaded in with Pandas >=2

scvi/model/base/_base_model.py:691: in load
    ) = _load_saved_files(
scvi/model/base/_utils.py:68: in _load_saved_files
    model = torch.load(model_path, map_location=map_location)
../../.../python3.11/site-packages/torch/serialization.py:1014: in load
    return _load(opened_zipfile,
../../.../python3.11/site-packages/torch/serialization.py:1422: in _load
    result = unpickler.load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <torch.serialization._load.<locals>.UnpicklerWrapper object at 0x7f25fc273b10>
mod_name = 'pandas.core.indexes.numeric', name = 'Int64Index'

    def find_class(self, mod_name, name):
        if type(name) is str and 'Storage' in name:
            try:
                return StorageType(name)
            except KeyError:
                pass
        mod_name = load_module_mapping.get(mod_name, mod_name)
>       return super().find_class(mod_name, name)
E       ModuleNotFoundError: No module named 'pandas.core.indexes.numeric'

../../.../python3.11/site-packages/torch/serialization.py:1415: ModuleNotFoundError

martinkim0 avatar Jan 09 '24 22:01 martinkim0