-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
def60ed
commit 68025cc
Showing
12 changed files
with
370 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name = "nemo_run_llama3_8b" | ||
description = "nemo_run_llama3_8b" | ||
test_template_name = "NeMoRun" | ||
|
||
[cmd_args] | ||
"docker_image_url" = "nvcr.io/nvidia/nemo:24.09" | ||
"task" = "pretrain" | ||
"recipe_name" = "llama3_8b" | ||
|
||
[extra_cmd_args] | ||
"trainer.max_steps" = "5" | ||
"log.ckpt.save_on_train_epoch_end" = "False" | ||
"log.ckpt.save_last" = "False" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name = "nemo_run_llama3_8b" | ||
|
||
[[Tests]] | ||
id = "nemo_run_llama3_8b_1" | ||
test_name = "nemo_run_llama3_8b" | ||
num_nodes = "1" | ||
time_limit = "00:30:00" | ||
|
||
[[Tests]] | ||
id = "nemo_run_llama3_8b_2" | ||
test_name = "nemo_run_llama3_8b" | ||
num_nodes = "2" | ||
time_limit = "00:30:00" | ||
[[Tests.dependencies]] | ||
type = "start_post_comp" | ||
id = "nemo_run_llama3_8b_1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from .grading_strategy import NeMoRunGradingStrategy | ||
from .report_generation_strategy import NeMoRunReportGenerationStrategy | ||
from .slurm_command_gen_strategy import NeMoRunSlurmCommandGenStrategy | ||
from .template import NeMoRun | ||
|
||
__all__ = [ | ||
"NeMoRun", | ||
"NeMoRunGradingStrategy", | ||
"NeMoRunReportGenerationStrategy", | ||
"NeMoRunSlurmCommandGenStrategy", | ||
] |
26 changes: 26 additions & 0 deletions
26
src/cloudai/schema/test_template/nemo_run/grading_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from pathlib import Path | ||
|
||
from cloudai import GradingStrategy | ||
|
||
|
||
class NeMoRunGradingStrategy(GradingStrategy): | ||
"""Performance grading strategy for NeMoLauncher test templates on Slurm systems.""" | ||
|
||
def grade(self, directory_path: Path, ideal_perf: float) -> float: | ||
return 0.0 |
26 changes: 26 additions & 0 deletions
26
src/cloudai/schema/test_template/nemo_run/report_generation_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from pathlib import Path | ||
|
||
from cloudai import ReportGenerationStrategy | ||
|
||
|
||
class NeMoRunReportGenerationStrategy(ReportGenerationStrategy): | ||
"""Strategy for generating reports from NeMo run directories.""" | ||
|
||
def can_handle_directory(self, directory_path: Path) -> bool: | ||
return False |
57 changes: 57 additions & 0 deletions
57
src/cloudai/schema/test_template/nemo_run/slurm_command_gen_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from typing import Any, Dict, List, cast | ||
|
||
from cloudai import TestRun | ||
from cloudai.systems.slurm.strategy import SlurmCommandGenStrategy | ||
from cloudai.test_definitions.nemo_run import NeMoRunTestDefinition | ||
|
||
|
||
class NeMoRunSlurmCommandGenStrategy(SlurmCommandGenStrategy): | ||
"""Command generation strategy for NeMo 2.0 on Slurm systems.""" | ||
|
||
def _parse_slurm_args( | ||
self, job_name_prefix: str, env_vars: Dict[str, str], cmd_args: Dict[str, str], tr: TestRun | ||
) -> Dict[str, Any]: | ||
base_args = super()._parse_slurm_args(job_name_prefix, env_vars, cmd_args, tr) | ||
|
||
tdef: NeMoRunTestDefinition = cast(NeMoRunTestDefinition, tr.test.test_definition) | ||
base_args.update({"image_path": tdef.docker_image.installed_path}) | ||
|
||
return base_args | ||
|
||
def generate_test_command(self, env_vars: Dict[str, str], cmd_args: Dict[str, str], tr: TestRun) -> List[str]: | ||
command = ["nemo", "llm"] | ||
|
||
task = cmd_args.get("task", "pretrain") | ||
command.append(task) | ||
|
||
recipe_name = cmd_args.get("recipe_name", "llama3_8b") | ||
command.extend(["--factory", recipe_name]) | ||
|
||
command.append("-y") | ||
|
||
if tr.nodes: | ||
command.append(f"trainer.num_nodes={len(tr.nodes)}") | ||
elif tr.num_nodes > 0: | ||
command.append(f"trainer.num_nodes={tr.num_nodes}") | ||
|
||
if tr.test.extra_cmd_args: | ||
command.append(tr.test.extra_cmd_args) | ||
|
||
return command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from cloudai import TestTemplate | ||
|
||
|
||
class NeMoRun(TestTemplate): | ||
"""Test template for the NeMo-run.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES | ||
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Optional | ||
|
||
from cloudai import CmdArgs, TestDefinition | ||
from cloudai.installer.installables import DockerImage, Installable | ||
|
||
|
||
class NeMoRunCmdArgs(CmdArgs): | ||
"""NeMoRun test command arguments.""" | ||
|
||
docker_image_url: str = "nvcr.io/nvidia/nemo:24.09" | ||
task: Optional[str] = None | ||
recipe_name: Optional[str] = None | ||
|
||
|
||
class NeMoRunTestDefinition(TestDefinition): | ||
"""Test object for NeMoLauncher.""" | ||
|
||
cmd_args: NeMoRunCmdArgs | ||
_docker_image: Optional[DockerImage] = None | ||
|
||
@property | ||
def docker_image(self) -> DockerImage: | ||
if not self._docker_image: | ||
self._docker_image = DockerImage(url=self.cmd_args.docker_image_url) | ||
return self._docker_image | ||
|
||
@property | ||
def installables(self) -> list[Installable]: | ||
"""Get list of installable objects.""" | ||
return [self.docker_image] |
Oops, something went wrong.