Yuning You commited on
Commit
0036d26
·
1 Parent(s): 525fc3a
Files changed (1) hide show
  1. README.md +59 -2
README.md CHANGED
@@ -6,6 +6,63 @@ tags:
6
  - pytorch_model_hub_mixin
7
  ---
8
 
9
- This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
10
  - Library: ynyou/CIFM
11
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - pytorch_model_hub_mixin
7
  ---
8
 
9
+ <!-- This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
10
  - Library: ynyou/CIFM
11
+ - Docs: [More Information Needed] -->
12
+
13
+ # CI-FM: Cellular Interaction Foundation Model
14
+
15
+ ## Overview
16
+ This is the PyTorch implementation of the CI-FM model -- an AI model that can simulate the activities within a living tissue (AI virtual tissue).
17
+ The current version of CI-FM has 138M parameters and is trained on around 23M cells of spatial genomics. The signature functions of CI-FM are:
18
+ - **Embedding** of celllular microenvironments via ```embeddings = model.embed(adata)``` (the 1st Figure below panel D top);
19
+ - **Inference/simulation** of cellular gene expressions within a certain microenvironment via ```expressions = model.predict_cells_at_locations(adata, target_locs)``` (the 1st Figure below panel D bottom, and the 2nd Figure below).
20
+
21
+ The detailed usage of the model can be found in the [tutorial](https://huggingface.co/ynyou/CIFM/blob/main/test.ipynb).
22
+ Before running the tutorial, please set up an environment following the [environment instruction](https://huggingface.co/ynyou/CIFM#environment).
23
+
24
+ More information about the model can be found in the [preprint](https://www.biorxiv.org/content/10.1101/2025.01.25.634867v1).
25
+
26
+ ![](./figures/cifm.png)
27
+ ![](./figures/autoregressive.gif)
28
+
29
+ ## Environment
30
+ I use conda to manage the environment ```conda create -n $MYENV python=3.11```, but it is not the only way to do that.
31
+ After entering the environment, you can clone the model via:
32
+ ```
33
+ # Make sure you have git-lfs installed (https://git-lfs.com), e.g. as:
34
+ git lfs install
35
+ # or if you are under conda environment, you can also install git-lfs via conda as:
36
+ conda install anaconda::git-lfs
37
+
38
+ # clone the model and enter the directory
39
+ git clone https://huggingface.co/ynyou/CIFM
40
+ cd ./CIFM/
41
+ git lfs install ; git lfs pull
42
+ ```
43
+
44
+ The environment can be set up via:
45
+ ```
46
+ # my python version is 3.11, which is manage when creating conda environment: conda create -n $MYENV python=3.11
47
+ pip install torch==2.1.0 --index-url https://download.pytorch.org/whl/cu118
48
+ pip install torch-scatter torch-sparse torch-cluster torch-geometric -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
49
+ pip install scanpy e3nn lightning==2.1.0 transformers numpy==1.26.4
50
+ ```
51
+ where the compatibility between ```torch``` and ```torch-geometric``` is not always guaranteed (lines 2-3), since these two guys are very picky on the platform and the version of other packages. You may need trial-and-error to find the right versions of ```torch``` and ```torch-geometric``` that works for you, e.g., in some machine I once installed via:
52
+ ```
53
+ pip install torch==2.0.1 --index-url https://download.pytorch.org/whl/cu117
54
+ pip install torch-scatter torch-sparse torch-cluster torch-geometric -f https://data.pyg.org/whl/torch-2.0.1+cu117.html
55
+ ```
56
+
57
+ ## Citation
58
+ If you use this code for you research, please cite our paper.
59
+ ```
60
+ @article{you2025building,
61
+ title={Building Foundation Models to Characterize Cellular Interactions via Geometric Self-Supervised Learning on Spatial Genomics},
62
+ author={You, Yuning and Wang, Zitong and Fleisher, Kevin and Liu, Rex and Thomson, Matt},
63
+ journal={bioRxiv},
64
+ pages={2025--01},
65
+ year={2025},
66
+ publisher={Cold Spring Harbor Laboratory}
67
+ }
68
+ ```