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
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,6 @@ def load_model_weights_sub_commands(
else:
s5cmd = "./s5cmd"

subcommands.extend(
self.get_s5cmd_copy_command(checkpoint_path, final_weights_folder, subcommands, s5cmd)
)

return subcommands

def get_s5cmd_copy_command(self, checkpoint_path, final_weights_folder, s5cmd):
subcommands = []
base_path = checkpoint_path.split("/")[-1]
Comment thread
yunfeng-scale marked this conversation as resolved.
if base_path.endswith(".tar"):
# If the checkpoint file is a tar file, extract it into final_weights_folder
Expand All @@ -535,6 +527,7 @@ def get_s5cmd_copy_command(self, checkpoint_path, final_weights_folder, s5cmd):
subcommands.append(
f"{s5cmd} --numworkers 512 cp --concurrency 10 {file_selection_str} {os.path.join(checkpoint_path, '*')} {final_weights_folder}"
)

return subcommands

def load_model_files_sub_commands_trt_llm(
Expand Down
50 changes: 50 additions & 0 deletions model-engine/tests/unit/domain/test_llm_use_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,56 @@ async def test_create_model_endpoint_text_generation_inference_use_case_success(
)


def test_load_model_weights_sub_commands(
fake_model_bundle_repository,
fake_model_endpoint_service,
fake_docker_repository_image_always_exists,
fake_model_primitive_gateway,
fake_llm_artifact_gateway,
):
fake_model_endpoint_service.model_bundle_repository = fake_model_bundle_repository
bundle_use_case = CreateModelBundleV2UseCase(
model_bundle_repository=fake_model_bundle_repository,
docker_repository=fake_docker_repository_image_always_exists,
model_primitive_gateway=fake_model_primitive_gateway,
)
llm_bundle_use_case = CreateLLMModelBundleV1UseCase(
create_model_bundle_use_case=bundle_use_case,
model_bundle_repository=fake_model_bundle_repository,
llm_artifact_gateway=fake_llm_artifact_gateway,
docker_repository=fake_docker_repository_image_always_exists,
)

framework = LLMInferenceFramework.VLLM
framework_image_tag = "0.2.7"
checkpoint_path = "fake-checkpoint"
final_weights_folder = "test_folder"

subcommands = llm_bundle_use_case.load_model_weights_sub_commands(
framework, framework_image_tag, checkpoint_path, final_weights_folder
)

expected_result = [
"./s5cmd --numworkers 512 cp --concurrency 10 --include '*.model' --include '*.json' --include '*.safetensors' --exclude 'optimizer*' fake-checkpoint/* test_folder",
]
assert expected_result == subcommands

framework = LLMInferenceFramework.TEXT_GENERATION_INFERENCE
framework_image_tag = "1.0.0"
checkpoint_path = "fake-checkpoint"
final_weights_folder = "test_folder"

subcommands = llm_bundle_use_case.load_model_weights_sub_commands(
framework, framework_image_tag, checkpoint_path, final_weights_folder
)

expected_result = [
"s5cmd > /dev/null || conda install -c conda-forge -y s5cmd",
"s5cmd --numworkers 512 cp --concurrency 10 --include '*.model' --include '*.json' --include '*.safetensors' --exclude 'optimizer*' fake-checkpoint/* test_folder",
]
assert expected_result == subcommands


@pytest.mark.asyncio
async def test_create_model_endpoint_trt_llm_use_case_success(
test_api_key: str,
Expand Down