We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 954c381 + fdf07a9 commit 22b536dCopy full SHA for 22b536d
nemo/lightning/io/connector.py
@@ -2,7 +2,7 @@
2
import logging
3
import os
4
import shutil
5
-from pathlib import Path, PosixPath, WindowsPath
+from pathlib import Path, PosixPath, PurePath, WindowsPath
6
from typing import Generic, Optional, Tuple, TypeVar
7
8
import pytorch_lightning as pl
@@ -212,6 +212,10 @@ def local_path(self, base_path: Optional[Path] = None) -> Path:
212
213
_base = Path(NEMO_MODELS_CACHE)
214
215
+ # If the useu supplied `hf:///path/to/downloaded/my-model/`
216
+ # then extract the last dir-name (i.e. my-model) and append it to _base
217
+ if str(self).startswith('/'):
218
+ return _base / PurePath((str(self))).name
219
return _base / str(self).replace("://", "/")
220
221
def on_import_ckpt(self, model: pl.LightningModule):
0 commit comments