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

Function gpt_sample

bark.cpp:250–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250static bark_token gpt_sample(
251 std::vector<float>& logits,
252 std::mt19937& rng,
253 float temp,
254 float* eos_p,
255 int64_t* t_sample_us,
256 int64_t* n_sample) {
257 int64_t t_sample_start_us = ggml_time_us();
258
259 bark_token res;
260 if (temp == 0.0f) {
261 res = gpt_argmax_sample(logits, eos_p);
262 } else {
263 res = gpt_multinomial_sample(logits, rng, temp, eos_p);
264 }
265
266 int64_t t_sample_end_us = ggml_time_us();
267 *t_sample_us += (t_sample_end_us - t_sample_start_us);
268 *n_sample += 1;
269
270 return res;
271}
272
273static bool ggml_quantize_weights(
274 std::ifstream& fin,

Callers 3

bark_eval_text_encoderFunction · 0.70
bark_eval_coarse_encoderFunction · 0.70
bark_eval_fine_encoderFunction · 0.70

Calls 2

gpt_argmax_sampleFunction · 0.70
gpt_multinomial_sampleFunction · 0.70

Tested by

no test coverage detected