MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / logit_bias_processor

Method logit_bias_processor

llama_cpp/llama.py:1317–1326  ·  view source on GitHub ↗
(
                input_ids: npt.NDArray[np.intc],
                scores: npt.NDArray[np.single],
            )

Source from the content-addressed store, hash-verified

1315 logit_bias_map = {int(k): float(v) for k, v in logit_bias.items()}
1316
1317 def logit_bias_processor(
1318 input_ids: npt.NDArray[np.intc],
1319 scores: npt.NDArray[np.single],
1320 ) -> npt.NDArray[np.single]:
1321 new_scores = np.copy(
1322 scores
1323 ) # Does it make sense to copy the whole array or can we just overwrite the original one?
1324 for input_id, score in logit_bias_map.items():
1325 new_scores[input_id] = score + scores[input_id]
1326 return new_scores
1327
1328 _logit_bias_processor = LogitsProcessorList([logit_bias_processor])
1329 if logits_processor is None:

Callers

nothing calls this directly

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected