Skip to content

Commit 1ce1c1a

Browse files
committed
feat: make lora graph size variable
1 parent 19fbfd8 commit 1ce1c1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lora.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "ggml_extend.hpp"
55

6-
#define LORA_GRAPH_SIZE 15360
6+
#define LORA_GRAPH_BASE_SIZE 10240
77

88
struct LoraModel : public GGMLRunner {
99
enum lora_t {
@@ -238,7 +238,8 @@ struct LoraModel : public GGMLRunner {
238238
}
239239

240240
struct ggml_cgraph* build_lora_graph(std::map<std::string, struct ggml_tensor*> model_tensors, SDVersion version) {
241-
struct ggml_cgraph* gf = ggml_new_graph_custom(compute_ctx, LORA_GRAPH_SIZE, false);
241+
size_t lora_graph_size = LORA_GRAPH_BASE_SIZE + lora_tensors.size() * 10;
242+
struct ggml_cgraph* gf = ggml_new_graph_custom(compute_ctx, lora_graph_size, false);
242243

243244
zero_index = ggml_new_tensor_1d(compute_ctx, GGML_TYPE_I32, 1);
244245
set_backend_tensor_data(zero_index, zero_index_vec.data());

0 commit comments

Comments
 (0)