prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  starting mlserver using `mlserver start .` is not consistent with  `mlserver start $PWD`
  When I started mlserver using `mlserver start .` in directory tree 
  ```
  └── iris1
      └── 1
          ├── model.joblib
          └── model-settings.json
  ```
  and settings `{"name":"iris1","implementation":"mlserver_sklearn.SKLearnModel","parameters":{"version":"1"}}`
  
  results in an error:
  ```
  mlserver.errors.InvalidModelURI: Invalid URI specified for model iris1 (iris1/1/iris1/1)
  ```
  
  However using
  `mlserver start $PWD` is successful.
  
  </issue>
  <code>
  [start of mlserver/repository.py]
  1 import os
  2 import glob
  3 
  4 from typing import List
  5 
  6 from .settings import ModelParameters, ModelSettings
  7 from .errors import ModelNotFound
  8 from .logging import logger
  9 
  10 DEFAULT_MODEL_SETTINGS_FILENAME = "model-settings.json"
  11 
  12 
  13 class ModelRepository:
  14     """
  15     Model repository, responsible of the discovery of models which can be
  16     loaded onto the model registry.
  17     """
  18 
  19     def __init__(self, root: str = None):
  20         self._root = root
  21 
  22     async def list(self) -> List[ModelSettings]:
  23         all_model_settings = []
  24 
  25         # TODO: Use an async alternative for filesys ops
  26         if self._root:
  27             pattern = os.path.join(self._root, "**", DEFAULT_MODEL_SETTINGS_FILENAME)
  28             matches = glob.glob(pattern, recursive=True)
  29 
  30             for model_settings_path in matches:
  31                 model_settings = self._load_model_settings(model_settings_path)
  32                 all_model_settings.append(model_settings)
  33 
  34         # If there were no matches, try to load model from environment
  35         if not all_model_settings:
  36             # return default
  37             model_settings = ModelSettings()
  38             model_settings.parameters = ModelParameters()
  39             all_model_settings.append(model_settings)
  40 
  41         return all_model_settings
  42 
  43     def _load_model_settings(self, model_settings_path: str) -> ModelSettings:
  44         model_settings = ModelSettings.parse_file(model_settings_path)
  45         model_settings._source = model_settings_path
  46 
  47         # If name not present, default to folder name
  48         model_settings_folder = os.path.dirname(model_settings_path)
  49         folder_name = os.path.basename(model_settings_folder)
  50         if model_settings.name:
  51             if not self._folder_matches(folder_name, model_settings):
  52                 # Raise warning if name is different than folder's name
  53                 logger.warning(
  54                     f"Model name '{model_settings.name}' is different than "
  55                     f"model's folder name '{folder_name}'."
  56                 )
  57         else:
  58             model_settings.name = folder_name
  59 
  60         if not model_settings.parameters:
  61             model_settings.parameters = ModelParameters()
  62 
  63         if not model_settings.parameters.uri:
  64             # If not specified, default to its own folder
  65             default_model_uri = os.path.dirname(model_settings_path)
  66             model_settings.parameters.uri = default_model_uri
  67 
  68         return model_settings
  69 
  70     def _folder_matches(self, folder_name: str, model_settings: ModelSettings) -> bool:
  71         if model_settings.name == folder_name:
  72             return True
  73 
  74         # To be compatible with Triton, check whether the folder name matches
  75         # with the model's version
  76         if model_settings.parameters and model_settings.parameters.version:
  77             model_version = model_settings.parameters.version
  78             if model_version == folder_name:
  79                 return True
  80 
  81         return False
  82 
  83     async def find(self, name: str) -> List[ModelSettings]:
  84         all_settings = await self.list()
  85         selected = []
  86         for model_settings in all_settings:
  87             # TODO: Implement other version policies (e.g. "Last N")
  88             if model_settings.name == name:
  89                 selected.append(model_settings)
  90 
  91         if len(selected) == 0:
  92             raise ModelNotFound(name)
  93 
  94         return selected
  95
  [end of mlserver/repository.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/mlserver/repository.py b/mlserver/repository.py
  --- a/mlserver/repository.py
  +++ b/mlserver/repository.py
  @@ -24,7 +24,8 @@
   
           # TODO: Use an async alternative for filesys ops
           if self._root:
  -            pattern = os.path.join(self._root, "**", DEFAULT_MODEL_SETTINGS_FILENAME)
  +            abs_root = os.path.abspath(self._root)
  +            pattern = os.path.join(abs_root, "**", DEFAULT_MODEL_SETTINGS_FILENAME)
               matches = glob.glob(pattern, recursive=True)
   
               for model_settings_path in matches:
  
verification_info: {"golden_diff": "diff --git a/mlserver/repository.py b/mlserver/repository.py\n--- a/mlserver/repository.py\n+++ b/mlserver/repository.py\n@@ -24,7 +24,8 @@\n \n         # TODO: Use an async alternative for filesys ops\n         if self._root:\n-            pattern = os.path.join(self._root, \"**\", DEFAULT_MODEL_SETTINGS_FILENAME)\n+            abs_root = os.path.abspath(self._root)\n+            pattern = os.path.join(abs_root, \"**\", DEFAULT_MODEL_SETTINGS_FILENAME)\n             matches = glob.glob(pattern, recursive=True)\n \n             for model_settings_path in matches:\n", "issue": "starting mlserver using `mlserver start .` is not consistent with  `mlserver start $PWD`\nWhen I started mlserver using `mlserver start .` in directory tree \r\n```\r\n\u2514\u2500\u2500 iris1\r\n    \u2514\u2500\u2500 1\r\n        \u251c\u2500\u2500 model.joblib\r\n        \u2514\u2500\u2500 model-settings.json\r\n```\r\nand settings `{\"name\":\"iris1\",\"implementation\":\"mlserver_sklearn.SKLearnModel\",\"parameters\":{\"version\":\"1\"}}`\r\n\r\nresults in an error:\r\n```\r\nmlserver.errors.InvalidModelURI: Invalid URI specified for model iris1 (iris1/1/iris1/1)\r\n```\r\n\r\nHowever using\r\n`mlserver start $PWD` is successful.\n", "before_files": [{"content": "import os\nimport glob\n\nfrom typing import List\n\nfrom .settings import ModelParameters, ModelSettings\nfrom .errors import ModelNotFound\nfrom .logging import logger\n\nDEFAULT_MODEL_SETTINGS_FILENAME = \"model-settings.json\"\n\n\nclass ModelRepository:\n    \"\"\"\n    Model repository, responsible of the discovery of models which can be\n    loaded onto the model registry.\n    \"\"\"\n\n    def __init__(self, root: str = None):\n        self._root = root\n\n    async def list(self) -> List[ModelSettings]:\n        all_model_settings = []\n\n        # TODO: Use an async alternative for filesys ops\n        if self._root:\n            pattern = os.path.join(self._root, \"**\", DEFAULT_MODEL_SETTINGS_FILENAME)\n            matches = glob.glob(pattern, recursive=True)\n\n            for model_settings_path in matches:\n                model_settings = self._load_model_settings(model_settings_path)\n                all_model_settings.append(model_settings)\n\n        # If there were no matches, try to load model from environment\n        if not all_model_settings:\n            # return default\n            model_settings = ModelSettings()\n            model_settings.parameters = ModelParameters()\n            all_model_settings.append(model_settings)\n\n        return all_model_settings\n\n    def _load_model_settings(self, model_settings_path: str) -> ModelSettings:\n        model_settings = ModelSettings.parse_file(model_settings_path)\n        model_settings._source = model_settings_path\n\n        # If name not present, default to folder name\n        model_settings_folder = os.path.dirname(model_settings_path)\n        folder_name = os.path.basename(model_settings_folder)\n        if model_settings.name:\n            if not self._folder_matches(folder_name, model_settings):\n                # Raise warning if name is different than folder's name\n                logger.warning(\n                    f\"Model name '{model_settings.name}' is different than \"\n                    f\"model's folder name '{folder_name}'.\"\n                )\n        else:\n            model_settings.name = folder_name\n\n        if not model_settings.parameters:\n            model_settings.parameters = ModelParameters()\n\n        if not model_settings.parameters.uri:\n            # If not specified, default to its own folder\n            default_model_uri = os.path.dirname(model_settings_path)\n            model_settings.parameters.uri = default_model_uri\n\n        return model_settings\n\n    def _folder_matches(self, folder_name: str, model_settings: ModelSettings) -> bool:\n        if model_settings.name == folder_name:\n            return True\n\n        # To be compatible with Triton, check whether the folder name matches\n        # with the model's version\n        if model_settings.parameters and model_settings.parameters.version:\n            model_version = model_settings.parameters.version\n            if model_version == folder_name:\n                return True\n\n        return False\n\n    async def find(self, name: str) -> List[ModelSettings]:\n        all_settings = await self.list()\n        selected = []\n        for model_settings in all_settings:\n            # TODO: Implement other version policies (e.g. \"Last N\")\n            if model_settings.name == name:\n                selected.append(model_settings)\n\n        if len(selected) == 0:\n            raise ModelNotFound(name)\n\n        return selected\n", "path": "mlserver/repository.py"}]}