Skip to content

ci: Enable mypy static type checking and reslove errors #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

hickeyma
Copy link
Collaborator

Description of the change

Python is a dynamic language and does not use static type checking. It instead prevents typing errors at runtime .

mypy is a standard open source static typing tool for Python which is widely used. This PR adds suggestions from mypy and enables the static checking in CI/CD. It is a follow on PR from #49.

Related issue number

Closes #33

How to verify the PR

Run tox -e mypy or check CI.

Was the PR tested

  • I have ensured all unit tests pass

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Fixes:

fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:66: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:67: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:75: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:82: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:87: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]

fms_mo/quant/quantizers.py:4161: error: Incompatible types in assignment (expression has type "list[int]", variable has type "None")  [assignment]
fms_mo/quant/quantizers.py:4161: error: Argument 1 to "len" has incompatible type "None"; expected "Sized"  [arg-type]
fms_mo/quant/quantizers.py:4162: error: Unsupported target for indexed assignment ("None")  [index]
fms_mo/quant/quantizers.py:4162: error: Value of type "None" is not indexable  [index]

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
@hickeyma hickeyma force-pushed the ci/add-mypy-fixes branch 2 times, most recently from 5fa8c28 to ffcd152 Compare January 23, 2025 16:50
Fix:

ms_mo/quant/quantizers.py:3933: error: Incompatible types in assignment (expression has type "int | float", variable has type "Tensor")  [assignment]
fms_mo/quant/quantizers.py:3945: error: Incompatible types in assignment (expression has type "float", variable has type "Tensor | None")  [assignment]
fms_mo/quant/quantizers.py:3947: error: Incompatible types in assignment (expression has type "Any | int", variable has type "Tensor | None")  [assignment]
fms_mo/quant/quantizers.py:4190: error: Incompatible types in assignment (expression has type "Parameter", variable has type "None")  [assignment]
fms_mo/quant/quantizers.py:4196: error: Incompatible types in assignment (expression has type "Size", variable has type "list[Any]")  [assignment]
fms_mo/modules/linear.py:1341: error: Incompatible types in assignment (expression has type "tuple[int, int]", variable has type "tuple[int, int, int]")  [assignment]
fms_mo/utils/torchscript_utils.py:58: error: Incompatible types in assignment (expression has type "list[str] | None", variable has type "list[str]")  [assignment]
fms_mo/utils/qconfig_utils.py:167: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:168: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:169: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:170: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:171: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:172: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:173: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:174: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:175: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:176: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:178: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:179: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:180: error: Incompatible types in assignment (expression has type "tuple[float, float]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:183: error: Incompatible types in assignment (expression has type "list[Never]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:184: error: Incompatible types in assignment (expression has type "list[Never]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:188: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:189: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:190: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:191: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:192: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:193: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:194: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:195: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:196: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:197: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:199: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:203: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:204: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:205: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:206: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:207: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:208: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:210: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:213: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:214: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:215: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:216: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:217: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:218: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:219: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:220: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:221: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:222: error: Incompatible types in assignment (expression has type "float", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:223: error: Incompatible types in assignment (expression has type "float", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:224: error: Incompatible types in assignment (expression has type "float", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:226: error: Incompatible types in assignment (expression has type "list[Never]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:227: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:228: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:229: error: Incompatible types in assignment (expression has type "str", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:230: error: Incompatible types in assignment (expression has type "list[Never]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:237: error: Incompatible types in assignment (expression has type "None", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:238: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:239: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:240: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:243: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:244: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:245: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:246: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:247: error: Incompatible types in assignment (expression has type "list[Never]", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:248: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:249: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:250: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:251: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:252: error: Incompatible types in assignment (expression has type "bool", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:253: error: Incompatible types in assignment (expression has type "int", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/utils/qconfig_utils.py:257: error: Incompatible types in assignment (expression has type "float", target has type "dict[type, dict[str, type]]")  [assignment]
fms_mo/quant/ptq.py:2646: error: Incompatible types in assignment (expression has type "tuple[type[Conv2d], type[Linear]]", variable has type "tuple[type[Conv2d], type[Linear], type[DetQConv2d]]")  [assignment]

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
hickeyma and others added 3 commits January 24, 2025 17:14
Fix:

fms_mo/quant/quantizers.py:3898: error: Item "None" of "Parameter | None" has no attribute "fill_"  [union-attr]
fms_mo/quant/quantizers.py:3963: error: Item "float" of "Any | float" has no attribute "round"  [union-attr]
fms_mo/quant/quantizers.py:5392: error: Module has no attribute "float8_e5m2G"  [attr-defined]
fms_mo/custom_ext_kernels/utils.py:77: error: Module has no attribute "custom_op"  [attr-defined]
fms_mo/custom_ext_kernels/utils.py:79: error: Module has no attribute "register_kernel"  [attr-defined]
fms_mo/custom_ext_kernels/utils.py:80: error: Module has no attribute "register_fake"  [attr-defined]
fms_mo/utils/torchscript_utils.py:182: error: Item "None" of "Node | None" has no attribute "inputs"  [union-attr]
fms_mo/utils/torchscript_utils.py:184: error: Item "None" of "Node | None" has no attribute "outputs"  [union-attr]
fms_mo/utils/torchscript_utils.py:204: error: "Node" has no attribute "name"  [attr-defined]
fms_mo/utils/torchscript_utils.py:204: error: "Node" has no attribute "obj"  [attr-defined]
fms_mo/utils/torchscript_utils.py:205: error: "Node" has no attribute "name"  [attr-defined]
fms_mo/utils/torchscript_utils.py:207: error: "Node" has no attribute "name"  [attr-defined]
fms_mo/utils/torchscript_utils.py:209: error: "Node" has no attribute "name"  [attr-defined]
fms_mo/utils/torchscript_utils.py:212: error: "Node" has no attribute "Op"  [attr-defined]
fms_mo/utils/torchscript_utils.py:214: error: "Node" has no attribute "unpackIdx"  [attr-defined]
fms_mo/utils/torchscript_utils.py:216: error: "Node" has no attribute "lineno"  [attr-defined]
fms_mo/utils/torchscript_utils.py:217: error: "Node" has no attribute "operator"  [attr-defined]
fms_mo/utils/torchscript_utils.py:219: error: "Node" has no attribute "parents"  [attr-defined]
fms_mo/utils/torchscript_utils.py:220: error: "Node" has no attribute "parents_ptr"  [attr-defined]
fms_mo/utils/torchscript_utils.py:221: error: "Node" has no attribute "scope"  [attr-defined]
fms_mo/utils/torchscript_utils.py:222: error: "Node" has no attribute "modname"  [attr-defined]
fms_mo/utils/torchscript_utils.py:223: error: "Node" has no attribute "children"  [attr-defined]
fms_mo/utils/torchscript_utils.py:224: error: "Node" has no attribute "children_ptr"  [attr-defined]
fms_mo/utils/torchscript_utils.py:225: error: "Node" has no attribute "TSparents"  [attr-defined]
fms_mo/utils/torchscript_utils.py:226: error: "Node" has no attribute "TSoutputs"  [attr-defined]
fms_mo/utils/torchscript_utils.py:228: error: "Node" has no attribute "name"  [attr-defined]
fms_mo/calib.py:485: error: Item "None" of "FrameType | None" has no attribute "f_code"  [union-attr]
fms_mo/quant/ptq.py:2626: error: Item "None" of "Tensor | None" has no attribute "zero_"  [union-attr]
fms_mo/quant/ptq.py:2627: error: Item "None" of "Tensor | None" has no attribute "fill_"  [union-attr]

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Disabled:

fms_mo/utils/custom_gptq_models.py:18: error: Cannot find implementation or library stub for module named "auto_gptq.modeling"  [import-not-found]
fms_mo/utils/utils.py:32: error: Skipping analyzing "transformers.tokenization_utils_base": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/utils/utils.py:328: error: Library stubs not installed for "pandas"  [import-untyped]
fms_mo/utils/import_utils.py:20: error: Skipping analyzing "transformers.utils.import_utils": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/utils/calib_data.py:29: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/aiu_addons/i8i8/i8i8_aiu_adapter.py:20: error: Cannot find implementation or library stub for module named "fms.utils"  [import-not-found]
fms_mo/aiu_addons/gptq/gptq_aiu_adapter.py:20: error: Cannot find implementation or library stub for module named "fms.utils"  [import-not-found]
fms_mo/aiu_addons/i8i8/i8i8_aiu_linear.py:21: error: Cannot find implementation or library stub for module named "fms.modules.linear"  [import-not-found]
fms_mo/aiu_addons/i8i8/i8i8_aiu_linear.py:28: error: Cannot find implementation or library stub for module named "fms.modules.tp"  [import-not-found]
fms_mo/aiu_addons/i8i8/i8i8_aiu_linear.py:29: error: Cannot find implementation or library stub for module named "fms.utils.config"  [import-not-found]
fms_mo/aiu_addons/gptq/gptq_aiu_linear.py:21: error: Cannot find implementation or library stub for module named "fms.modules.linear"  [import-not-found]
fms_mo/aiu_addons/gptq/gptq_aiu_linear.py:28: error: Cannot find implementation or library stub for module named "fms.modules.tp"  [import-not-found]
fms_mo/aiu_addons/gptq/gptq_aiu_linear.py:29: error: Cannot find implementation or library stub for module named "fms.utils.gptq"  [import-not-found]
fms_mo/custom_ext_kernels/utils.py:32: error: Skipping analyzing "transformers.pytorch_utils": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/custom_ext_kernels/utils.py:530: error: Cannot find implementation or library stub for module named "exllama_kernels"  [import-not-found]
fms_mo/custom_ext_kernels/utils.py:531: error: Cannot find implementation or library stub for module named "exllamav2_kernels"  [import-not-found]
fms_mo/custom_ext_kernels/utils.py:1113: error: Cannot find implementation or library stub for module named "auto_gptq.nn_modules.qlinear.qlinear_exllama"  [import-not-found]
fms_mo/custom_ext_kernels/utils.py:1116: error: Cannot find implementation or library stub for module named "auto_gptq.nn_modules.qlinear.qlinear_exllamav2"  [import-not-found]
fms_mo/modules/linear.py:1079: error: Cannot find implementation or library stub for module named "cutlass_mm"  [import-not-found]
fms_mo/modules/linear.py:1405: error: Cannot find implementation or library stub for module named "auto_gptq.nn_modules.qlinear.qlinear_exllama"  [import-not-found]
fms_mo/modules/linear.py:1408: error: Cannot find implementation or library stub for module named "auto_gptq.nn_modules.qlinear.qlinear_exllamav2"  [import-not-found]
fms_mo/modules/linear.py:1412: error: Cannot find implementation or library stub for module named "exllama_kernels"  [import-not-found]
fms_mo/modules/linear.py:1413: error: Skipping analyzing "transformers.pytorch_utils": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/fx/utils.py:214: error: Cannot find implementation or library stub for module named "auto_gptq.modeling._utils"  [import-not-found]
fms_mo/fx/utils.py:524: error: Cannot find implementation or library stub for module named "pygraphviz"  [import-not-found]
fms_mo/utils/torchscript_utils.py:27: error: Skipping analyzing "transformers.tokenization_utils_base": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/utils/torchscript_utils.py:563: error: Cannot find implementation or library stub for module named "pygraphviz"  [import-not-found]
fms_mo/utils/torchscript_utils.py:686: error: Cannot find implementation or library stub for module named "matplotlib.image"  [import-not-found]
fms_mo/utils/torchscript_utils.py:686: error: Cannot find implementation or library stub for module named "matplotlib"  [import-not-found]
fms_mo/utils/torchscript_utils.py:687: error: Cannot find implementation or library stub for module named "matplotlib.pyplot"  [import-not-found]
fms_mo/quant/ptq.py:36: error: Library stubs not installed for "pandas"  [import-untyped]
fms_mo/quant/ptq.py:59: error: Cannot find implementation or library stub for module named "piqa.piqa"  [import-not-found]
fms_mo/fx/dynamo_utils.py:1060: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/fx/dynamo_utils.py:1158: error: Skipping analyzing "torchvision.models.detection.rpn": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/fx/dynamo_utils.py:1159: error: Skipping analyzing "torchvision.ops": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/calib.py:24: error: Skipping analyzing "transformers.tokenization_utils_base": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/calib.py:470: error: Library stubs not installed for "pandas"  [import-untyped]
fms_mo/dq.py:30: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/run_quant.py:39: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
fms_mo/run_quant.py:127: error: Cannot find implementation or library stub for module named "auto_gptq"  [import-not-found]
fms_mo/run_quant.py:128: error: Cannot find implementation or library stub for module named "auto_gptq.modeling._const"  [import-not-found]
fms_mo/run_quant.py:129: error: Cannot find implementation or library stub for module named "auto_gptq.modeling.auto"  [import-not-found]
fms_mo/run_quant.py:194: error: Cannot find implementation or library stub for module named "llmcompressor.modifiers.quantization"  [import-not-found]
fms_mo/run_quant.py:195: error: Cannot find implementation or library stub for module named "llmcompressor.transformers"  [import-not-found]
tests/models/test_qmodelprep.py:22: error: Skipping analyzing "torchvision": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/models/test_qmodelprep.py:23: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/models/conftest.py:25: error: Skipping analyzing "torchvision.io": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/models/conftest.py:26: error: Skipping analyzing "torchvision.models": module is installed, but missing library stubs or py.typed marker  [import-untyped]
tests/models/conftest.py:27: error: Skipping analyzing "transformers": module is installed, but missing library stubs or py.typed marker  [import-untyped]

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
@chichun-charlie-liu chichun-charlie-liu changed the title Enable mypy static type checking and reslove errors ci: Enable mypy static type checking and reslove errors Apr 10, 2025
@github-actions github-actions bot added the ci label Apr 10, 2025
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
Signed-off-by: chichun-charlie-liu <57839396+chichun-charlie-liu@users.noreply.github.com>
@chichun-charlie-liu
Copy link
Collaborator

@hickeyma mypy caught something on main branch, i.e. modules/conv.py, that is not included in your commits. Those errors seem to be derived from PyTorch itself... Could you add ignores for those errors?

@hickeyma
Copy link
Collaborator Author

hickeyma commented Apr 11, 2025

mypy caught something on main branch, i.e. modules/conv.py, that is not included in your commits. Those errors seem to be derived from PyTorch itself... Could you add ignores for those errors?

@chichun-charlie-liu With this format: # type: ignore[<error>]. For example: # type: ignore[attr-defined]

@hickeyma hickeyma marked this pull request as ready for review April 11, 2025 08:21
@hickeyma hickeyma requested a review from BrandonGroth as a code owner April 11, 2025 08:21
@hickeyma
Copy link
Collaborator Author

Thank you @chichun-charlie-liu for picking this up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a static type check to help find bugs pre-runtime
2 participants