Hi Martin and Can,
I am experiencing a similar issue after updating my scvi-tools version from 0.19.0 to 1.1.2. My current version of pandas is 2.0.3 and I am not sure what my old version was. Here is the code I am trying to run:
model = scvi.model.SCVI.load(working_path +
"/new_scvi_model_Epithelial_batch10x/",
adata)
Here is the error I am getting:
INFO File /home/jupyter/new_scvi_model_Epithelial_batch10x/model.pt already downloaded
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[70], line 1
----> 1 model = scvi.model.SCVI.load(working_path +
2 "/new_scvi_model_Epithelial_batch10x/",
3 adata)
4 #accelerator='gpu')
File ~/.local/lib/python3.10/site-packages/scvi/model/base/_base_model.py:674, in BaseModelClass.load(cls, dir_path, adata, accelerator, device, prefix, backup_url)
661 load_adata = adata is None
662 _, _, device = parse_device_args(
663 accelerator=accelerator,
664 devices=device,
665 return_device="torch",
666 validate_single_device=True,
667 )
669 (
670 attr_dict,
671 var_names,
672 model_state_dict,
673 new_adata,
--> 674 ) = _load_saved_files(
675 dir_path,
676 load_adata,
677 map_location=device,
678 prefix=prefix,
679 backup_url=backup_url,
680 )
681 adata = new_adata if new_adata is not None else adata
683 _validate_var_names(adata, var_names)
File ~/.local/lib/python3.10/site-packages/scvi/model/base/_utils.py:66, in _load_saved_files(dir_path, load_adata, prefix, map_location, backup_url)
64 try:
65 _download(backup_url, dir_path, model_file_name)
---> 66 model = torch.load(model_path, map_location=map_location)
67 except FileNotFoundError as exc:
68 raise ValueError(
69 f"Failed to load model file at {model_path}. "
70 "If attempting to load a saved model from <v0.15.0, please use the util function "
71 "`convert_legacy_save` to convert to an updated format."
72 ) from exc
File ~/.local/lib/python3.10/site-packages/torch/serialization.py:1025, in load(f, map_location, pickle_module, weights_only, mmap, **pickle_load_args)
1023 except RuntimeError as e:
1024 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
-> 1025 return _load(opened_zipfile,
1026 map_location,
1027 pickle_module,
1028 overall_storage=overall_storage,
1029 **pickle_load_args)
1030 if mmap:
1031 f_name = "" if not isinstance(f, str) else f"{f}, "
File ~/.local/lib/python3.10/site-packages/torch/serialization.py:1446, in _load(zip_file, map_location, pickle_module, pickle_file, overall_storage, **pickle_load_args)
1444 unpickler = UnpicklerWrapper(data_file, **pickle_load_args)
1445 unpickler.persistent_load = persistent_load
-> 1446 result = unpickler.load()
1448 torch._utils._validate_loaded_sparse_tensors()
1449 torch._C._log_api_usage_metadata(
1450 "torch.load.metadata", {"serialization_id": zip_file.serialization_id()}
1451 )
File ~/.local/lib/python3.10/site-packages/torch/serialization.py:1439, in _load.<locals>.UnpicklerWrapper.find_class(self, mod_name, name)
1437 pass
1438 mod_name = load_module_mapping.get(mod_name, mod_name)
-> 1439 return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'pandas.core.indexes.numeric'
Thank you for your help!
Kate