Deeppavlov 0.15 and latest transformers

Dear all,

Is it possible to use the latest transformers with deeppavlov 0.15? I get the following error with torch_transformers_classifier, which is resolved only if I downgrade to transformers==3.4.0.

Traceback (most recent call last): File "/path//lib/python3.7/", line 193, in _run_module_as_main "__main__", mod_spec) File "/path//lib/python3.7/", line 85, in _run_code exec(code, run_globals) File "/path//lib/python3.7/site-packages/deeppavlov/", line 4, in <module> main() File "/path//lib/python3.7/site-packages/deeppavlov/", line 85, in main start_epoch_num=args.start_epoch_num) File "/path//lib/python3.7/site-packages/deeppavlov/core/commands/", line 121, in train_evaluate_model_from_config trainer.train(iterator) File "/path//lib/python3.7/site-packages/deeppavlov/core/trainers/", line 337, in train self.train_on_batches(iterator) File "/path//lib/python3.7/site-packages/deeppavlov/core/trainers/", line 41, in train_on_batches super(TorchTrainer, self).train_on_batches(iterator=iterator) File "/path//lib/python3.7/site-packages/deeppavlov/core/trainers/", line 283, in train_on_batches self.last_result = self._chainer.train_on_batch(x, y_true) File "/path//lib/python3.7/site-packages/deeppavlov/core/common/", line 169, in train_on_batch return component.train_on_batch(*preprocessed) File "/path//lib/python3.7/site-packages/deeppavlov/models/torch_bert/", line 121, in train_on_batch loss.backward() AttributeError: 'str' object has no attribute 'backward'


Hey @papadako ,

Unfortunately this is the case for now, new upcoming version of DeepPavlov 0.16 will support the most recent transformer. I believe it will be available in a week.

1 Like