MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / gpt_argmax_sample

Function gpt_argmax_sample

bark.cpp:223–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static bark_token gpt_argmax_sample(std::vector<float>& logits, float* eos_p) {
224 int n_logits = logits.size();
225
226 // testing purposes
227 for (auto& l : logits) {
228 l /= 0.7f;
229 }
230
231 // likelihood of EOS token
232 softmax(logits);
233
234 if (eos_p)
235 *eos_p = logits[logits.size() - 1];
236
237 int next = 0;
238 float maxl = -INFINITY;
239
240 for (int i = 0; i < n_logits; i++) {
241 if (logits[i] > maxl) {
242 maxl = logits[i];
243 next = i;
244 }
245 }
246
247 return next;
248}
249
250static bark_token gpt_sample(
251 std::vector<float>& logits,

Callers 1

gpt_sampleFunction · 0.70

Calls 2

softmaxFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected