emrevrg commited on
Commit
6620bb4
·
verified ·
1 Parent(s): 2867dcc

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. code/aubin_mini/__init__.py +7 -5
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, 255 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,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, 255 MB, dev 0.833
24
- "nb4": "aubin_mini_nb4.onnx", # 4-bit block weights, 402 MB, dev 0.840
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
- q = {"type": "choice", "criteria": options}
117
- keys, texts = options_of(q)
 
 
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):