summaryrefslogtreecommitdiff
path: root/models.h
blob: f2f1bc81aeb1b30269fb4bc1718b75de8d4bff0c (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#ifndef MODELS_H
#define MODELS_H

#include "llama.h"
#include <stddef.h>
#include <string.h>

typedef enum {
	PROMPT_STYLE_PLAIN = 0,
	PROMPT_STYLE_CHAT = 1,
	PROMPT_STYLE_T5 = 2,
} PromptStyle;

typedef struct {
	const char *name;
	const char *filepath;
	const char *embed_model_name;
	int n_gpu_layers;
	bool use_mmap;
	int n_ctx;
	int n_batch;
	bool embeddings;
	int n_predict;
	float temperature;
	float min_p;
	int top_k;
	float top_p;
	int repeat_last_n;
	float repeat_penalty;
	float freq_penalty;
	float presence_penalty;
	uint32_t seed;
	PromptStyle prompt_style;
} ModelConfig;

ModelConfig models[] = {
	{
		.name = "qwen3",
		.filepath = "models/Qwen3-0.6B-UD-Q6_K_XL.gguf",
		.embed_model_name = "qwen3",
		.n_gpu_layers = 0,
		.use_mmap = false,
		.n_ctx = 2048,
		.n_batch = 4096,
		.embeddings = false,
		.n_predict = 128,
		.temperature = 0.6f,
		.min_p = 0.05f,
		.top_k = 40,
		.top_p = 0.9f,
		.repeat_last_n = 64,
		.repeat_penalty = 1.1f,
		.freq_penalty = 0.0f,
		.presence_penalty = 0.0f,
		.seed = LLAMA_DEFAULT_SEED,
		.prompt_style = PROMPT_STYLE_CHAT,
	},
	{
		.name = "tinyllama-1.1b",
		.filepath = "models/tinyllama-1.1b.gguf",
		.embed_model_name = "qwen3",
		.n_gpu_layers = 0,
		.use_mmap = false,
		.n_ctx = 2048,
		.n_batch = 4096,
		.embeddings = false,
		.n_predict = 128,
		.temperature = 0.7f,
		.min_p = 0.05f,
		.top_k = 40,
		.top_p = 0.9f,
		.repeat_last_n = 64,
		.repeat_penalty = 1.1f,
		.freq_penalty = 0.0f,
		.presence_penalty = 0.0f,
		.seed = LLAMA_DEFAULT_SEED,
		.prompt_style = PROMPT_STYLE_PLAIN,
	},
	{
		.name = "tinyllama-1",
		.filepath = "models/TinyLlama-1.1B-intermediate-step-1431k-3T-Q2_K.gguf",
		.embed_model_name = "qwen3",
		.n_gpu_layers = 0,
		.use_mmap = false,
		.n_ctx = 2048,
		.n_batch = 4096,
		.embeddings = false,
		.n_predict = 128,
		.temperature = 0.7f,
		.min_p = 0.05f,
		.top_k = 40,
		.top_p = 0.9f,
		.repeat_last_n = 64,
		.repeat_penalty = 1.1f,
		.freq_penalty = 0.0f,
		.presence_penalty = 0.0f,
		.seed = LLAMA_DEFAULT_SEED,
		.prompt_style = PROMPT_STYLE_PLAIN,
	},
	{
		.name = "flan-t5-small",
		.filepath = "models/flan-t5-small.F16.gguf",
		.embed_model_name = "qwen3",
		.n_gpu_layers = 0,
		.use_mmap = false,
		.n_ctx = 512,
		.n_batch = 512,
		.embeddings = false,
		.n_predict = 128,
		.temperature = 0.2f,
		.min_p = 0.05f,
		.top_k = 40,
		.top_p = 0.9f,
		.repeat_last_n = 64,
		.repeat_penalty = 1.1f,
		.freq_penalty = 0.0f,
		.presence_penalty = 0.0f,
		.seed = LLAMA_DEFAULT_SEED,
		.prompt_style = PROMPT_STYLE_T5,
	},
	{
		.name = "phi-4-mini-instruct",
		.filepath = "models/Phi-4-mini-instruct.Q2_K.gguf",
		.embed_model_name = "qwen3",
		.n_gpu_layers = 0,
		.use_mmap = false,
		.n_ctx = 4096,
		.n_batch = 4096,
		.embeddings = false,
		.n_predict = 128,
		.temperature = 0.6f,
		.min_p = 0.05f,
		.top_k = 40,
		.top_p = 0.9f,
		.repeat_last_n = 64,
		.repeat_penalty = 1.1f,
		.freq_penalty = 0.0f,
		.presence_penalty = 0.0f,
		.seed = LLAMA_DEFAULT_SEED,
		.prompt_style = PROMPT_STYLE_CHAT,
	},
};

const ModelConfig *get_model_by_name(const char *name) {
	for (size_t i = 0; i < sizeof(models) / sizeof(models[0]); i++) {
		if (models[i].name != NULL && strcmp(models[i].name, name) == 0) {
			return &models[i];
		}
	}
	return NULL;
}

#endif