Type-fix init_wandb key parameter and _save_wandb_id return#96
Open
lonexreb wants to merge 1 commit intoNVlabs:mainfrom
Open
Type-fix init_wandb key parameter and _save_wandb_id return#96lonexreb wants to merge 1 commit intoNVlabs:mainfrom
lonexreb wants to merge 1 commit intoNVlabs:mainfrom
Conversation
Two small typing nits in src/alpamayo_r1/common/wandb_utils.py: - init_wandb declares `key: str` but the body branches on `if key is not None`, and the comment "otherwise it will load from the home directory" makes clear that None is the supported "use cached credentials" path. Type checkers flag any `init_wandb(None, ...)` call site, even though that's the documented behavior. Update the annotation to `str | None`. While here, expand the one-word docstring to actually describe each parameter (the function is called from external launchers and was previously self-documenting only via the parameter names). - _save_wandb_id has no return annotation. The function returns None (writes to disk and stops). Add `-> None` for consistency with `_check_wandb_id` immediately below it (which already has its return type annotated). Pure typing/docstring change. No runtime behavior change. Signed-off-by: lonexreb <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two small typing nits in
src/alpamayo_r1/common/wandb_utils.py:1.
init_wandbdeclareskey: strbut accepts None.The body explicitly branches on
if key is not Noneand the inline comment ("otherwise it will load from the home directory") describes theNonecase as the supported "use cached credentials" path. Type checkers flag anyinit_wandb(None, ...)call site even though that's documented behavior.2.
_save_wandb_idhas no return annotation.It returns
None. The neighboring_check_wandb_idis fully annotated (-> str | None);_save_wandb_idis the odd one out.Fix
Pure typing/docstring change. No runtime behavior change.
init_wandbparameter annotation tokey: str | None.init_wandbone-word docstring into an Args block — the function is called from external launchers and was previously self-documenting only via parameter names.-> Noneto_save_wandb_id.