Download model.py from AxionLab-official/MiniText-v1.0-base: direct link, hf CLI and curl.
- Browser
- Download file 409 Bytes
-
https://huggingface.co/AxionLab-official/MiniText-v1.0-base/resolve/main/model.py
- Command line
-
hf download hf://AxionLab-official/MiniText-v1.0-base/model.py
-
curl -L -o model.py https://huggingface.co/AxionLab-official/MiniText-v1.0-base/resolve/main/model.py
409 Bytes
| import torch | |
| import torch.nn as nn | |
| class MiniText(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.embed = nn.Embedding(256, 16) | |
| self.gru = nn.GRU(16, 16, batch_first=True) | |
| self.fc = nn.Linear(16, 256) | |
| def forward(self, x, h=None): | |
| x = self.embed(x) | |
| out, h = self.gru(x, h) | |
| logits = self.fc(out) | |
| return logits, h | |