Skip to content

Commit

Permalink
Create distribute.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yinfan98 authored Dec 25, 2023
1 parent ab78255 commit 26f427e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mmdeploy/pytorch/functions/distribute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch

from mmdeploy.core import FUNCTION_REWRITER

@FUNCTION_REWRITER.register_rewriter(func_name='torch.distributed')
def distributed_rewriter():
"""rewrite torch.distributed to support some embedding device for higher PyTorch"""
# check torch.distributed is available?
if not torch.distributed.is_available():
torch.distributed.ReduceOp = lambda: None

0 comments on commit 26f427e

Please sign in to comment.