Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Apr 28, 2024
1 parent 6cb3e82 commit d92c11a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bit_moe_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
output = model(x)

# Print the output
print(output)
print(output)
6 changes: 5 additions & 1 deletion bitnet/bit_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from bitnet.bitlinear import BitLinear
import torch.nn.functional as F

# Feedforward = mlp = expert
# = Linear projection + non linear activation functions like [RELU, GELU, etc] + Dropout[optional] + Normalization[optional, LayerNorm]


# Expert module
class Expert(nn.Module):
Expand Down Expand Up @@ -86,6 +89,7 @@ class BitMoE(nn.Module):
num_experts (int): The number of experts in the mixture.
top_k (int, optional): The number of experts to select for each input. Defaults to 2.
"""

def __init__(self, dim: int, num_experts: int, top_k: int = 2):
super(BitMoE, self).__init__()
self.router = NoisyTopkRouter(dim, num_experts, top_k)
Expand Down Expand Up @@ -123,4 +127,4 @@ def forward(self, x):
# x = torch.randn(2, 4, 8)
# model = BitMoE(8, 4, 2)
# output = model(x)
# print(output)
# print(output)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "bitnet"
version = "0.2.4"
version = "0.2.5"
description = "bitnet - Pytorch"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]
Expand All @@ -22,7 +22,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.10"
torch = "*"
einops = "*"
zetascale = "*"
Expand Down

0 comments on commit d92c11a

Please sign in to comment.