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
My training setup produces an Error:
ValueError: The pre-trained model weights are not frozen. For training adapters, please call the train_adapter() method
This occurs in the trainer.train() call.
I setup a BERT Finetuning with adapters and a PredictionHead.
In my setup I DO call the train_adapter method, I also tried to add the set_active_adapters, use the fields to set the active adapters and tried to follow every single guide I could find.
I even tried to freeze the model weights by calling the freeze method myself.
I am almost sure my setup is to blame maybe somebody already encountered this before.
Full Traceback:
Traceback (most recent call last):
File "/home/davido/dr/./star/train_adapters.py", line 267, in
main()
File "/home/davido/dr/./star/train_adapters.py", line 257, in main
trainer.train()
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 1543, in train
return inner_training_loop(
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 1720, in _inner_training_loop
self.control = self.callback_handler.on_train_begin(args, self.state, self.control)
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer_callback.py", line 353, in on_train_begin
return self.call_event("on_train_begin", args, state, control)
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer_callback.py", line 397, in call_event
result = getattr(callback, event)(
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/adapters/trainer.py", line 253, in on_train_begin
raise ValueError(
ValueError: The pre-trained model weights are not frozen. For training adapters, please call the train_adapter() method
Hey @davidobermann, the setup looks good to me. You can remove the set_active_adaptersmethod call since this is already activated by the train_adapter method. But this should not change the validity of the setup. You can check whether the setup adds the adapter, activates it, and freezes the weights by checking that bert.active_adapters has the correct setup and requires_gradis False for the pre-trained model weights by iterating over bert.named_parameters().
Let me know whether that helps with your problem.
Thanks @hSterz for your fast reply, So i did find a way to get it to run by calling freeze_model(True) on the model.
Although now only the head is kept active. When checking the named paramters the entire model is frozen inlcuding the adapter layers.
This issue has been automatically marked as stale because it has been without activity for 90 days. This issue will be closed in 14 days unless you comment or remove the stale label.
My training setup produces an Error:
ValueError: The pre-trained model weights are not frozen. For training adapters, please call the train_adapter() method
This occurs in the trainer.train() call.
I setup a BERT Finetuning with adapters and a PredictionHead.
In my setup I DO call the train_adapter method, I also tried to add the set_active_adapters, use the fields to set the active adapters and tried to follow every single guide I could find.
I even tried to freeze the model weights by calling the freeze method myself.
I am almost sure my setup is to blame maybe somebody already encountered this before.
Full Traceback:
Traceback (most recent call last):
File "/home/davido/dr/./star/train_adapters.py", line 267, in
main()
File "/home/davido/dr/./star/train_adapters.py", line 257, in main
trainer.train()
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 1543, in train
return inner_training_loop(
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 1720, in _inner_training_loop
self.control = self.callback_handler.on_train_begin(args, self.state, self.control)
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer_callback.py", line 353, in on_train_begin
return self.call_event("on_train_begin", args, state, control)
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/trainer_callback.py", line 397, in call_event
result = getattr(callback, event)(
File "/home/davido/miniconda3/lib/python3.10/site-packages/transformers/adapters/trainer.py", line 253, in on_train_begin
raise ValueError(
ValueError: The pre-trained model weights are not frozen. For training adapters, please call the train_adapter() method
My Model Setup:
The text was updated successfully, but these errors were encountered: