Upload folder using huggingface_hub
Browse files
code/aubin_mini/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ and the option scores of a question are turned into probabilities with a fitted
|
|
| 5 |
Runs on CPU with ONNX Runtime only (no torch, no GPU).
|
| 6 |
|
| 7 |
from aubin_mini import AubinMini
|
| 8 |
-
m = AubinMini.from_pretrained("emrevrg/AUBIN-Mini") # phone build,
|
| 9 |
m.decide({"ticket": "Package arrived broken, customer wants money back"},
|
| 10 |
{"route": {"type": "choice", "instructions": "Which team?",
|
| 11 |
"criteria": {"billing": "refunds", "shipping": "delivery", "tech": "software"}},
|
|
@@ -20,8 +20,8 @@ __version__ = "0.1.0"
|
|
| 20 |
__all__ = ["AubinMini", "options_of"]
|
| 21 |
|
| 22 |
VARIANTS = { # file name, size on disk, accuracy on the same 300 Kev development questions
|
| 23 |
-
"phone": "aubin_mini_nb4_g8.onnx", # 4-bit block weights + 8-bit embeddings,
|
| 24 |
-
"nb4": "aubin_mini_nb4.onnx", # 4-bit block weights,
|
| 25 |
}
|
| 26 |
|
| 27 |
|
|
@@ -113,8 +113,10 @@ class AubinMini:
|
|
| 113 |
|
| 114 |
def choose(self, question, options, state=""):
|
| 115 |
"""options: dict {key: description} or list of texts → {answer, confidence, probabilities}."""
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
return self._pack(keys, self.log_probs(question, texts, state))
|
| 119 |
|
| 120 |
def decide(self, state, questions):
|
|
|
|
| 5 |
Runs on CPU with ONNX Runtime only (no torch, no GPU).
|
| 6 |
|
| 7 |
from aubin_mini import AubinMini
|
| 8 |
+
m = AubinMini.from_pretrained("emrevrg/AUBIN-Mini") # phone build, 267 MB
|
| 9 |
m.decide({"ticket": "Package arrived broken, customer wants money back"},
|
| 10 |
{"route": {"type": "choice", "instructions": "Which team?",
|
| 11 |
"criteria": {"billing": "refunds", "shipping": "delivery", "tech": "software"}},
|
|
|
|
| 20 |
__all__ = ["AubinMini", "options_of"]
|
| 21 |
|
| 22 |
VARIANTS = { # file name, size on disk, accuracy on the same 300 Kev development questions
|
| 23 |
+
"phone": "aubin_mini_nb4_g8.onnx", # 4-bit block weights + 8-bit embeddings, 267 MB, locked Kev test 0.847
|
| 24 |
+
"nb4": "aubin_mini_nb4.onnx", # 4-bit block weights, 422 MB, locked Kev test 0.846
|
| 25 |
}
|
| 26 |
|
| 27 |
|
|
|
|
| 113 |
|
| 114 |
def choose(self, question, options, state=""):
|
| 115 |
"""options: dict {key: description} or list of texts → {answer, confidence, probabilities}."""
|
| 116 |
+
if isinstance(options, (list, tuple)): # plain list: the answer is the option text itself
|
| 117 |
+
keys = texts = [str(o) for o in options]
|
| 118 |
+
else:
|
| 119 |
+
keys, texts = options_of({"type": "choice", "criteria": options})
|
| 120 |
return self._pack(keys, self.log_probs(question, texts, state))
|
| 121 |
|
| 122 |
def decide(self, state, questions):
|