From c261d7199f6e0ba2af5f217b4a4f141921861f88 Mon Sep 17 00:00:00 2001 From: Evan Smothers Date: Thu, 22 Feb 2024 08:33:32 -0800 Subject: [PATCH] update mypy version (#524) Summary: Our CI is failing ([ex](https://github.com/facebookresearch/multimodal/actions/runs/7934357313/job/21665167793?pr=521)) due to a mismatch in the mypy version used with pytorch core. Update mypy version to fix it Pull Request resolved: https://github.com/facebookresearch/multimodal/pull/524 Test Plan: Fresh install and run mypy ``` conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia pip install -e ".[dev]" mypy Success: no issues found in 135 source files ``` CI is green now Reviewed By: kartikayk Differential Revision: D54050126 Pulled By: ebsmothers fbshipit-source-id: 922e0a555c14af6f2f27953603b8d280c513f5ff --- dev-requirements.txt | 2 +- torchmultimodal/utils/common.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index fa09973a..661de9c2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,7 +3,7 @@ black==22.12.0 flake8-bugbear==22.4.25 flake8==4.0.1 iopath -mypy==1.0.1 +mypy==1.8.0 pep8-naming==0.12.1 pre-commit pytest diff --git a/torchmultimodal/utils/common.py b/torchmultimodal/utils/common.py index 5d4fc4c3..131b5545 100644 --- a/torchmultimodal/utils/common.py +++ b/torchmultimodal/utils/common.py @@ -121,7 +121,7 @@ def momentum_update(model: nn.Module, model_m: nn.Module, momentum: float) -> No class ModelOutput(OrderedDict): def keys(self) -> Any: - for field in fields(self): + for field in fields(self): # type: ignore yield field.name def __getitem__(self, key: Any) -> Any: @@ -131,11 +131,11 @@ def __iter__(self) -> Any: yield from self.keys() def values(self) -> Any: - for field in fields(self): + for field in fields(self): # type: ignore yield getattr(self, field.name) def items(self) -> Any: - for field in fields(self): + for field in fields(self): # type: ignore yield field.name, getattr(self, field.name)