Xenith/xenith/core/generate.hpp
2026-10-02 19:30:49 +07:00

28 lines
826 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// generate.h — генерация текста с KV-кэшем
#pragma once
#include "checkpoint.hpp"
#include <string>
#include <vector>
namespace xt {
struct GenConfig {
int max_new_tokens = 200;
float temperature = 0.8f;
int top_k = 40;
float top_p = 0.95f;
int seed = -1;
bool stream = true;
int repeat_penalty = 1;
};
std::string generate(const Params& p, const Tokenizer& tok,
const std::string& prompt, const GenConfig& gc,
std::vector<int>* out_ids = nullptr);
std::vector<std::string> generate_batch(const Params& p, const Tokenizer& tok,
const std::vector<std::string>& prompts,
const GenConfig& gc);
}