We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 08ee10a commit 3e4c283Copy full SHA for 3e4c283
src/twinkle/model/megatron/utils/utils.py
@@ -3,15 +3,12 @@
3
"""
4
from typing import Optional
5
import torch
6
-from twinkle import exists, requires
+from twinkle import requires
7
8
-mpu = None
9
-if exists('megatron_core'):
10
- from megatron.core import mpu # type: ignore
11
12
def split_cp_inputs(inputs: torch.Tensor, cu_seqlens: Optional[torch.Tensor], dim: int):
13
- if mpu is None:
14
- requires('megatron_core')
+ requires('megatron_core')
+ from megatron.core import mpu
15
if dim < 0:
16
dim = (dim + inputs.ndim) % inputs.ndim
17
new_inputs = []
0 commit comments