Error in in_silico_perturbation example: get_model_embedding_dimensions
Hello,
I was recently running the in_silico_perturbation example when I ran into the following error:
Traceback (most recent call last):
File "/gpfs/data/xhe-lab/nlapier2/geneformer/Geneformer/examples/new_in_silico_perturbation.py", line 31, in <module>
state_embs_dict = embex.get_state_embs(cell_states_to_model,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nlapier2/project-xhe/miniconda3/envs/geneformer/lib/python3.11/site-packages/geneformer/emb_extractor.py", line 711, in get_state_embs
state_embs_dict[v] = self.extract_embs(
^^^^^^^^^^^^^^^^^^
File "/home/nlapier2/project-xhe/miniconda3/envs/geneformer/lib/python3.11/site-packages/geneformer/emb_extractor.py", line 625, in extract_embs
emb_dims = pu.get_model_embedding_dimensions(model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'geneformer.perturber_utils' has no attribute 'get_model_embedding_dimensions'
I just cloned the package, so it's not out of date. Upon looking, it seems like perturber_utils.py has a function named "get_model_emb_dims", while in emb_extractor.py it is called "get_model_embedding_dimensions" in two places and "get_model_emb_dims" in another place. It seems like maybe the function name got updated but some references to the old name remain?
Thank you for catching this! A fix has been pushed. Please pull the updated version.
Thanks for the prompt fix! Just noting one more error I've now gotten, which I suspect is for similar reasons:
Traceback (most recent call last):
File "/gpfs/data/xhe-lab/nlapier2/geneformer/Geneformer/examples/new_in_silico_perturbation.py", line 57, in <module>
isp.perturb_data("../fine_tuned_models/geneformer-6L-30M_CellClassifier_cardiomyopathies_220224",
File "/home/nlapier2/project-xhe/miniconda3/envs/geneformer/lib/python3.11/site-packages/geneformer/in_silico_perturber.py", line 444, in perturb_data
self.isp_perturb_all(
File "/home/nlapier2/project-xhe/miniconda3/envs/geneformer/lib/python3.11/site-packages/geneformer/in_silico_perturber.py", line 734, in isp_perturb_all
full_original_emb = get_embs(
^^^^^^^^^
TypeError: get_embs() missing 1 required positional argument: 'token_gene_dict'
Thank you for catching this as well. Pushed a fix. Let us know if you find anything else!
Thank you again!