Repository: bentoml/BentoML

Issue:
Files are read as Models
**Describe the bug**

<!--- A clear and concise description of what the bug is. -->
When a .DS_Store file is created in the `bentoml/models` folder, I think `store.py`'s `list` method tries loading it. I think the check for directories isn't working as intended (https://github.com/bentoml/BentoML/blob/4308c67f327d9524025e5c348ded22553824c1d4/bentoml/_internal/store.py#L69), but I'm not sure. Additionally, this happens when any file is created in the models folder, but not when folders are created.


**To Reproduce**

Steps to reproduce the issue:
1. Go to `~/bentoml/models/`
2. Create a `.DS_Store` file
3. Run `bentoml models list`
4. See error


**Expected behavior**

<!--- A clear and concise description of what you expected to happen. -->
All files should be skipped when scanning for models.


**Screenshots/Logs**

```shell
[19:12:41] WARNING  [boot] converting .DS_Store to lowercase: .ds_store         
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/__main__.py", line 4, in <module>
    create_bentoml_cli()()
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/cli/model_management.py", line 90, in list_models
    models = model_store.list(model_name)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/store.py", line 63, in list
    return [
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/store.py", line 64, in <listcomp>
    ver for _d in sorted(self._fs.listdir("/")) for ver in self.list(_d)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/store.py", line 67, in list
    _tag = Tag.from_taglike(tag)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/types.py", line 221, in from_taglike
    return cls.from_str(taglike)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/types.py", line 226, in from_str
    return cls(tag_str, None)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/types.py", line 180, in __init__
    validate_tag_str(lname)
  File "/Users/spence/Library/Python/3.8/lib/python/site-packages/bentoml/_internal/utils/validation.py", line 29, in validate_tag_str
    raise InvalidArgument(f"{value} is not a valid tag: " + ", and ".join(errors))
bentoml.exceptions.InvalidArgument: .ds_store is not a valid tag: a tag's name or version must consist of alphanumeric characters, '_', '-', or '.', and must start and end with an alphanumeric character
```


**Environment:**
 - OS: MacOS 12.2.1
 - Python 3.8.9
 - BentoML 1.0.0a4


**Additional context**

MacOS creates .DS_Store files automatically, so I ran into this bug after opening the folder and sorting the files 😅



Discussion:

Resolving patch:
diff --git a/bentoml/_internal/store.py b/bentoml/_internal/store.py
--- a/bentoml/_internal/store.py
+++ b/bentoml/_internal/store.py
@@ -61,7 +61,10 @@ def __init__(self, base_path: t.Union[PathType, FS], item_type: t.Type[Item]):
     def list(self, tag: t.Optional[t.Union[Tag, str]] = None) -> t.List[Item]:
         if not tag:
             return [
-                ver for _d in sorted(self._fs.listdir("/")) for ver in self.list(_d)
+                ver
+                for _d in sorted(self._fs.listdir("/"))
+                if self._fs.isdir(_d)
+                for ver in self.list(_d)
             ]
 
         _tag = Tag.from_taglike(tag)


Test patch:
diff --git a/tests/unit/_internal/test_store.py b/tests/unit/_internal/test_store.py
--- a/tests/unit/_internal/test_store.py
+++ b/tests/unit/_internal/test_store.py
@@ -1,3 +1,4 @@
+import os
 import sys
 import typing as t
 from typing import TYPE_CHECKING
@@ -66,6 +67,8 @@ def __init__(self, base_path: "t.Union[PathType, FS]"):
 def test_store(tmpdir: "Path"):
     store = DummyStore(tmpdir)
 
+    open(os.path.join(tmpdir, ".DS_store"), "a")
+
     DummyItem.store = store
     oldtime = datetime.now()
     DummyItem.create("test:version1")