Commit ·
5c2759b
1
Parent(s): ad82678
Update testdataset.py
Browse files- testdataset.py +18 -11
testdataset.py
CHANGED
|
@@ -67,6 +67,23 @@ class BigBioConfig(datasets.BuilderConfig):
|
|
| 67 |
subset_id: str = None
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
class TestDataset(datasets.GeneratorBasedBuilder):
|
| 71 |
"""MedNLI"""
|
| 72 |
|
|
@@ -92,16 +109,6 @@ class TestDataset(datasets.GeneratorBasedBuilder):
|
|
| 92 |
|
| 93 |
DEFAULT_CONFIG_NAME = "testdataset_source"
|
| 94 |
|
| 95 |
-
def _download_from_synapse(syn_id, path):
|
| 96 |
-
try:
|
| 97 |
-
import synapseclient
|
| 98 |
-
import synapseutils
|
| 99 |
-
except ModuleNotFoundError as e:
|
| 100 |
-
raise ModuleNotFoundError("synapseclient must be installed. pip install synapseclient")
|
| 101 |
-
syn = synapseclient.login()
|
| 102 |
-
synapseutils.syncFromSynapse(syn, syn_id, path=path)
|
| 103 |
-
# syn.get(entity=syn_id, downloadLocation=path)
|
| 104 |
-
|
| 105 |
def _info(self) -> datasets.DatasetInfo:
|
| 106 |
features = datasets.Features(
|
| 107 |
{
|
|
@@ -124,7 +131,7 @@ class TestDataset(datasets.GeneratorBasedBuilder):
|
|
| 124 |
|
| 125 |
def _split_generators(self, dl_manager) -> List[datasets.SplitGenerator]:
|
| 126 |
# This is where we can call the custom download function for Synapse
|
| 127 |
-
data_dir = dl_manager.download_custom(_SYN_ID,
|
| 128 |
# data_dir = self.config.data_dir
|
| 129 |
if data_dir is None:
|
| 130 |
raise ValueError(
|
|
|
|
| 67 |
subset_id: str = None
|
| 68 |
|
| 69 |
|
| 70 |
+
def download_from_synapse(syn_id, path):
|
| 71 |
+
"""Download files from a Synapse folder or project containing test, train, dev csv files
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
syn_id: Synapse Id of a folder or project
|
| 75 |
+
path: path to download files
|
| 76 |
+
"""
|
| 77 |
+
try:
|
| 78 |
+
import synapseclient
|
| 79 |
+
import synapseutils
|
| 80 |
+
except ModuleNotFoundError as e:
|
| 81 |
+
raise ModuleNotFoundError("synapseclient must be installed. pip install synapseclient")
|
| 82 |
+
syn = synapseclient.login()
|
| 83 |
+
synapseutils.syncFromSynapse(syn, syn_id, path=path)
|
| 84 |
+
# syn.get(entity=syn_id, downloadLocation=path)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
class TestDataset(datasets.GeneratorBasedBuilder):
|
| 88 |
"""MedNLI"""
|
| 89 |
|
|
|
|
| 109 |
|
| 110 |
DEFAULT_CONFIG_NAME = "testdataset_source"
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
def _info(self) -> datasets.DatasetInfo:
|
| 113 |
features = datasets.Features(
|
| 114 |
{
|
|
|
|
| 131 |
|
| 132 |
def _split_generators(self, dl_manager) -> List[datasets.SplitGenerator]:
|
| 133 |
# This is where we can call the custom download function for Synapse
|
| 134 |
+
data_dir = dl_manager.download_custom(_SYN_ID, download_from_synapse)
|
| 135 |
# data_dir = self.config.data_dir
|
| 136 |
if data_dir is None:
|
| 137 |
raise ValueError(
|