Repository navigation
fix(customizer): fix 500 on validation failure for automodel, busybox default #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
e59372d
62eb289
c64115f
38b8a80
e21bc92
6731310
988fafd
d924082
420a9b3
7cbe3c6
13ba98f
1fd00f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Tests for AutomodelJob.compile error mapping. | ||
|
|
||
| ``validate_for_training`` rejects inconsistent parallelism/batch topologies. | ||
| Those are user input errors, so they have to leave ``compile`` as | ||
| ``PlatformJobCompilationError`` — the api_factory only maps that type to a | ||
| 422, and anything else escapes as a 500. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import asyncio | ||
| from typing import Any | ||
| from unittest.mock import patch | ||
|
|
||
| import pytest | ||
| from nemo_automodel_plugin.jobs.jobs import AutomodelJob | ||
| from nemo_automodel_plugin.schema import AutomodelJobOutput | ||
| from nemo_platform_plugin.jobs.exceptions import PlatformJobCompilationError | ||
|
|
||
|
|
||
| def _make_canonical(**parallelism: Any) -> AutomodelJobOutput: | ||
| return AutomodelJobOutput.model_validate( | ||
| { | ||
| "model": "default/base", | ||
| "dataset": {"training": "default/train"}, | ||
| "training": {"training_type": "sft"}, | ||
| "schedule": {"epochs": 1}, | ||
| "batch": {"global_batch_size": 4, "micro_batch_size": 1}, | ||
| "optimizer": {}, | ||
| "parallelism": {"num_nodes": 2, "num_gpus_per_node": 8, **parallelism}, | ||
| "output": {"name": "out", "type": "adapter", "fileset": "out-fs"}, | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| def _compile(canonical: AutomodelJobOutput) -> Any: | ||
| return asyncio.run( | ||
| AutomodelJob.compile( | ||
| workspace="default", | ||
| spec=canonical, | ||
| entity_client=object(), | ||
| job_name=None, | ||
| async_sdk=object(), | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| class TestCompileValidationErrors: | ||
| def test_indivisible_batch_raises_compilation_error(self) -> None: | ||
| # global_batch_size=4 with data_parallel_size=16 (2 nodes x 8 GPUs, TP=1). | ||
| canonical = _make_canonical(tensor_parallel_size=1) | ||
| with patch("nemo_automodel_plugin.jobs.jobs.require_container_runtime"): | ||
| with pytest.raises(PlatformJobCompilationError, match="global_batch_size"): | ||
| _compile(canonical) | ||
|
|
||
| def test_indivisible_model_parallel_raises_compilation_error(self) -> None: | ||
| # 16 total GPUs is not divisible by tensor_parallel_size=5. | ||
| canonical = _make_canonical(tensor_parallel_size=5) | ||
| with patch("nemo_automodel_plugin.jobs.jobs.require_container_runtime"): | ||
| with pytest.raises(PlatformJobCompilationError, match="Total GPUs"): | ||
| _compile(canonical) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.