Skip to content

[Bug] RuntimeError: Trying to backward through the graph a second time #3543

@nguyendinhduybigtreetc

Description

@nguyendinhduybigtreetc

Hello, i got this error when training whiper v3. does anyone know how to debug this:


RuntimeError Traceback (most recent call last)
/tmp/ipython-input-773422404.py in <cell line: 0>()
----> 1 trainer_stats = trainer.train()

12 frames
/usr/local/lib/python3.12/dist-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py in backward(ctx, *flat_args)
2196 def backward(ctx, *flat_args):
2197 all_args = _backward_prologue_functional(
-> 2198 ctx.saved_tensors,
2199 ctx.symints,
2200 CompiledFunction.metadata,

RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions