TypeError: to_json_file() got an unexpected keyword argument 'use_diff'
Author: ADaBenxiong
Pull request: no
Labels: name: bug

### System Info

transformers/modeling_utils.py
    model_to_save.config.save_pretrained(save_directory)
transformers/configuration_utils.py
   self.to_json_file(output_config_file, use_diff=True)                                                                                                                                                                                        
   TypeError: to_json_file() got an unexpected keyword argument 'use_diff' 

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

unwrapped_model = accelerator.unwrap_model(student_model)
unwrapped_model.**save_pretrained**(args.output_dir, save_function=accelerator.save)

### Expected behavior

Transformer 4.17.0

Comments:
Maybe @muellerzr or @sgugger have an idea?

Very strange. Can you tell us a bit more about your system? Specifically the python version you are using and the accelerate version? (Might not be relevant, but so we can know everything)

This is not linked to Accelerate at all, just the internals of `save_pretrained`. Without the whole traceback and the code executed, we can't really though.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

I get the same error when I run `run_summarization_no_trainer.py` script from [DQ-Bart](https://github.com/amazon-science/dq-bart) repo:

```
python3 run_summarization_no_trainer.py \
  --model_name_or_path google/flan-t5-base \
  --dataset_name samsum \
  --pred_distill \
  --num_train_epochs 1 \
  --weight_bits 8 \
  --do_train \
  --do_test \
  --distill_encoder 6 \
  --distill_decoder 6 \
  --learning_rate 5e-5 \
  --source_prefix summarize:  \
  --seed 7 \
```

The error happens in [line 822](https://github.com/amazon-science/dq-bart/blob/main/run_summarization_no_trainer.py#L822) when trying to save the trained student model. 

This is the whole traceback:

```
File "run_summarization_no_trainer.py", line 896, in <module>
    main()
File "run_summarization_no_trainer.py", line 822, in main
    unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save)
File "/opt/conda/lib/python3.8/site-packages/transformers/modeling_utils.py", line 1068, in save_pretrained
    model_to_save.config.save_pretrained(save_directory)
File "/opt/conda/lib/python3.8/site-packages/transformers/configuration_utils.py", line 438, in save_pretrained
    self.to_json_file(output_config_file, use_diff=True)
TypeError: to_json_file() got an unexpected keyword argument 'use_diff'
```

These are the dependencies:

```
transformers==4.17.0
datasets==1.18.4
sacrebleu==2.0
wandb
nltk
accelerate==0.5.1
tensorboard
setuptools<50
rouge_score
py7zr
```

I have tried to remove `use_diff=True` from `self.to_json_file(output_config_file, use_diff=True)` but I still get the same error. 

Any help is appreciated @sgugger @muellerzr






That error should be raised on that repo @jmdu99 as they use a custom configuration for their model that doesn't implement the same APIs as the Transformers configurations.

Just out of curiosity, what was the problem in your case @ADaBenxiong? Did you find a solution?