Skip to content

Commit 28335d0

Browse files
committed
feat: expose n_thread and escape for llava
1 parent 6f2d219 commit 28335d0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Diff for: src/gdllava.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ void GDLlava::_bind_methods() {
2727
ClassDB::bind_method(D_METHOD("set_temperature", "p_temperature"), &GDLlava::set_temperature);
2828
ClassDB::add_property("GDLlava", PropertyInfo(Variant::FLOAT, "temperature", PROPERTY_HINT_NONE), "set_temperature", "get_temperature");
2929

30+
ClassDB::bind_method(D_METHOD("get_n_threads"), &GDLlava::get_n_threads);
31+
ClassDB::bind_method(D_METHOD("set_n_threads", "p_n_threads"), &GDLlava::set_n_threads);
32+
ClassDB::add_property("GDLlava", PropertyInfo(Variant::INT, "n_threads", PROPERTY_HINT_NONE), "set_n_threads", "get_n_threads");
33+
34+
ClassDB::bind_method(D_METHOD("get_escape"), &GDLlava::get_escape);
35+
ClassDB::bind_method(D_METHOD("set_escape", "p_escape"), &GDLlava::set_escape);
36+
ClassDB::add_property("GDLlava", PropertyInfo(Variant::BOOL, "escape", PROPERTY_HINT_NONE), "set_escape", "get_escape");
37+
3038
ClassDB::bind_method(D_METHOD("get_n_batch"), &GDLlava::get_n_batch);
3139
ClassDB::bind_method(D_METHOD("set_n_batch", "p_n_batch"), &GDLlava::set_n_batch);
3240
ClassDB::add_property("GDLlava", PropertyInfo(Variant::INT, "n_batch", PROPERTY_HINT_NONE), "set_n_batch", "get_n_batch");
@@ -140,6 +148,22 @@ void GDLlava::set_temperature(const float p_temperature) {
140148
params.sparams.temp = p_temperature;
141149
}
142150

151+
int32_t GDLlava::get_n_threads() const {
152+
return params.n_threads;
153+
}
154+
155+
void GDLlava::set_n_threads(const int32_t p_n_threads) {
156+
params.n_threads = p_n_threads;
157+
}
158+
159+
bool GDLlava::get_escape() const {
160+
return params.escape;
161+
}
162+
163+
void GDLlava::set_escape(const bool p_escape) {
164+
params.escape = p_escape;
165+
}
166+
143167
int32_t GDLlava::get_n_batch() const {
144168
return params.n_batch;
145169
}

Diff for: src/gdllava.h

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class GDLlava : public Node {
4242
void set_n_predict(const int32_t p_n_predict);
4343
float get_temperature() const;
4444
void set_temperature(const float p_temperature);
45+
int32_t get_n_threads() const;
46+
void set_n_threads(const int32_t n_threads);
47+
bool get_escape() const;
48+
void set_escape(const bool p_escape);
4549
int32_t get_n_batch() const;
4650
void set_n_batch(const int32_t p_n_batch);
4751
bool is_running();

0 commit comments

Comments
 (0)