BARK: 'GenerationConfig' object has no attribute 'semantic_config' 
Author: Cazforshort
Pull request: no

### System Info

python 3.10.3
Windows 10
transformers       4.37.0.dev0
torch              2.0.1



### Who can help?

@sanchit-gandhi 

### Information

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

### Tasks

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

### Reproduction

I am unable to use the Bark config files (necessary to set min_eos_p). the smeantic configuration is not being passed to the generationconfig properly for some reason.

```
import nltk
import torch
from transformers import (
         BarkSemanticConfig,
         BarkCoarseConfig,
         BarkFineConfig,
         BarkModel,
         BarkConfig,
         AutoConfig,
     )
from transformers import AutoProcessor, set_seed

MODEL_NAME = "suno/bark"
voice_preset = "v2/en_speaker_9"
sampling_rate = 24000
device = "cuda:0" if torch.cuda.is_available() else "cpu"
processor = AutoProcessor.from_pretrained(MODEL_NAME)
min_eos_p=0.5

text_prompt = "[frowns slightly] Hmmph, typical. Ignoring people is quite common among adults, especially when faced with unknown situations. However, we must press forward nonetheless."
sentences = nltk.sent_tokenize(text_prompt)


# Initializing Bark sub-modules configurations.
semantic_config = BarkSemanticConfig(min_eos_p=min_eos_p)
coarse_acoustics_config = BarkCoarseConfig()
fine_acoustics_config = BarkFineConfig()
codec_config = AutoConfig.from_pretrained("facebook/encodec_24khz")
configuration = BarkConfig.from_sub_model_configs(
    semantic_config, coarse_acoustics_config, fine_acoustics_config, codec_config
    )
model = BarkModel(config = configuration).to(device)
output = model.generate(**inputs)
```

**Error:**
**AttributeError: 'GenerationConfig' object has no attribute 'semantic_config'**


### Expected behavior

min_eos_p should be set by the config and used to generate speech from bark.

Comments:
cc @ylacombe as well. Seems like this should be supported from the doc, so might just be the generation config not being initialized properly. 
Maybe `model.generation_config = model.config` will fix this in the meantime @Cazforshort 

> model.generation_config = model.config

No luck

```
MODEL_NAME = "suno/bark"
voice_preset = "v2/en_speaker_9"
sampling_rate = 24000
device = "cuda:0" if torch.cuda.is_available() else "cpu"
processor = AutoProcessor.from_pretrained(MODEL_NAME)
min_eos_p=0.5

text_prompt = "[frowns slightly] Hmmph, typical. Ignoring people is quite common among adults, especially when faced with unknown situations. However, we must press forward nonetheless."
sentences = nltk.sent_tokenize(text_prompt)


# Initializing Bark sub-modules configurations.
semantic_config = BarkSemanticConfig(min_eos_p=min_eos_p)
coarse_acoustics_config = BarkCoarseConfig()
fine_acoustics_config = BarkFineConfig()
codec_config = AutoConfig.from_pretrained("facebook/encodec_24khz")
configuration = BarkConfig.from_sub_model_configs(
    semantic_config, coarse_acoustics_config, fine_acoustics_config, codec_config
    )
model = BarkModel(config = configuration).to(device)
model.generation_config = model.config
```

TypeError: transformers.models.bark.generation_configuration_bark.BarkSemanticGenerationConfig() argument after ** must be a mapping, not BarkSemanticConfig

Hi @Cazforshort, you have to use a `BarkGenerationConfig` instead of a `GenerationConfig`:
```python
from transformers.models.bark.generation_configuration_bark import BarkGenerationConfig

model.generation_config = BarkGenerationConfig()
```

BTW, to modify `min_eos_p`, you don't have to necessarily pass by the generation config, you can simply pass `min_eos_p=XXX` to `BarkModel.generate`. 


> Hi @Cazforshort, you have to use a `BarkGenerationConfig` instead of a `GenerationConfig`:
> 
> ```python
> from transformers.models.bark.generation_configuration_bark import BarkGenerationConfig
> 
> model.generation_config = BarkGenerationConfig()
> ```
> 
> BTW, to modify `min_eos_p`, you don't have to necessarily pass by the generation config, you can simply pass `min_eos_p=XXX` to `BarkModel.generate`.

Still seeing the same errors. I tried just using that gen fig and also starting with the other config and overwriting, but I just get the same sort of errors.

```
from transformers import (
            BarkSemanticConfig,
            BarkCoarseConfig,
            BarkFineConfig,
            BarkModel,
            BarkConfig,
            AutoConfig,
     )
from transformers.models.bark.generation_configuration_bark import BarkGenerationConfig
import torch
from transformers import AutoProcessor, set_seed
from optimum.bettertransformer import BetterTransformer
import scipy
import numpy as np
import nltk  # we'll use this to split into sentences


MODEL_NAME = "suno/bark"
voice_preset = "v2/en_speaker_9"
sampling_rate = 24000
device = "cuda:0" if torch.cuda.is_available() else "cpu"
processor = AutoProcessor.from_pretrained(MODEL_NAME)
min_eos_p=0.5

text_prompt = "[frowns slightly] Hmmph, typical. Ignoring people is quite common among adults, especially when faced with unknown situations. However, we must press forward nonetheless."
sentences = nltk.sent_tokenize(text_prompt)

# Initializing Bark sub-modules configurations.
semantic_config = BarkSemanticConfig(min_eos_p=min_eos_p)
coarse_acoustics_config = BarkCoarseConfig()
fine_acoustics_config = BarkFineConfig()
codec_config = AutoConfig.from_pretrained("facebook/encodec_24khz")

configuration = BarkConfig.from_sub_model_configs(
                    semantic_config, 
                    coarse_acoustics_config, 
                    fine_acoustics_config, 
                    codec_config
                )
gen_configuration = BarkGenerationConfig(
                    semantic_config, 
                    coarse_acoustics_config, 
                    fine_acoustics_config, 
                    codec_config
                )

model = BarkModel(config = configuration).to(device)
model.generation_config = gen_configuration
inputs = processor(sentences,voice_preset=voice_preset).to(device)

output = model.generate(**inputs)
```
**Error:
TypeError: transformers.models.bark.generation_configuration_bark.BarkSemanticGenerationConfig() argument after ** must be a mapping, not BarkSemanticGenerationConfig**

model.generate seems to be ignoring the min_eos_p parameter. I tried passing it there but the results were identical unlike when I tested it without transformers.

You have to use `BarkGenerationConfig.from_sub_model_configs` !

> model.generate seems to be ignoring the min_eos_p parameter. I tried passing it there but the results were identical unlike when I tested it without transformers.

Can you send a snippet for that ?

> You have to use `BarkGenerationConfig.from_sub_model_configs` !
> 
> > model.generate seems to be ignoring the min_eos_p parameter. I tried passing it there but the results were identical unlike when I tested it without transformers.
> 
> Can you send a snippet for that ?

Hmm, same error about passing a config instead of a mapping.

`MODEL_NAME = "suno/bark"
voice_preset = "v2/en_speaker_9"
sampling_rate = 24000
device = "cuda:0" if torch.cuda.is_available() else "cpu"
processor = AutoProcessor.from_pretrained(MODEL_NAME)
min_eos_p=0.5

text_prompt = "[frowns slightly] Hmmph, typical. Ignoring people is quite common among adults, especially when faced with unknown situations. However, we must press forward nonetheless."
sentences = nltk.sent_tokenize(text_prompt)

# Initializing Bark sub-modules configurations.
semantic_config = BarkSemanticConfig(min_eos_p=min_eos_p)
coarse_acoustics_config = BarkCoarseConfig()
fine_acoustics_config = BarkFineConfig()
codec_config = AutoConfig.from_pretrained("facebook/encodec_24khz")

configuration = BarkConfig.from_sub_model_configs(
                    semantic_config, 
                    coarse_acoustics_config, 
                    fine_acoustics_config, 
                    codec_config
                )
gen_configuration = BarkGenerationConfig.from_sub_model_configs(
                    semantic_config, 
                    coarse_acoustics_config, 
                    fine_acoustics_config, 
                )
# model = BarkModel.from_pretrained(MODEL_NAME, torch_dtype=torch.float16).to(device)
model = BarkModel(config = configuration).to(device)
model.generation_config = gen_configuration
inputs = processor(sentences,voice_preset=voice_preset).to(device)

output = model.generate(**inputs)`

**Error:
TypeError: transformers.models.bark.generation_configuration_bark.BarkSemanticGenerationConfig() argument after ** must be a mapping, not BarkSemanticGenerationConfig**

As for passing it directly to generate, I think I wasn't setting it low enough. It seems to be dropping it, but little static is keeping the clips from shortening. So it probably was working and I just need to play around with temps.

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.