fix(mypy): resolve typing issues in post-training providers and model files

This commit achieves zero mypy errors across all 430 source files by addressing type issues in post-training providers, model implementations, and testing infrastructure.

Key changes:
- Created HFAutoModel Protocol for HuggingFace models to provide type safety without requiring complete type stubs
- Added module overrides in pyproject.toml for libraries lacking type stubs (torchtune, fairscale, torchvision, datasets, etc.)
- Fixed type issues in databricks provider and api_recorder

Using centralized mypy.overrides instead of scattered inline suppressions provides cleaner code organization.
This commit is contained in:
Ashwin Bharambe 2025-10-28 05:23:48 -07:00
parent 4d58147522
commit 01d1a2ffe9
10 changed files with 65 additions and 25 deletions

View file

@ -347,7 +347,17 @@ exclude = [
[[tool.mypy.overrides]]
# packages that lack typing annotations, do not have stubs, or are unavailable.
module = ["yaml", "fire"]
module = [
"yaml",
"fire",
"torchtune.*",
"fairscale.*",
"torchvision.*",
"datasets",
"nest_asyncio",
"streamlit_option_menu",
"lmformatenforcer.*",
]
ignore_missing_imports = true
[tool.pydantic-mypy]