Commit
·
57bc17e
1
Parent(s):
fce3f6e
move dict loading to function in eval utils
Browse files
docs/source/geneformer.mtl_classifier.rst
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
geneformer.mtl\_classifier
|
| 2 |
-
|
| 3 |
|
| 4 |
.. automodule:: geneformer.mtl_classifier
|
| 5 |
:members:
|
|
|
|
| 1 |
geneformer.mtl\_classifier
|
| 2 |
+
==========================
|
| 3 |
|
| 4 |
.. automodule:: geneformer.mtl_classifier
|
| 5 |
:members:
|
geneformer/evaluation_utils.py
CHANGED
|
@@ -25,15 +25,15 @@ from .emb_extractor import make_colorbar
|
|
| 25 |
|
| 26 |
logger = logging.getLogger(__name__)
|
| 27 |
|
| 28 |
-
# load token dictionary (Ensembl IDs:token)
|
| 29 |
-
with open(TOKEN_DICTIONARY_FILE, "rb") as f:
|
| 30 |
-
gene_token_dict = pickle.load(f)
|
| 31 |
-
|
| 32 |
|
| 33 |
def preprocess_classifier_batch(cell_batch, max_len, label_name):
|
| 34 |
if max_len is None:
|
| 35 |
max_len = max([len(i) for i in cell_batch["input_ids"]])
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
def pad_label_example(example):
|
| 38 |
example[label_name] = np.pad(
|
| 39 |
example[label_name],
|
|
|
|
| 25 |
|
| 26 |
logger = logging.getLogger(__name__)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
def preprocess_classifier_batch(cell_batch, max_len, label_name):
|
| 30 |
if max_len is None:
|
| 31 |
max_len = max([len(i) for i in cell_batch["input_ids"]])
|
| 32 |
|
| 33 |
+
# load token dictionary (Ensembl IDs:token)
|
| 34 |
+
with open(TOKEN_DICTIONARY_FILE, "rb") as f:
|
| 35 |
+
gene_token_dict = pickle.load(f)
|
| 36 |
+
|
| 37 |
def pad_label_example(example):
|
| 38 |
example[label_name] = np.pad(
|
| 39 |
example[label_name],
|