prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `val_split` + `overfit_batches` gives infinite recursion error
  ## 🐛 Bug
  
  `val_split` + `overfit_batches` gives infinite recursion error on master
  
  </issue>
  <code>
  [start of flash/core/data/splits.py]
  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 of flash/core/data/splits.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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:
  
verification_info: {"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"}]}