We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mlserver/repository.py`
Content:
```
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 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/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:

{"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"}], "after_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            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                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"}]}