Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/llmcompressor/pytorch/model_load/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def load_safetensors_state_dict(file_path: str) -> Dict[str, torch.Tensor]:
def copy_python_files_from_model_cache(model, save_path: str):
config = model.config
cache_path = None
if hasattr(config, "_name_or_path"):
if hasattr(config, "_name_or_path") and len(config._name_or_path.strip()) > 0:
import os
import shutil

Expand Down
7 changes: 6 additions & 1 deletion src/llmcompressor/transformers/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ def infer_recipe_from_model_path(model_path: Union[str, Path]) -> Optional[str]:
- Hugging face model ID
:return: The path to the recipe file if found, None otherwise.
"""
model_path = model_path.as_posix() if isinstance(model_path, Path) else model_path
model_path = (
model_path.as_posix() if isinstance(model_path, Path) else model_path.strip()
)
if model_path == "":
logger.debug("got path_or_name=<empty string>" "unable to find recipe")
return None

if os.path.isdir(model_path) or os.path.isfile(model_path):
# Model path is a local path to the model directory or file
Expand Down