Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanwharris committed Dec 16, 2021
1 parent 5232f5c commit 255d507
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions flash/core/data/data_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ def __init__(
self._test_input = test_input
self._predict_input = predict_input

if self._train_input and self._val_input and isinstance(val_split, float) and val_split > 0:
raise MisconfigurationException(
"A `val_dataset` was provided with `val_split`. Please, choose one or the other."
)

if self._train_input and (val_split is not None and not self._val_input):
self._train_input, self._val_input = self._split_train_val(self._train_input, val_split)

self._data_fetcher: Optional[BaseDataFetcher] = data_fetcher or self.configure_data_fetcher()

self._train_dataloader_collate_fn = self._resolve_dataloader_collate_fn(self._train_input)
Expand All @@ -122,14 +130,6 @@ def __init__(
self._test_on_after_batch_transfer_fn = self._resolve_on_after_batch_transfer_fn(self._test_input)
self._predict_on_after_batch_transfer_fn = self._resolve_on_after_batch_transfer_fn(self._predict_input)

if self._train_input and self._val_input and isinstance(val_split, float) and val_split > 0:
raise MisconfigurationException(
"A `val_dataset` was provided with `val_split`. Please, choose one or the other."
)

if self._train_input and (val_split is not None and not self._val_input):
self._train_input, self._val_input = self._split_train_val(self._train_input, val_split)

if self._train_input:
self.train_dataloader = self._train_dataloader

Expand Down

0 comments on commit 255d507

Please sign in to comment.