MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / __init__

Method __init__

examples/tensorflow/decoder/utils/sampling.py:19–28  ·  view source on GitHub ↗
(self, sample_method)

Source from the content-addressed store, hash-verified

17class Sampling():
18
19 def __init__(self, sample_method):
20 if sample_method == "top_k":
21 self.sample_method = self.top_k_logits
22 elif sample_method == "top_p":
23 self.sample_method = self.top_p_logits
24 else:
25 print("[ERROR] the sample method should be one of top_k and top_p")
26 exit(-1)
27
28 pass
29
30 def sample(self, logits, threshold, num_samples=1):
31 '''

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected