From 455de8897515f430bef45b19f29a587350f6c10d Mon Sep 17 00:00:00 2001 From: Yong Hoon Shin Date: Mon, 30 Dec 2024 16:14:53 -0800 Subject: [PATCH] fix py3.9 build (#2660) Summary: Pull Request resolved: https://github.com/pytorch/torchrec/pull/2660 The `|` operator is only supported for python >= 3.10, which breaks python 3.9 build Reviewed By: dstaay-fb Differential Revision: D67723223 fbshipit-source-id: a49208aa8d819c3047b75a52ab7ba6cb6c2638b8 --- torchrec/distributed/mc_modules.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/torchrec/distributed/mc_modules.py b/torchrec/distributed/mc_modules.py index 2a67fcc09..a64e7f6d6 100644 --- a/torchrec/distributed/mc_modules.py +++ b/torchrec/distributed/mc_modules.py @@ -66,7 +66,9 @@ @dataclass class EmbeddingCollectionContext(Multistreamable): - sharding_contexts: List[InferSequenceShardingContext | SequenceShardingContext] + sharding_contexts: List[ + Union[InferSequenceShardingContext, SequenceShardingContext] + ] def record_stream(self, stream: torch.Stream) -> None: for ctx in self.sharding_contexts: