We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`val_split` + `overfit_batches` gives infinite recursion error
## 🐛 Bug

`val_split` + `overfit_batches` gives infinite recursion error on master

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `flash/core/data/splits.py`
Content:
```
1 from typing import Any, List
2 
3 import numpy as np
4 from pytorch_lightning.utilities.exceptions import MisconfigurationException
5 from torch.utils.data import Dataset
6 
7 
8 class SplitDataset(Dataset):
9     """
10     SplitDataset is used to create Dataset Subset using indices.
11 
12     Args:
13 
14         dataset: A dataset to be splitted
15         indices: List of indices to expose from the dataset
16         use_duplicated_indices: Wether to allow duplicated indices.
17 
18     Example::
19 
20         split_ds = SplitDataset(dataset, indices=[10, 14, 25])
21 
22         split_ds = SplitDataset(dataset, indices=[10, 10, 10, 14, 25], use_duplicated_indices=True)
23 
24     """
25 
26     _INTERNAL_KEYS = ("dataset", "indices", "data")
27 
28     def __init__(self, dataset: Any, indices: List[int] = [], use_duplicated_indices: bool = False) -> None:
29         if not isinstance(indices, list):
30             raise MisconfigurationException("indices should be a list")
31 
32         if use_duplicated_indices:
33             indices = list(indices)
34         else:
35             indices = list(np.unique(indices))
36 
37         if np.max(indices) >= len(dataset) or np.min(indices) < 0:
38             raise MisconfigurationException(f"`indices` should be within [0, {len(dataset) -1}].")
39 
40         self.dataset = dataset
41         self.indices = indices
42 
43     def __getattr__(self, key: str):
44         if key in self._INTERNAL_KEYS:
45             return getattr(self, key)
46         return getattr(self.dataset, key)
47 
48     def __setattr__(self, name: str, value: Any) -> None:
49         if name in self._INTERNAL_KEYS:
50             self.__dict__[name] = value
51         else:
52             setattr(self.dataset, name, value)
53 
54     def __getitem__(self, index: int) -> Any:
55         return self.dataset[self.indices[index]]
56 
57     def __len__(self) -> int:
58         return len(self.indices)
59
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/flash/core/data/splits.py b/flash/core/data/splits.py
--- a/flash/core/data/splits.py
+++ b/flash/core/data/splits.py
@@ -13,7 +13,7 @@
 
         dataset: A dataset to be splitted
         indices: List of indices to expose from the dataset
-        use_duplicated_indices: Wether to allow duplicated indices.
+        use_duplicated_indices: Whether to allow duplicated indices.
 
     Example::
 
@@ -41,9 +41,9 @@
         self.indices = indices
 
     def __getattr__(self, key: str):
-        if key in self._INTERNAL_KEYS:
-            return getattr(self, key)
-        return getattr(self.dataset, key)
+        if key not in self._INTERNAL_KEYS:
+            return self.dataset.__getattribute__(key)
+        raise AttributeError
 
     def __setattr__(self, name: str, value: Any) -> None:
         if name in self._INTERNAL_KEYS:

{"golden_diff": "diff --git a/flash/core/data/splits.py b/flash/core/data/splits.py\n--- a/flash/core/data/splits.py\n+++ b/flash/core/data/splits.py\n@@ -13,7 +13,7 @@\n \n         dataset: A dataset to be splitted\n         indices: List of indices to expose from the dataset\n-        use_duplicated_indices: Wether to allow duplicated indices.\n+        use_duplicated_indices: Whether to allow duplicated indices.\n \n     Example::\n \n@@ -41,9 +41,9 @@\n         self.indices = indices\n \n     def __getattr__(self, key: str):\n-        if key in self._INTERNAL_KEYS:\n-            return getattr(self, key)\n-        return getattr(self.dataset, key)\n+        if key not in self._INTERNAL_KEYS:\n+            return self.dataset.__getattribute__(key)\n+        raise AttributeError\n \n     def __setattr__(self, name: str, value: Any) -> None:\n         if name in self._INTERNAL_KEYS:\n", "issue": "`val_split` + `overfit_batches` gives infinite recursion error\n## \ud83d\udc1b Bug\r\n\r\n`val_split` + `overfit_batches` gives infinite recursion error on master\n", "before_files": [{"content": "from typing import Any, List\n\nimport numpy as np\nfrom pytorch_lightning.utilities.exceptions import MisconfigurationException\nfrom torch.utils.data import Dataset\n\n\nclass SplitDataset(Dataset):\n    \"\"\"\n    SplitDataset is used to create Dataset Subset using indices.\n\n    Args:\n\n        dataset: A dataset to be splitted\n        indices: List of indices to expose from the dataset\n        use_duplicated_indices: Wether to allow duplicated indices.\n\n    Example::\n\n        split_ds = SplitDataset(dataset, indices=[10, 14, 25])\n\n        split_ds = SplitDataset(dataset, indices=[10, 10, 10, 14, 25], use_duplicated_indices=True)\n\n    \"\"\"\n\n    _INTERNAL_KEYS = (\"dataset\", \"indices\", \"data\")\n\n    def __init__(self, dataset: Any, indices: List[int] = [], use_duplicated_indices: bool = False) -> None:\n        if not isinstance(indices, list):\n            raise MisconfigurationException(\"indices should be a list\")\n\n        if use_duplicated_indices:\n            indices = list(indices)\n        else:\n            indices = list(np.unique(indices))\n\n        if np.max(indices) >= len(dataset) or np.min(indices) < 0:\n            raise MisconfigurationException(f\"`indices` should be within [0, {len(dataset) -1}].\")\n\n        self.dataset = dataset\n        self.indices = indices\n\n    def __getattr__(self, key: str):\n        if key in self._INTERNAL_KEYS:\n            return getattr(self, key)\n        return getattr(self.dataset, key)\n\n    def __setattr__(self, name: str, value: Any) -> None:\n        if name in self._INTERNAL_KEYS:\n            self.__dict__[name] = value\n        else:\n            setattr(self.dataset, name, value)\n\n    def __getitem__(self, index: int) -> Any:\n        return self.dataset[self.indices[index]]\n\n    def __len__(self) -> int:\n        return len(self.indices)\n", "path": "flash/core/data/splits.py"}], "after_files": [{"content": "from typing import Any, List\n\nimport numpy as np\nfrom pytorch_lightning.utilities.exceptions import MisconfigurationException\nfrom torch.utils.data import Dataset\n\n\nclass SplitDataset(Dataset):\n    \"\"\"\n    SplitDataset is used to create Dataset Subset using indices.\n\n    Args:\n\n        dataset: A dataset to be splitted\n        indices: List of indices to expose from the dataset\n        use_duplicated_indices: Whether to allow duplicated indices.\n\n    Example::\n\n        split_ds = SplitDataset(dataset, indices=[10, 14, 25])\n\n        split_ds = SplitDataset(dataset, indices=[10, 10, 10, 14, 25], use_duplicated_indices=True)\n\n    \"\"\"\n\n    _INTERNAL_KEYS = (\"dataset\", \"indices\", \"data\")\n\n    def __init__(self, dataset: Any, indices: List[int] = [], use_duplicated_indices: bool = False) -> None:\n        if not isinstance(indices, list):\n            raise MisconfigurationException(\"indices should be a list\")\n\n        if use_duplicated_indices:\n            indices = list(indices)\n        else:\n            indices = list(np.unique(indices))\n\n        if np.max(indices) >= len(dataset) or np.min(indices) < 0:\n            raise MisconfigurationException(f\"`indices` should be within [0, {len(dataset) -1}].\")\n\n        self.dataset = dataset\n        self.indices = indices\n\n    def __getattr__(self, key: str):\n        if key not in self._INTERNAL_KEYS:\n            return self.dataset.__getattribute__(key)\n        raise AttributeError\n\n    def __setattr__(self, name: str, value: Any) -> None:\n        if name in self._INTERNAL_KEYS:\n            self.__dict__[name] = value\n        else:\n            setattr(self.dataset, name, value)\n\n    def __getitem__(self, index: int) -> Any:\n        return self.dataset[self.indices[index]]\n\n    def __len__(self) -> int:\n        return len(self.indices)\n", "path": "flash/core/data/splits.py"}]}