fix bug when using ggml_opt to optimize params in one context and use a renewable context for eval and opt
when not keeping gradients of model parameters they are overwritten by tensors created by opt, which may be invalid after opt context is renewed. so we need to keep the original gradients and make dups for opt
This commit is contained in:
parent
bc1c13bb66
commit
83ee1cd741
1 changed files with 1 additions and 1 deletions
2
ggml.c
2
ggml.c
|
@ -15131,7 +15131,7 @@ enum ggml_opt_result ggml_opt(
|
|||
|
||||
// build forward + backward compute graphs
|
||||
struct ggml_cgraph gf = ggml_build_forward (f);
|
||||
struct ggml_cgraph gb = ggml_build_backward(ctx, &gf, false);
|
||||
struct ggml_cgraph gb = ggml_build_backward(ctx, &gf, true);
|
||||
|
||||
switch (params.type) {
|
||||
case GGML_OPT_ADAM:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue