Skip to content

Commit 22b536d

Browse files
authored
Merge branch 'main' into avavre/gpt_embedder
2 parents 954c381 + fdf07a9 commit 22b536d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nemo/lightning/io/connector.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import os
44
import shutil
5-
from pathlib import Path, PosixPath, WindowsPath
5+
from pathlib import Path, PosixPath, PurePath, WindowsPath
66
from typing import Generic, Optional, Tuple, TypeVar
77

88
import pytorch_lightning as pl
@@ -212,6 +212,10 @@ def local_path(self, base_path: Optional[Path] = None) -> Path:
212212

213213
_base = Path(NEMO_MODELS_CACHE)
214214

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
215219
return _base / str(self).replace("://", "/")
216220

217221
def on_import_ckpt(self, model: pl.LightningModule):

0 commit comments

Comments
 (0)