aletlvl commited on
Commit
b5c2cd4
·
verified ·
1 Parent(s): ec49fa4

Upload Nicheformer model

Browse files
Files changed (2) hide show
  1. LICENSE +25 -17
  2. README.md +10 -85
LICENSE CHANGED
@@ -1,21 +1,29 @@
1
- MIT License
2
 
3
- Copyright (c) 2024 Nicheformer Contributors
 
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 3-Clause License
2
 
3
+ Copyright (c) 2024, Theislab
4
+ All rights reserved.
5
 
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
 
 
 
 
8
 
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
 
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md CHANGED
@@ -1,87 +1,3 @@
1
- ---
2
- license: mit
3
- base_model:
4
- - aletlvl/Nicheformer
5
- tags:
6
- - single-cell
7
- - biology
8
- - transcriptomics
9
- ---
10
- # Nicheformer
11
-
12
- Nicheformer is a transformer-based model designed for understanding and predicting cellular niches and their interactions. The model uses masked language modeling to learn representations of cellular contexts and their relationships.
13
-
14
- ## Model Description
15
-
16
- Nicheformer is built on a transformer architecture with the following key features:
17
-
18
- - **Architecture**: Transformer encoder with customizable number of layers and attention heads
19
- - **Pre-training**: Masked Language Modeling (MLM) objective with dynamic masking
20
- - **Input Processing**: Handles cell type, assay, and modality information
21
- - **Positional Encoding**: Supports both learnable and fixed positional embeddings
22
- - **Masking Strategy**:
23
- - 80% of selected tokens are replaced with [MASK]
24
- - 10% are replaced with random tokens
25
- - 10% remain unchanged
26
-
27
- ### Model Architecture
28
-
29
- - Transformer encoder layers: 12
30
- - Hidden dimension: 512
31
- - Attention heads: 16
32
- - Feedforward dimension: 1024
33
- - Maximum sequence length: 1500
34
- - Vocabulary size: 25000
35
- - Masking probability: 15%
36
-
37
- ## Usage
38
-
39
- ```python
40
- from transformers import AutoModelForMaskedLM, AutoTokenizer
41
- import anndata as ad
42
-
43
- # Load model and tokenizer
44
- model = AutoModelForMaskedLM.from_pretrained("aletlvl/Nicheformer")
45
- tokenizer = AutoTokenizer.from_pretrained("aletlvl/Nicheformer")
46
-
47
- # Load your single-cell data
48
- adata = ad.read_h5ad("your_data.h5ad")
49
-
50
- # Tokenize the data
51
- inputs = tokenizer(adata)
52
-
53
- # Get predictions
54
- outputs = model(**inputs)
55
- ```
56
-
57
- ## Training Data
58
-
59
- The model was trained on single-cell gene expression data from various tissues and organisms. It supports:
60
-
61
- - **Modalities**: spatial and dissociated
62
- - **Species**: human and mouse
63
- - **Technologies**:
64
- - MERFISH
65
- - CosMx
66
- - Xenium
67
- - 10x Genomics (various versions)
68
- - CITE-seq
69
- - Smart-seq v4
70
-
71
- ## Limitations
72
-
73
- - The model is specifically designed for gene expression data and may not generalize to other types of biological data
74
- - Performance may vary depending on the quality and type of input data
75
- - The model works best with data from supported species and technologies
76
-
77
- ## License
78
-
79
- This model is released under the MIT License. See the LICENSE file for more details.
80
-
81
- ## Contact
82
-
83
- For questions and issues, please open an issue on the GitHub repository or contact the maintainers.
84
-
85
  # nicheformer
86
 
87
  This is the official repository for **Nicheformer: a foundation model for single-cell and spatial omics**
@@ -119,10 +35,19 @@ git clone https://github.com/theislab/nicheformer.git
119
  cd nicheformer
120
  pip install -e .
121
  ```
 
 
 
 
 
122
 
123
  ## Contact
124
 
125
  For questions and help requests, you can reach out (preferably) on GitHub or email to the corresponding author.
126
 
127
 
128
- [issue-tracker]: https://github.com/theislab/nicheformer/issues
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # nicheformer
2
 
3
  This is the official repository for **Nicheformer: a foundation model for single-cell and spatial omics**
 
35
  cd nicheformer
36
  pip install -e .
37
  ```
38
+ ## Nicheformer data
39
+ We provide examplary data loading scripts in the data subdirectory that can be used as templates for loading the spatial omics datasets and datasets retreived from GEO.
40
+
41
+ ## Pretraining weights
42
+ We provide the Nicheformer pretraining weights on Mendeley data, they can be downloaded from [here](https://data.mendeley.com/preview/87gm9hrgm8?a=d95a6dde-e054-4245-a7eb-0522d6ea7dff).
43
 
44
  ## Contact
45
 
46
  For questions and help requests, you can reach out (preferably) on GitHub or email to the corresponding author.
47
 
48
 
49
+
50
+ [issue-tracker]: https://github.com/theislab/nicheformer/issues
51
+ [changelog]: https://nicheformer.readthedocs.io/latest/changelog.html
52
+ [link-docs]: https://nicheformer.readthedocs.io
53
+ [link-api]: https://nicheformer.readthedocs.io/latest/api.html