urchade / GLiNER

Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts) @ NAACL 2024
https://arxiv.org/abs/2311.08526
Apache License 2.0
1.47k stars 126 forks source link

Finetuning Fail #208

Closed gptob closed 2 weeks ago

gptob commented 2 weeks ago

I am trying finetuning with the example code and data, but it returns this error on training:

File "Gliner_FineTuning.py", line 84, in trainer.train() File "lib/python3.12/site-packages/transformers/trainer.py", line 2122, in train return inner_training_loop( ^^^^^^^^^^^^^^^^^^^^ File "lib/python3.12/site-packages/transformers/trainer.py", line 2474, in _inner_training_loop tr_loss_step = self.training_step(model, inputs, num_items_in_batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Trainer.training_step() takes 3 positional arguments but 4 were given

didmar commented 2 weeks ago

This is caused by a recent change in transformers: https://github.com/huggingface/transformers/commit/6ba31a8a94bf7cfeaf59ffc3bc9e0b0cd3e25788#diff-ed55888e6665791fe92cc8fc0c499da54f4ace6738551cd9a2591881cda076deR2458

You should downgrade transformers to 4.45.2 (the most recent version supported by GLiNER)