MCPcopy
hub / github.com/huggingface/datasets / _to

Method _to

tests/test_arrow_dataset.py:198–209  ·  view source on GitHub ↗
(self, in_memory, tmp_dir, *datasets)

Source from the content-addressed store, hash-verified

196 return dset
197
198 def _to(self, in_memory, tmp_dir, *datasets):
199 if in_memory:
200 datasets = [dataset.map(keep_in_memory=True) for dataset in datasets]
201 else:
202 start = 0
203 while os.path.isfile(os.path.join(tmp_dir, f"dataset{start}.arrow")):
204 start += 1
205 datasets = [
206 dataset.map(cache_file_name=os.path.join(tmp_dir, f"dataset{start + i}.arrow"))
207 for i, dataset in enumerate(datasets)
208 ]
209 return datasets if len(datasets) > 1 else datasets[0]
210
211 def test_dummy_dataset(self, in_memory):
212 with tempfile.TemporaryDirectory() as tmp_dir:

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected