BrodyMakezAI commited on
Commit
b2848fd
·
verified ·
1 Parent(s): 2ec480c

Delete modeling_parvus.py

Browse files
Files changed (1) hide show
  1. modeling_parvus.py +0 -26
modeling_parvus.py DELETED
@@ -1,26 +0,0 @@
1
- import torch
2
- from torch import nn
3
- from transformers import PretrainedConfig, PreTrainedModel
4
-
5
-
6
- class ParvusConfig(PretrainedConfig):
7
- model_type = "parvus"
8
-
9
- def __init__(self, vocab_size=2, **kwargs):
10
- self.vocab_size = vocab_size
11
- super().__init__(**kwargs)
12
-
13
-
14
- class ParvusModel(PreTrainedModel):
15
- """One parameter. One token. Zero interest in your question."""
16
- config_class = ParvusConfig
17
-
18
- def __init__(self, config):
19
- super().__init__(config)
20
- self.w = nn.Parameter(torch.ones(1)) # the token ID, as a float
21
-
22
- def forward(self, input_ids=None, **kwargs):
23
- ids = torch.arange(self.config.vocab_size, device=self.w.device)
24
- logits = -(ids - self.w) ** 2 # peaks at token id == w
25
- batch = input_ids.shape[0] if input_ids is not None else 1
26
- return logits.expand(batch, 1, -1) # same answer for every input