Skip to content
Open
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
13 changes: 10 additions & 3 deletions src/triton_cli/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def add(
)

source_type = "local"
model_path = Path(source)
model_path = Path(source.replace(SOURCE_PREFIX_LOCAL, ""))
if not model_path.exists():
raise TritonCLIException(
f"Local file path '{model_path}' provided by --source does not exist"
Expand All @@ -212,8 +212,15 @@ def add(
# point to downloaded engines, etc.
self.__generate_ngc_model(name, ngc_model_name)
else:
logger.debug(f"Copying {model_path} to {version_dir}")
shutil.copy(model_path, version_dir)
if model_path.is_dir():
logger.info(f"Copying model directory {model_path} to {version_dir}")
# If version_dir already exists, remove it first
if version_dir.exists():
shutil.rmtree(version_dir)
shutil.copytree(model_path, version_dir)
else:
logger.info(f"Copying model file {model_path} to {version_dir}")
shutil.copy(model_path, version_dir)

if verbose:
self.list()
Expand Down
Loading