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")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ctheodoris/Geneformer") model = AutoModelForMaskedLM.from_pretrained("ctheodoris/Geneformer", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
update refs to get_model_emb_dims
Browse files
geneformer/emb_extractor.py
CHANGED
|
@@ -622,13 +622,13 @@ class EmbExtractor:
|
|
| 622 |
|
| 623 |
if self.exact_summary_stat == "exact_mean":
|
| 624 |
embs = embs.mean(dim=0)
|
| 625 |
-
emb_dims = pu.
|
| 626 |
embs_df = pd.DataFrame(
|
| 627 |
embs_df[0:emb_dims-1].mean(axis="rows"), columns=[self.exact_summary_stat]
|
| 628 |
).T
|
| 629 |
elif self.exact_summary_stat == "exact_median":
|
| 630 |
embs = torch.median(embs, dim=0)[0]
|
| 631 |
-
emb_dims = pu.
|
| 632 |
embs_df = pd.DataFrame(
|
| 633 |
embs_df[0:emb_dims-1].median(axis="rows"), columns=[self.exact_summary_stat]
|
| 634 |
).T
|
|
|
|
| 622 |
|
| 623 |
if self.exact_summary_stat == "exact_mean":
|
| 624 |
embs = embs.mean(dim=0)
|
| 625 |
+
emb_dims = pu.get_model_emb_dims(model)
|
| 626 |
embs_df = pd.DataFrame(
|
| 627 |
embs_df[0:emb_dims-1].mean(axis="rows"), columns=[self.exact_summary_stat]
|
| 628 |
).T
|
| 629 |
elif self.exact_summary_stat == "exact_median":
|
| 630 |
embs = torch.median(embs, dim=0)[0]
|
| 631 |
+
emb_dims = pu.get_model_emb_dims(model)
|
| 632 |
embs_df = pd.DataFrame(
|
| 633 |
embs_df[0:emb_dims-1].median(axis="rows"), columns=[self.exact_summary_stat]
|
| 634 |
).T
|