Skip to content

Commit c35ccf3

Browse files
committed
Added include_adversarial option to load_data
1 parent 4e4a243 commit c35ccf3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

raid/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ def download_file(url: str, out: Path, cache=True) -> Path:
3535
return out
3636

3737

38-
def load_data(split: Literal["train", "test", "extra"], fp: str | Path = None):
38+
def load_data(split: Literal["train", "test", "extra"], include_adversarial: bool = True, fp: str = None):
3939
"""Load the given split of RAID into memory from the given filepath, downloading it if it does not exist.
4040
Returns a DataFrame.
4141
"""
4242
if split not in ("train", "test", "extra"):
4343
raise ValueError('`split` must be one of ("train", "test", "extra")')
4444

4545
if fp is None:
46-
fp = RAID_CACHE_DIR / f"{split}.csv"
46+
fname = f"{split}.csv" if include_adversarial else f"{split}_none.csv"
47+
fp = RAID_CACHE_DIR / fname
4748
else:
4849
fp = Path(fp)
49-
fp = download_file(f"{RAID_DATA_URL_BASE}/{split}.csv", fp)
50+
fp = download_file(f"{RAID_DATA_URL_BASE}/{fname}", fp)
5051
return pd.read_csv(fp)

0 commit comments

Comments
 (0)