Commit
·
0d5e221
1
Parent(s):
b77409a
feat: Version working both when streaming=True and streaming=False
Browse files
nucleotide_transformer_downstream_tasks_multilabel.py
CHANGED
|
@@ -84,13 +84,16 @@ class NucleotideTransformerDownstreamTasks(datasets.GeneratorBasedBuilder):
|
|
| 84 |
DEFAULT_CONFIG_NAME = "deepstarr"
|
| 85 |
|
| 86 |
def _info(self):
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
}
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
return datasets.DatasetInfo(
|
| 96 |
# This is the description that will appear on the datasets page.
|
|
@@ -132,10 +135,15 @@ class NucleotideTransformerDownstreamTasks(datasets.GeneratorBasedBuilder):
|
|
| 132 |
sequence, name = str(record.seq), str(record.name)
|
| 133 |
labels = [float(label) for label in name.split("|")[1:]]
|
| 134 |
|
| 135 |
-
|
| 136 |
-
yield key, {
|
| 137 |
"sequence": sequence,
|
| 138 |
"name": name,
|
| 139 |
-
"labels": labels,
|
| 140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
key += 1
|
|
|
|
| 84 |
DEFAULT_CONFIG_NAME = "deepstarr"
|
| 85 |
|
| 86 |
def _info(self):
|
| 87 |
+
features_dict = {
|
| 88 |
+
"sequence": datasets.Value("string"),
|
| 89 |
+
"name": datasets.Value("string"),
|
| 90 |
+
}
|
| 91 |
+
labels_dict = {
|
| 92 |
+
f"label_{i}": datasets.Value(self.config.dtype)
|
| 93 |
+
for i in range(self.config.num_labels)
|
| 94 |
+
}
|
| 95 |
+
features_dict.update(labels_dict)
|
| 96 |
+
features = datasets.Features(features_dict)
|
| 97 |
|
| 98 |
return datasets.DatasetInfo(
|
| 99 |
# This is the description that will appear on the datasets page.
|
|
|
|
| 135 |
sequence, name = str(record.seq), str(record.name)
|
| 136 |
labels = [float(label) for label in name.split("|")[1:]]
|
| 137 |
|
| 138 |
+
sequence_name_dict = {
|
|
|
|
| 139 |
"sequence": sequence,
|
| 140 |
"name": name,
|
|
|
|
| 141 |
}
|
| 142 |
+
|
| 143 |
+
labels_dict = {
|
| 144 |
+
f"label_{i}": labels[i] for i in range(self.config.num_labels)
|
| 145 |
+
}
|
| 146 |
+
sequence_name_dict.update(labels_dict)
|
| 147 |
+
# yield example
|
| 148 |
+
yield key, sequence_name_dict
|
| 149 |
key += 1
|