MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / topk_fun

Function topk_fun

codegeex/mindspore/src/generate_finetune.py:28–32  ·  view source on GitHub ↗

Get topk

(logits, topk=5)

Source from the content-addressed store, hash-verified

26
27
28def topk_fun(logits, topk=5):
29 """Get topk"""
30 value = np.flip(np.sort(logits), axis=-1)[..., :topk]
31 index = np.flip(np.argsort(logits), axis=-1)[..., :topk]
32 return value, index
33
34
35def sampler(log_probs_revised, top_p, top_k_num, use_pynative=False, bad_words_index=[]):

Callers 1

samplerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected