diff --git a/torchrec/distributed/benchmark/benchmark_utils.py b/torchrec/distributed/benchmark/benchmark_utils.py index ebdbdc680..bc499f335 100644 --- a/torchrec/distributed/benchmark/benchmark_utils.py +++ b/torchrec/distributed/benchmark/benchmark_utils.py @@ -480,7 +480,9 @@ def fx_script_module(eager_module: torch.nn.Module) -> torch.nn.Module: sharded_module = _shard_modules( module=copied_module, - # pyre-ignore [6] + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[ModuleSharder[Variable[T (bound to Module)]]]`. sharders=[sharder], device=device, plan=plan, @@ -489,13 +491,14 @@ def fx_script_module(eager_module: torch.nn.Module) -> torch.nn.Module: if compile_mode == CompileMode.FX_SCRIPT: return fx_script_module( - # pyre-ignore [6] + # pyre-fixme[6]: For 1st argument expected `Module` but got + # `Optional[Module]`. sharded_module if not benchmark_unsharded_module else module ) else: - # pyre-ignore [7] + # pyre-fixme[7]: Expected `Module` but got `Optional[Module]`. return sharded_module if not benchmark_unsharded_module else module diff --git a/torchrec/distributed/composable/tests/test_embedding.py b/torchrec/distributed/composable/tests/test_embedding.py index a92e91f24..88d81f96b 100644 --- a/torchrec/distributed/composable/tests/test_embedding.py +++ b/torchrec/distributed/composable/tests/test_embedding.py @@ -101,7 +101,9 @@ def _test_sharding( # noqa C901 # pyre-fixme[6]: For 1st argument expected `ProcessGroup` but got # `Optional[ProcessGroup]`. env=ShardingEnv.from_process_group(ctx.pg), - # pyre-ignore + # pyre-fixme[6]: For 4th argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[EmbeddingCollectionSharder]`. sharders=[sharder], device=ctx.device, ) diff --git a/torchrec/distributed/keyed_jagged_tensor_pool.py b/torchrec/distributed/keyed_jagged_tensor_pool.py index 09f6493ba..4310c8682 100644 --- a/torchrec/distributed/keyed_jagged_tensor_pool.py +++ b/torchrec/distributed/keyed_jagged_tensor_pool.py @@ -668,7 +668,8 @@ def _update_local( raise NotImplementedError("Inference does not support update") def _update_preproc(self, values: KeyedJaggedTensor) -> KeyedJaggedTensor: - # pyre-fixme[7]: Expected `Tensor` but got implicit return value of `None`. + # pyre-fixme[7]: Expected `KeyedJaggedTensor` but got implicit return value + # of `None`. pass diff --git a/torchrec/distributed/object_pool.py b/torchrec/distributed/object_pool.py index 5d09f8e79..ad2903d1f 100644 --- a/torchrec/distributed/object_pool.py +++ b/torchrec/distributed/object_pool.py @@ -132,13 +132,15 @@ def input_dist( # pyre-ignore[2] **kwargs, ) -> Awaitable[Awaitable[torch.Tensor]]: - # pyre-ignore + # pyre-fixme[7]: Expected `Awaitable[Awaitable[Tensor]]` but got implicit + # return value of `None`. pass def compute(self, ctx: ShrdCtx, dist_input: torch.Tensor) -> DistOut: - # pyre-ignore + # pyre-fixme[7]: Expected `DistOut` but got implicit return value of `None`. pass def output_dist(self, ctx: ShrdCtx, output: DistOut) -> LazyAwaitable[Out]: - # pyre-ignore + # pyre-fixme[7]: Expected `LazyAwaitable[Variable[Out]]` but got implicit + # return value of `None`. pass diff --git a/torchrec/distributed/shards_wrapper.py b/torchrec/distributed/shards_wrapper.py index b111c1bda..7954ca3c2 100644 --- a/torchrec/distributed/shards_wrapper.py +++ b/torchrec/distributed/shards_wrapper.py @@ -27,7 +27,9 @@ aten = torch.ops.aten # pyre-ignore[5] -class LocalShardsWrapper(torch.Tensor): # pyre-ignore[13]: pyre is bad at __new__ +# pyre-fixme[13]: Attribute `_local_shards` is never initialized. +# pyre-fixme[13]: Attribute `_storage_meta` is never initialized. +class LocalShardsWrapper(torch.Tensor): """ A wrapper class to hold local shards of a DTensor. This class is used largely for checkpointing purposes and implicity subtypes diff --git a/torchrec/distributed/test_utils/infer_utils.py b/torchrec/distributed/test_utils/infer_utils.py index e24cf8555..05b1fe0a4 100644 --- a/torchrec/distributed/test_utils/infer_utils.py +++ b/torchrec/distributed/test_utils/infer_utils.py @@ -862,7 +862,8 @@ def shard_qebc( quant_model_copy = copy.deepcopy(mi.quant_model) sharded_model = _shard_modules( module=quant_model_copy, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got `List[TestQuantEBCSharder]`. sharders=[sharder], device=device, plan=plan, @@ -912,7 +913,8 @@ def shard_qec( quant_model_copy = copy.deepcopy(mi.quant_model) sharded_model = _shard_modules( module=quant_model_copy, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got `List[TestQuantECSharder]`. sharders=[sharder], device=device, plan=plan, diff --git a/torchrec/distributed/tests/test_infer_hetero_shardings.py b/torchrec/distributed/tests/test_infer_hetero_shardings.py index b23ca9534..177f64df7 100755 --- a/torchrec/distributed/tests/test_infer_hetero_shardings.py +++ b/torchrec/distributed/tests/test_infer_hetero_shardings.py @@ -110,7 +110,9 @@ def test_sharder_different_world_sizes_for_qec(self, sharding_device: str) -> No sharded_model = _shard_modules( module=non_sharded_model, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[QuantEmbeddingCollectionSharder]`. sharders=[sharder], device=torch.device(sharding_device), plan=plan, @@ -201,7 +203,9 @@ def test_sharder_different_world_sizes_for_qebc(self) -> None: } sharded_model = _shard_modules( module=non_sharded_model, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[QuantEmbeddingBagCollectionSharder]`. sharders=[sharder], device=torch.device("cpu"), plan=plan, diff --git a/torchrec/distributed/tests/test_infer_shardings.py b/torchrec/distributed/tests/test_infer_shardings.py index 158ae8d8d..a59ce87d5 100755 --- a/torchrec/distributed/tests/test_infer_shardings.py +++ b/torchrec/distributed/tests/test_infer_shardings.py @@ -2025,7 +2025,9 @@ def test_sharded_quant_fp_ebc_tw( sharded_model = _shard_modules( module=quant_model, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[QuantFeatureProcessedEmbeddingBagCollectionSharder]`. sharders=[sharder], device=local_device, plan=plan, @@ -2180,7 +2182,9 @@ def test_sharded_quant_fp_ebc_tw_meta(self, compute_device: str) -> None: sharded_model = _shard_modules( module=quant_model, - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[QuantFeatureProcessedEmbeddingBagCollectionSharder]`. sharders=[sharder], # shard on meta to simulate device movement from cpu -> meta QFPEBC device=torch.device("meta"), diff --git a/torchrec/distributed/tests/test_infer_utils.py b/torchrec/distributed/tests/test_infer_utils.py index 573b86dca..09ec920b8 100644 --- a/torchrec/distributed/tests/test_infer_utils.py +++ b/torchrec/distributed/tests/test_infer_utils.py @@ -103,7 +103,9 @@ def test_get_tbe_specs_from_sqebc(self) -> None: sharded_model = _shard_modules( module=quant_model[0], - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[TestQuantEBCSharder]`. sharders=[sharder], device=device, plan=plan, @@ -178,7 +180,9 @@ def test_get_tbe_specs_from_sqec(self) -> None: sharded_model = _shard_modules( module=quant_model[0], - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[TestQuantECSharder]`. sharders=[sharder], device=device, plan=plan, @@ -256,7 +260,9 @@ def test_get_all_torchrec_modules_for_single_module(self) -> None: sharded_model = _shard_modules( module=quant_model[0], - # pyre-ignore + # pyre-fixme[6]: For 2nd argument expected + # `Optional[List[ModuleSharder[Module]]]` but got + # `List[TestQuantEBCSharder]`. sharders=[sharder], device=device, plan=plan, diff --git a/torchrec/distributed/types.py b/torchrec/distributed/types.py index 102d5afa1..95d470af7 100644 --- a/torchrec/distributed/types.py +++ b/torchrec/distributed/types.py @@ -44,7 +44,8 @@ # other metaclasses (i.e. AwaitableMeta) for customized # behaviors, as Generic is non-trival metaclass in # python 3.6 and below - from typing import GenericMeta # pyre-ignore: python 3.6 + # pyre-fixme[21]: Could not find name `GenericMeta` in `typing` (stubbed). + from typing import GenericMeta except ImportError: # In python 3.7+, GenericMeta doesn't exist as it's no # longer a non-trival metaclass,