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

Method _init_samplers

examples/server/server.py:1336–1350  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1334 self._init_samplers()
1335
1336 def _init_samplers(self) -> None:
1337 for seq_id in range(self.n_seq_max):
1338 params = llama_cpp.llama_sampler_chain_default_params()
1339 params.no_perf = True
1340 sampler = llama_cpp.llama_sampler_chain_init(params)
1341 if self.top_k > 1:
1342 llama_cpp.llama_sampler_chain_add(
1343 sampler,
1344 llama_cpp.llama_sampler_init_top_k(self.top_k),
1345 )
1346 llama_cpp.llama_sampler_chain_add(
1347 sampler,
1348 llama_cpp.llama_sampler_init_greedy(),
1349 )
1350 self._samplers.append(sampler)
1351
1352 def _passes_p_min(self, output_index: int) -> bool:
1353 if self.p_min <= 0.0:

Callers 1

__init__Method · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected