MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / _argmax

Function _argmax

test/general/lm_eval/tasks/bigbench.py:182–188  ·  view source on GitHub ↗

argmax with deterministic pseudorandom tie breaking.

(array)

Source from the content-addressed store, hash-verified

180
181
182def _argmax(array):
183 """argmax with deterministic pseudorandom tie breaking."""
184 max_indices = np.arange(len(array))[array == np.max(array)]
185 idx = int(hashlib.sha256(np.asarray(array).tobytes()).hexdigest(), 16) % len(
186 max_indices
187 )
188 return max_indices[idx]
189
190
191def _postprocess_output(text, max_length, stop_string, output_regex):

Callers 1

process_resultsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected