Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
aead1f6 to
1ff1187
Compare
51728c3 to
20bef93
Compare
f171d06 to
619a2a9
Compare
20bef93 to
9de2314
Compare
619a2a9 to
4ae5f5b
Compare
9de2314 to
d366601
Compare
d366601 to
f49bec5
Compare
f49bec5 to
de11cca
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
Two RISK findings affect import migration: imports from the released converter path need two passes, and multiline imports from the vLLM server aren't migrated. Runtime alias resolution retains class identity.
I reviewed all six changed files and their directly affected paths. This was a source-only review; I didn't run tests.
Inline comments (escaped v1):
-
scripts/migrate_imports.pyline 264: RISK — Include the released module path in the alias migration.With this PR's mappings, migrating
from nemo_gym.responses_converter import VLLMConverterproducesfrom nemo_gym.models.chat_completions_converter import VLLMConverter: the output still imports the newly deprecated alias. A second pass changes it again. The state alias has the same failure._destinations()looks up name moves under the original module, but the new entries list these renames only under the destination module. The constructor propagates entries from old modules to new modules, not in the reverse direction. This leaves downstream migration output dependent on aliases scheduled for removal.Could you add the following entry to
_RENAMED_CONVERTER_NAMESalongside the canonical-module entry?"nemo_gym.responses_converter": _VLLM_CONVERTER_ALIASES,
This supplies the missing original-path lookup without changing the canonical-module entries or runtime resolution. The invariant is that one pass removes these deprecated imports while preserving their local bindings. Please verify this suggested addition before adopting it.
Proposed checks, not executed: Load the real moves and public APIs, then migrate a downstream file importing each alias from
nemo_gym.responses_converter. Expectfrom nemo_gym.models import ChatCompletionsConverter as VLLMConverterfor the converter andfrom nemo_gym.models.chat_completions_converter import ChatCompletionsConverterState as VLLMConverterResponsesToChatCompletionsStatefor the state. A second pass must leave both unchanged. Check explicitasbindings and an unrelated imported name too. Preserve the current migration destinations for canonical-module and package imports, and retain the identity/warning assertions for all four legacy entry points and the existingResponsesConvertercases in the moved-path tests. -
scripts/migrate_imports.pyline 364: RISK — Admit registered server modules to the Python import rewrite.The new server mapping doesn't migrate this normal import:
from responses_api_models.vllm_model.app import ( VLLMConverter, VLLMModel, )
This AST guard skips modules outside
nemo_gym. The subsequent text fallback excludes parentheses, and there is no fully qualified alias for the dotted rewrite to match. The command therefore leaves the deprecated import unchanged, and--checkreports no migration needed. Either alias is affected; a single-line server import does migrate.Could you replace the guard with this scoped extension?
if not ( isinstance(node, ast.ImportFrom) and node.module and (node.module.split(".")[0] == "nemo_gym" or node.module in self.names) ): continue
The preceding relative-import branch still excludes relative imports. Existing destination grouping can then split the converter import from
VLLMModel, preserving local bindings and leaving unrelated third-party modules outside the rewrite. Please verify this suggested replacement before adopting it.Proposed checks, not executed: Migrate multiline server imports containing each alias, an explicit
asbinding, andVLLMModel. ExpectChatCompletionsConverterfromnemo_gym.models, the state class from its defining converter module, andVLLMModelstill from the server. The output must parse and remain unchanged on a second pass. Preserve single-line migration, tab indentation, and the existing inline-suite assertion that a false condition executes neither split import. Preserve the existing handling that leaves split imports with internal comments unchanged and emits a manual-review note, plus trailing pragma propagation and unrelated imports in the migration tests.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
VLLMConverter and VLLMConverterResponsesToChatCompletionsState name a vendor, but the converter is not specific to vLLM: the LiteLLM and Azure OpenAI model servers use it too. Nothing in the repository uses them any more, so deprecate them in favor of ChatCompletionsConverter and ChatCompletionsConverterState. The aliases shipped in nemo_gym.responses_converter since 0.4.0, and servers imported them from the vLLM model server, which re-exported them. They keep resolving at nemo_gym.responses_converter, nemo_gym.models.chat_completions_converter, nemo_gym.models, and responses_api_models.vllm_model.app, with a DeprecationWarning naming the new name, until nemo_gym 0.10.0. The vLLM model server serves them through the same moved-names __getattr__ the library modules use, in place of its plain re-export. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
migrate_imports.py left two kinds of import at a deprecated name. A name renamed in a module that moved earlier is listed under the module's new path, and the runtime serves it at the old path too. The script only looked under the old path, so `from nemo_gym.responses_converter import VLLMConverter` became `from nemo_gym.models.chat_completions_converter import VLLMConverter`, and a second pass was needed. ResponsesConverter had the same gap. The script now lists such names under every old path of their module. The Python rewrite skipped every module outside nemo_gym, and the text fallback handles only one-line imports, so a wrapped import from responses_api_models.vllm_model.app kept VLLMConverter. The rewrite now also covers modules outside nemo_gym that list moved names. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
768077e to
da67d5a
Compare
Follows #5528, which renamed
ResponsesConvertertoChatCompletionsConverterand moved every in-repo use of theVLLMConverteraliases to the new names.What changed and why
VLLMConverterandVLLMConverterResponsesToChatCompletionsStateare aliases of the Responses API to Chat Completions converter. They name a vendor, but the converter is not specific to vLLM: the LiteLLM and Azure OpenAI model servers use it too. After #5528 nothing in the repository uses them, so this PR deprecates them in favor ofChatCompletionsConverterandChatCompletionsConverterState.nemo_gym.responses_convertersince 0.4.0, so they are not deleted. They become entries in the_RENAMED_CONVERTER_NAMESblock that refactor(models): rename ResponsesConverter to ChatCompletionsConverter #5528 adds tonemo_gym/_moved_paths.py(since="0.8.0", removed in 0.10.0). Each old path resolves to the identical class and warns once with aDeprecationWarningthat names the new name:nemo_gym.responses_converter(released path)nemo_gym.models.chat_completions_converter(the alias assignments are removed)nemo_gym.models(dropped from_PUBLIC_API)responses_api_models.vllm_model.app, which re-exported both aliases, and which other servers imported them fromresponses_api_models.vllm_model.appdrops its plain re-export and installs the samemoved_names_getattr__getattr__that library modules use. It works there because the vLLM model server runs with this repository'snemo_gym, and the module imports cleanly in the core test environment. That keeps the vLLM model server path warning with the other paths instead of serving a silent re-export.scripts/migrate_imports.pynow rewrites imports of the aliases in one pass:from nemo_gym.responses_converter import VLLMConverterbecame an import of the same deprecated name fromnemo_gym.models.chat_completions_converter, and needed a second pass.ResponsesConverterfrom refactor(models): rename ResponsesConverter to ChatCompletionsConverter #5528 had the same gap. The script now lists such names under every old path of their module, as the runtime does.nemo_gym, and the text fallback handles only one-line imports, so a wrapped import fromresponses_api_models.vllm_model.appkeptVLLMConverter. The rewrite now also covers modules outsidenemo_gymthat list moved names. Other server modules stay out of it.Downstream impact
No NeMo RL code imports either alias. A search of local NeMo RL checkouts found no uses, and neither alias appears in what the moved-paths tests record as NeMo RL's imports. Out-of-tree code that uses the aliases keeps working through 0.9.x with a deprecation warning.
python scripts/migrate_imports.py <paths>rewrites those imports, because it reads the new entries.Issue
Part of the package reorganization (#5166). A separate issue is unnecessary: this is the follow-up to #5528's rename.
Tests
The moved-paths test that checks each old converter name now covers both aliases at all four old paths. In a fresh interpreter it asserts that the old name is the same object as the new class, that exactly one deprecation message names the old path, and that the message names the new class and 0.10.0. With the new
_moved_paths.pyentries removed, all of the new cases fail. The migration script tests now check that an import of a renamed name from its module's old path migrates in one pass, and that a wrapped import from a server module that lists moved names is split, leaving its other names in place. Both fail without the script change. The converter unit test that asserted the aliases equal the new classes is removed, because the moved-paths test now covers it.Validation
scripts/migrate_imports.py --check .reports the same files with and without the script change, so it rewrites nothing new in the repository. The full core suite and the server suites (gym env test) are left to CI.Rollout evidence: N/A. This only deprecates names. The converter's behavior is unchanged, and every old name resolves to the identical class.