You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am following along with the "Fine-tune Llama 2 in Google Colab" example notebook in Databricks, but I am receiving this error when I attempt to fine tune the model:
RuntimeError: Expected to mark a variable ready only once. This error is caused by one of the following reasons: 1) Use of a module parameter outside the `forward` function. Please make sure model parameters are not shared across multiple concurrent forward-backward passes. or try to use _set_static_graph() as a workaround if this module graph does not change during training loop.2) Reused parameters in multiple reentrant backward passes. For example, if you use multiple `checkpoint` functions to wrap the same part of your model, it would result in the same set of parameters been used by different reentrant backward passes multiple times, and hence marking a variable ready multiple times. DDP does not support such use cases in default. You can try to use _set_static_graph() as a workaround if your module graph does not change over iterations.
Parameter at index 127 has been marked as ready twice. This means that multiple autograd engine hooks have fired for this particular parameter during this iteration. You can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print parameter names for further debugging.
And here is the final block of the traceback:
File /databricks/python/lib/python3.10/site-packages/torch/autograd/__init__.py:200, in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs)
195 retain_graph = create_graph
197 # The reason we repeat same the comment below is that
198 # some Python versions print out the first line of a multi-line function
199 # calls in the traceback and some print out the last line
--> 200 Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
201 tensors, grad_tensors_, retain_graph, create_graph, inputs,
202 allow_unreachable=True, accumulate_grad=True)
I have tried turning off gradient checkpointing but I received the same error. I am using a g4dn.4xl cluster. Is the problem due to my verion of torch? or cuda? I'm not sure how to set the environment variable, but from what I've seen online it's not very helpful when dealing with these higher level libraries (peft, transformers). Some solutions mention fiddling with find_unused_parameters and _set_static_graph(), but I believe that is on the pytorch level of things, and not a changeable parameter in the code as it stands.
The text was updated successfully, but these errors were encountered:
I am following along with the "Fine-tune Llama 2 in Google Colab" example notebook in Databricks, but I am receiving this error when I attempt to fine tune the model:
And here is the final block of the traceback:
I have tried turning off gradient checkpointing but I received the same error. I am using a g4dn.4xl cluster. Is the problem due to my verion of torch? or cuda? I'm not sure how to set the environment variable, but from what I've seen online it's not very helpful when dealing with these higher level libraries (peft, transformers). Some solutions mention fiddling with
find_unused_parameters
and_set_static_graph()
, but I believe that is on the pytorch level of things, and not a changeable parameter in the code as it stands.The text was updated successfully, but these errors were encountered: