-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathllmmodel.h
49 lines (40 loc) · 1.01 KB
/
llmmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef LLMMODEL_H
#define LLMMODEL_H
#include "common.h"
#include "llama.h"
#include <QString>
#include <QObject>
#include <QTimer>
class LLMModel : public QObject
{
Q_OBJECT
public:
LLMModel();
~LLMModel();
int LoadModel();
void Run(QString qstr_input);
gpt_params params;
// 输入的token
std::vector<llama_token> embd_inp;
std::vector<llama_token> embd;
std::vector<llama_token> cml_pfx;
std::vector<llama_token> cml_sfx;
struct llama_sampling_context * ctx_sampling;
int n_ctx;
int n_remain = 0;
int n_consumed = 0;
llama_model * model;
llama_context * ctx = NULL;
llama_context * ctx_guidance = NULL;
bool is_interacting = false;
bool m_log_file = true;
std::string m_input;
QTimer* m_timer;
QStringList m_output;
signals:
void SignalNewAnswer(QString str, bool end = false);
public slots:
void Update();
void Reset();
};
#endif // LLMMODEL_H