Repository: bentoml/BentoML

Issue:
bug: Pulling latest version from Remote Yatai Store does not work on Windows - Path Error
### Describe the bug

I pushed a working model to our local Yatai server. However, I can not pull it again, as the latest model is not found on remote Bento store.
If I add the version code manually the Bento is found but, I get a BentoMLException.



Error with latest in the tag:
 File "C:\edge_bento\main.py", line 11, in <module>
    main()
  File "C:\edge_bento\edge_bento\main.py", line 7, in main
    bentoml.pull("pytorch_mnist_demo:latest")
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\bentos.py", line 267, in pull
    _cloud_client.pull_bento(tag, force=force, bento_store=_bento_store)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\_internal\cloud\bentocloud.py", line 416, in pull_bento
    return self._do_pull_bento(
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\_internal\cloud\bentocloud.py", line 458, in _do_pull_bento
    raise BentoMLException(f'Bento "{_tag}" not found on remote Bento store')
bentoml.exceptions.BentoMLException: Bento "pytorch_mnist_demo:latest" not found on remote Bento store


Error with specific version in the tag:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Finished downloading model "pytorch_mnist:nr7glwfsc226qaav" files           │
│ Successfully pulled model "pytorch_mnist:nr7glwfsc226qaav"                  │
│ Finished downloading all bento "pytorch_mnist_demo:eiijhwvsdsnssaav" files  │
└─────────────────────────────────────────────────────────────────────────────┘
Pulling bento "pytorch_mnist_demo:eiijhwvsdsnssaav" --- 0.0% • 71… • ?   • 0:0…
                                                               by…             
 Downloading model "pytorch_mnist:nr7glwfsc226qaav" --- 0.0% • 8,… • 11… • 0:0…
                                                               by…   MB…       Traceback (most recent call last):
  File "C:\edge_bento\main.py", line 11, in <module>
    main()
  File "C:\edge_bento\main.py", line 7, in main
    bentoml.pull("pytorch_mnist_demo:eiijhwvsdsnssaav")
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\bentos.py", line 267, in pull
    _cloud_client.pull_bento(tag, force=force, bento_store=_bento_store)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\_internal\cloud\bentocloud.py", line 416, in pull_bento
    return self._do_pull_bento(
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\simple_di\__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\bentoml\_internal\cloud\bentocloud.py", line 547, in _do_pull_bento
    temp_fs.makedirs(str(p.parent), recreate=True)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\fs\base.py", line 1124, in makedirs
    dir_paths = tools.get_intermediate_dirs(self, path)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\fs\tools.py", line 77, in get_intermediate_dirs
    resource = fs.getinfo(path)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\fs\osfs.py", line 283, in getinfo
    _path = self.validatepath(path)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\fs\osfs.py", line 686, in validatepath
    return super(OSFS, self).validatepath(path)
  File "C:\Users\---\AppData\Local\miniconda3\envs\edge\lib\site-packages\fs\base.py", line 1581, in validatepath
    raise errors.InvalidCharsInPath(path)
fs.errors.InvalidCharsInPath: path '/env\conda' contains invalid characters

### To reproduce
```
import bentoml
def main() -> None:
    bentoml.pull("pytorch_mnist_demo:latest")
    _ = bentoml.load("pytorch_mnist_demo:latest")

if __name__ == "__main__":
    main()
```
### Expected behavior

I would like to download the latest Bento from our Yatai Server.

### Environment

bentoml, version 1.1.11
Python 3.10.13
platform: windows


Discussion:
https://github.com/bentoml/BentoML/blob/fa6420e49eab15b544eccd8d7f562fa6544947e8/src/bentoml/_internal/cloud/bentocloud.py#L547

If I change the line to:
```
temp_fs.makedirs(str(p.parent).replace('\\', '/'), recreate=True)
```
it works on my windows system. Is there any problem encountered so far using bentoml with windows?
Hello, I have the same problem and your solution fixes it for me. Thanks! 
Would be cool if you could include this in the next release.

Resolving patch:
diff --git a/src/bentoml/_internal/cloud/bentocloud.py b/src/bentoml/_internal/cloud/bentocloud.py
--- a/src/bentoml/_internal/cloud/bentocloud.py
+++ b/src/bentoml/_internal/cloud/bentocloud.py
@@ -544,7 +544,7 @@ def pull_model(model_tag: Tag):
                                 continue
                             p = Path(member.name)
                             if p.parent != Path("."):
-                                temp_fs.makedirs(str(p.parent), recreate=True)
+                                temp_fs.makedirs(p.parent.as_posix(), recreate=True)
                             temp_fs.writebytes(member.name, f.read())
                         bento = Bento.from_fs(temp_fs)
                         for model_tag in remote_bento.manifest.models:


Test patch: