-
Notifications
You must be signed in to change notification settings - Fork 12.2k
sync : ggml (backend v2) #3912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync : ggml (backend v2) #3912
Changes from 12 commits
aa7a2c4
e819070
4fe646f
83c96d5
8401e3e
815f44e
16e819d
e2349ec
f3fb45b
7f8e2a5
075ee61
dc22db7
b1592ea
e50ab5a
081a86d
aa1f36c
a4de804
548ec46
9efc6b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -772,7 +772,7 @@ static struct ggml_tensor * llama_build_lora_finetune_graphs( | |
if (enable_checkpointing) { | ||
ggml_build_backward_gradient_checkpointing(ctx, gf, gb, gb_tmp, checkpoints.data(), (int) checkpoints.size()); | ||
} else { | ||
*gb = *gf; | ||
ggml_graph_cpy(gf, gb); | ||
ggml_build_backward_expand(ctx, gf, gb, true); | ||
} | ||
|
||
|
@@ -1615,6 +1615,7 @@ int main(int argc, char ** argv) { | |
opt->params = ggml_opt_default_params(GGML_OPT_ADAM); | ||
opt->params.print_forward_graph = false; | ||
opt->params.print_backward_graph = false; | ||
opt->params.graph_size = LLAMA_TRAIN_MAX_NODES; | ||
opt->params.n_threads = params.common.n_threads; | ||
opt->params.past = params.common.opt_past; | ||
opt->params.delta = params.common.opt_delta; | ||
|
@@ -1742,8 +1743,8 @@ int main(int argc, char ** argv) { | |
|
||
// context for compute tensors without their data | ||
size_t estimated_compute_size_wo_data = ( | ||
ggml_tensor_overhead()*GGML_MAX_NODES*2 | ||
+ (GGML_OBJECT_SIZE+GGML_GRAPH_SIZE)*( | ||
ggml_tensor_overhead()*LLAMA_TRAIN_MAX_NODES*2 | ||
+ (GGML_OBJECT_SIZE+ggml_graph_overhead())*( | ||
params.common.use_checkpointing ? 3 : 2 | ||
) | ||
); | ||
|
@@ -1768,11 +1769,11 @@ int main(int argc, char ** argv) { | |
for (unsigned order = 0; order < (unsigned) GGML_CGRAPH_EVAL_ORDER_COUNT; ++order) { | ||
ctx_compute = ggml_init(ctx_compute_params); | ||
alloc = ggml_allocr_new_measure(tensor_alignment); | ||
gf = ggml_new_graph(ctx_compute); | ||
gf = ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, true); | ||
gf->order = (enum ggml_cgraph_eval_order) order; | ||
gb = ggml_new_graph(ctx_compute); | ||
gb = ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, false); | ||
gb_tmp = params.common.use_checkpointing | ||
? ggml_new_graph(ctx_compute) | ||
? ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @slaren Does this look OK? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so, I don't know if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Changing the GGML_ASSERT(dst->grads != NULL); With this change finetune runs, I will report back if the results are good as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was an additional - unrelated to this PR - regression in finetune and train-text-from-scratch due to new yarn rope implementation. Changing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to note, lines 1805 and 1807 below needs that change as well, I missed them at first attempt to copy this fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
: NULL; | ||
loss = llama_build_lora_finetune_graphs( | ||
&model, &lora, alloc, ctx_compute, | ||
|
@@ -1801,11 +1802,11 @@ int main(int argc, char ** argv) { | |
mem_compute_data.resize(max_compute_size); | ||
ctx_compute = ggml_init(ctx_compute_params); | ||
alloc = ggml_allocr_new(mem_compute_data.data(), mem_compute_data.size(), tensor_alignment); | ||
gf = ggml_new_graph(ctx_compute); | ||
gf = ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, true); | ||
gf->order = best_order; | ||
gb = ggml_new_graph(ctx_compute); | ||
gb = ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, false); | ||
gb_tmp = params.common.use_checkpointing | ||
? ggml_new_graph(ctx_compute) | ||
? ggml_new_graph_custom(ctx_compute, LLAMA_TRAIN_MAX_NODES, false) | ||
: NULL; | ||
loss = llama_build_lora_finetune_graphs( | ||
&model, &lora, alloc, ctx_compute, | ||
|
Uh oh!
There was an error while loading. Please reload this page.