Skip to content

Commit

Permalink
Update router.py (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-db authored Oct 17, 2024
1 parent 7b0337f commit 84286de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions megablocks/layers/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ def __init__(self, args: Arguments):
args.init_method(self.layer.weight)

def jitter(self, x: torch.Tensor):
assert isinstance(self.args.moe_jitter_eps, float)
low = 1.0 - self.args.moe_jitter_eps
high = 1.0 + self.args.moe_jitter_eps
low: float = 1.0 - self.args.moe_jitter_eps
high: float = 1.0 + self.args.moe_jitter_eps
noise = torch.rand(x.size(), dtype=x.dtype, device=x.device)
return low + noise * (high - low)

Expand Down

0 comments on commit 84286de

Please sign in to comment.