RaspizD commited on
Commit
2a9181f
·
verified ·
1 Parent(s): 9acd311

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +123 -0
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ tags:
4
+ - tiny
5
+ - edge-ai
6
+ - micro-model
7
+ - boolean
8
+ - comparison
9
+ - RaspizdAI
10
+ ---
11
+
12
+ # pizdecB3
13
+
14
+ **pizdecB3** (format: `n.f.c` → name.function.count) is a tiny boolean comparison model.
15
+
16
+ - **n** = pizdec
17
+ - **f** = B (Boolean)
18
+ - **c** = 3 (third model in the series)
19
+
20
+ It takes two numbers and predicts one of three relations:
21
+
22
+ - `>` (greater)
23
+ - `=` (equal)
24
+ - `<` (less)
25
+
26
+ Also supports string input in the format `x?y`.
27
+
28
+ ## Model Details
29
+
30
+ | Property | Value |
31
+ |-----------------------|------------------------|
32
+ | Parameters | ~1731 |
33
+ | Input | two floats `(a, b)` or string `"a?b"` |
34
+ | Output | `<`, `=`, or `>` |
35
+ | Architecture | small MLP (input features: `a, b, a-b`) |
36
+ | Framework | PyTorch + Safetensors |
37
+ | License | CC-BY-SA-4.0 |
38
+
39
+ ## Intended Use
40
+
41
+ - Extremely lightweight number comparison
42
+ - Edge / constrained environments
43
+ - Educational / experimental micro-models
44
+ - Fun baseline for boolean tasks
45
+
46
+ **Not intended for** high-precision scientific computing or production systems that require perfect floating-point equality handling.
47
+
48
+ ## Example inference script
49
+
50
+ ```python
51
+ import torch
52
+ import torch.nn as nn
53
+ from safetensors.torch import load_file
54
+ from pathlib import Path
55
+
56
+ class PizdecB3(nn.Module):
57
+ def __init__(self):
58
+ super().__init__()
59
+ self.net = nn.Sequential(
60
+ nn.Linear(3, 32),
61
+ nn.ReLU(),
62
+ nn.Linear(32, 32),
63
+ nn.ReLU(),
64
+ nn.Linear(32, 16),
65
+ nn.ReLU(),
66
+ nn.Linear(16, 3)
67
+ )
68
+
69
+ def forward(self, x):
70
+ return self.net(x)
71
+
72
+ def _prepare(self, a, b):
73
+ a = torch.tensor([[float(a)]], dtype=torch.float32)
74
+ b = torch.tensor([[float(b)]], dtype=torch.float32)
75
+ return torch.cat([a, b, a - b], dim=1)
76
+
77
+ def predict(self, a, b) -> str:
78
+ with torch.no_grad():
79
+ x = self._prepare(a, b)
80
+ logits = self.forward(x)
81
+ pred = torch.argmax(logits, dim=-1).item()
82
+ return ["<", "=", ">"][pred]
83
+
84
+ def predict_str(self, s: str) -> str:
85
+ try:
86
+ left, right = s.strip().split("?")
87
+ return self.predict(left, right)
88
+ except:
89
+ return "format error"
90
+
91
+ @classmethod
92
+ def from_pretrained(cls, path="pizdecB3"):
93
+ model = cls()
94
+ state = load_file(Path(path) / "model.safetensors")
95
+ model.load_state_dict(state)
96
+ model.eval()
97
+ return model
98
+
99
+ # Load
100
+ model = PizdecB3.from_pretrained("pizdecB3")
101
+
102
+ # Usage
103
+ print(model.predict(10, 5)) # >
104
+ print(model.predict(3, 3)) # =
105
+ print(model.predict_str("8?2")) # >
106
+ ```
107
+
108
+ ## Known Limitations
109
+
110
+ - Struggles with very close floating-point numbers (e.g. `100` vs `99.9`, `7.0` vs `7.01`)
111
+ - Exact equality on large floats can be unstable
112
+ - No support for non-numeric input
113
+ - Not suitable for high-precision comparison tasks
114
+ - Performance degrades when numbers differ by less than ~0.01–0.05 depending on magnitude
115
+
116
+ ## Files
117
+
118
+ - `model.safetensors` — model weights
119
+ - `config.json` — basic config
120
+
121
+ ---
122
+
123
+ Part of the experimental **RaspizdAI** micro-model collection.