chore(utils): add type annotations to public functions in utils.py#2237
Open
nuthalapativarun wants to merge 3 commits into
Open
chore(utils): add type annotations to public functions in utils.py#2237nuthalapativarun wants to merge 3 commits into
nuthalapativarun wants to merge 3 commits into
Conversation
Add Python 3.10+ style type annotations to 13 public and semi-public functions in litgpt/utils.py that were missing parameter or return type annotations: - choose_logger: add -> Any return type - get_argument_names: add cls: type param and -> set[str] return type - instantiate_bnb_optimizer: add optimizer: str | dict, model_parameters: Any, -> Any - instantiate_torch_optimizer: add optimizer: str | dict, model_parameters: Any, **kwargs: Any, -> torch.optim.Optimizer - check_file_size_on_cpu_and_warn: add checkpoint_path: Path | str, device: torch.device | str, size_limit: int, -> float - auto_download_checkpoint: add model_name: str, access_token: str | None, ignore_tokenizer_files: bool, -> Path - check_nvlink_connectivity: add fabric: L.Fabric | None, -> None - _check_nvidia_connectivity: add custom_print: Any, -> None - _check_amd_connectivity: add custom_print: Any, -> None - fix_and_load_json: add s: str, -> Any - create_finetuning_performance_report: add training_time: float, token_counts: dict[str, int], device_type: str, -> str - select_sft_generate_example: add eval: Any, data: Any, -> str - kill_process_tree: add -> None - _RunIf: add **kwargs: Any, -> Any
|
Azure Pipelines: 4 pipeline(s) require an authorized user to comment /azp run to run. |
for more information, see https://pre-commit.ci
|
Azure Pipelines: 4 pipeline(s) require an authorized user to comment /azp run to run. |
Author
|
Hi! Just checking in — CI appears to be waiting on an authorized |
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.
What does this PR do?
Adds Python 3.10+ style type annotations to 13 functions in
litgpt/utils.pythat were missing parameter or return type annotations. This follows the pattern established in #2221 (which bumped the rufftarget-versiontopy310and updated type annotations across the codebase).Functions annotated
choose_logger-> Anyget_argument_namescls: type,-> set[str]instantiate_bnb_optimizeroptimizer: str | dict,model_parameters: Any,-> Anyinstantiate_torch_optimizeroptimizer: str | dict,model_parameters: Any,**kwargs: Any,-> torch.optim.Optimizercheck_file_size_on_cpu_and_warncheckpoint_path: Path | str,device: torch.device | str,size_limit: int,-> floatauto_download_checkpointmodel_name: str,access_token: str | None,ignore_tokenizer_files: bool,-> Pathcheck_nvlink_connectivityfabric: L.Fabric | None,-> None_check_nvidia_connectivitycustom_print: Any,-> None_check_amd_connectivitycustom_print: Any,-> Nonefix_and_load_jsons: str,-> Anycreate_finetuning_performance_reporttraining_time: float,token_counts: dict[str, int],device_type: str,-> strselect_sft_generate_exampleeval: Any,data: Any,-> strkill_process_tree-> None_RunIf**kwargs: Any,-> AnyNo new imports were needed. All existing tests pass.