Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
MultiProcessDataLoader takes PathLike data_path (#4908)
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jan 12, 2021
1 parent 5e3757b commit 31ec6a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions allennlp/data/data_loaders/multiprocess_data_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import deque
import logging
from multiprocessing.process import BaseProcess
from os import PathLike
import random
import sys
import traceback
Expand Down Expand Up @@ -42,7 +43,7 @@ class MultiProcessDataLoader(DataLoader):
reader: `DatasetReader`, required
A `DatasetReader` used to load instances from the `data_path`.
data_path: `str`, required
data_path: `Union[str, PathLike]`, required
Passed to `DatasetReader.read()`.
!!! Note
Expand Down Expand Up @@ -139,7 +140,7 @@ class MultiProcessDataLoader(DataLoader):
def __init__(
self,
reader: DatasetReader,
data_path: str,
data_path: Union[str, PathLike],
*,
batch_size: int = None,
drop_last: bool = False,
Expand Down Expand Up @@ -180,7 +181,7 @@ def __init__(
raise ValueError("max_instances_in_memory must be at least 1")

self.reader = reader
self.data_path = data_path
self.data_path = str(data_path)
self.batch_size = batch_size
self.drop_last = drop_last
self.shuffle = shuffle
Expand Down

0 comments on commit 31ec6a5

Please sign in to comment.