MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / Sampler

Class Sampler

src/sampler.h:7–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <memory>
6
7struct Sampler {
8 int vocab_size;
9
10 Sampler(const std::shared_ptr<Config> config, uint64_t seed);
11
12 // Return the probability score corresponding to `logits[index]`.
13 // This is equivalent to taking the softmax of the logits and returning
14 // the value at index `index`.
15 float sample_prob(int index, const InferenceState& s);
16 // Return the index of the maximum value in `logits`.
17 int sample_argmax(const InferenceState& s);
18 // Sample from the model's distribution with temperature.
19 int sample(const InferenceState& s, float temperature = 1.0, float top_p = 0.95);
20};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected