[`bnb`] Fix bnb config json serialization
# What does this PR do?

Fixes #24131 
Fixes https://github.com/huggingface/peft/issues/558

Replaces the PR: https://github.com/huggingface/transformers/pull/24094

To reproduce:

```python
import torch
from transformers import BitsAndBytesConfig, AutoModelForVision2Seq

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForVision2Seq.from_pretrained("Salesforce/blip2-opt-2.7b", quantization_config=bnb_config, device_map='auto')
print(model.config.to_json_string())
```
(or use any causal LM/ text models)

Adds also a nice test

cc @amyeroberts 
_The documentation is not available anymore as the PR was closed or merged._