DeepSpeed
aaaed265 - Add type hints to top-level public API functions (#8079)

Commit
14 days ago
Add type hints to top-level public API functions (#8079) ## What Adds precise type hints to the top-level public API functions in `deepspeed/__init__.py`, addressing #8074: - `initialize` — annotates the previously-untyped `args`, `mpu`, `collate_fn`, `config`, `mesh_param`, `config_params` parameters and adds the return type. - `init_inference`, `default_inference_config`, `add_config_arguments`, `tp_model_init`, `set_optimizer_flags`. ## Why #8074 asks for type annotations on the public API. This is a scoped first increment covering the top-level `deepspeed.*` entry points (the functions users call directly), which keeps the diff small and reviewable; follow-ups can extend to deeper modules. ## Notes - Annotations only — no runtime behavior change. - `pre-commit run --files deepspeed/__init__.py` is green (yapf, flake8, check-torchdist, check-license, codespell). - `initialize` returns `Tuple[DeepSpeedEngine, Optional[Optimizer], Optional[DataLoader], Optional[_LRScheduler]]` — both `DeepSpeedHybridEngine` and `PipelineEngine` subclass `DeepSpeedEngine`. - Genuinely dynamic / duck-typed parameters (`args`, `mpu`, `mesh_param`) are annotated `Any`. Opened as a draft for early feedback on the scope and the chosen annotations. Addresses #8074 --------- Signed-off-by: Arun Sharma <sharm485@umn.edu> Co-authored-by: Olatunji Ruwase <tunji.ruwase@snowflake.com>
Author
Parents
Loading