Instructions to use ctheodoris/Geneformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ctheodoris/Geneformer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="ctheodoris/Geneformer")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ctheodoris/Geneformer") model = AutoModelForMaskedLM.from_pretrained("ctheodoris/Geneformer") - Inference
- Notebooks
- Google Colab
- Kaggle
Update geneformer/emb_extractor.py
#453
by hchen725 - opened
geneformer/emb_extractor.py
CHANGED
|
@@ -596,6 +596,12 @@ class EmbExtractor:
|
|
| 596 |
filtered_input_data = pu.load_and_filter(
|
| 597 |
self.filter_data, self.nproc, input_data_file
|
| 598 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
if cell_state is not None:
|
| 600 |
filtered_input_data = pu.filter_by_dict(
|
| 601 |
filtered_input_data, cell_state, self.nproc
|
|
|
|
| 596 |
filtered_input_data = pu.load_and_filter(
|
| 597 |
self.filter_data, self.nproc, input_data_file
|
| 598 |
)
|
| 599 |
+
|
| 600 |
+
# Check to make sure that all the labels exist in the tokenized data:
|
| 601 |
+
if self.emb_label is not None:
|
| 602 |
+
for label in self.emb_label:
|
| 603 |
+
assert label in filtered_input_data.features.keys(), f"Attribute `{label}` not present in dataset features"
|
| 604 |
+
|
| 605 |
if cell_state is not None:
|
| 606 |
filtered_input_data = pu.filter_by_dict(
|
| 607 |
filtered_input_data, cell_state, self.nproc
|