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

Bug using "scvi-tools/tabula-sapiens-heart-stereoscope" hugging face scvi model - scvi-tools 1.0.4

Open LysSanzMoreta opened this issue 5 months ago • 1 comments

Hi!

I followed this tutorial scvi-hugging-face to load pre-trained scvi models and make some predictions/obtain the latent representation.

This is my current environment:

env.yaml

name: base channels:

  • conda-forge
  • pytorch
  • defaults
  • nvidia
  • bioconda dependencies:
  • pyopenssl
  • python=3.9
  • requests
  • pip:
    • -r requirements.txt
  • numpy
  • pytorch::pytorch=2.1=py3.9_cuda12.1*
  • torchvision=>0.16
  • torchaudio
  • biopython
  • h5py
  • scipy
  • scikit-learn
  • pandas
  • matplotlib
  • hdf5plugin
  • pyro-ppl
  • scanpy
  • dill
  • umap-learn
  • seaborn
  • dataframe_image
  • xmltodict
  • nbconvert
  • bioconda::cellxgene
  • conda-forge::lightning
  • numba
  • conda-forge::scvi-tools==1.0.4
  • conda-forge::jax[cuda12_pip]
  • conda-forge::jaxlib
  • conda-forge::huggingface_hub
  • conda-forge::leidenalg

requirements.txt

gget cellxgene-census

I decided to start with this example:

from scvi.hub import HubModel
torch.set_float32_matmul_precision('high')
scvi.settings.seed = 0
repository = "scvi-tools/tabula-sapiens-heart-stereoscope"
hubmodel = HubModel.pull_from_huggingface_hub(repository, cache_dir=None, revision="main")
print(hubmodel.model)

However, there was some issue with loading the model due to some attributes inconsistency.

Fetching 3 files: 100%|██████████| 3/3 [00:00<00:00, 11904.36it/s]
INFO     Loading model...                                                       
Traceback (most recent call last):
  File ".../test_scanvi.py", line 163, in <module>
    print(hubmodel.model)
  File "/home/.../micromamba/lib/python3.9/site-packages/scvi/hub/hub_model.py", line 230, in model
    self.load_model()
  File "/home/.../micromamba/lib/python3.9/site-packages/scvi/hub/hub_model.py", line 275, in load_model
    model_cls = getattr(python_module, model_cls_name)
AttributeError: module 'scvi.model' has no attribute 'RNAStereoscope'

I have been able to run this one:

from scvi.hub import HubModel
torch.set_float32_matmul_precision('high')
scvi.settings.seed = 0
repository = "scvi-tools/heart-cell-atlas-scvi"
hubmodel = HubModel.pull_from_huggingface_hub(repository, cache_dir=None, revision="main")
print(hubmodel.model)

Is this error expected due to an error in my implementation or the hugging face interface is still experimental and some errors are expected?

Thank you in advance for your time!

LysSanzMoreta avatar Feb 22 '24 14:02 LysSanzMoreta

This indeed an issue on our end, apologies. I'll get this fixed ASAP!

martinkim0 avatar Feb 22 '24 17:02 martinkim0