bark icon indicating copy to clipboard operation
bark copied to clipboard

Huggingface config min_eos_p

Open iv2985 opened this issue 1 year ago • 1 comments

min_eos_p is a documented option for using the Bark API. Is there a way to configure this via the transformers python module in either the BarkModel or AutoProcessor?

iv2985 avatar Oct 18 '24 20:10 iv2985

You can set this option when call model.generate() function. The default value of min_eos_p is 0.2, temperature(also known as temp in Bark API) is 0.7.

import scipy
from transformers import AutoProcessor, BarkModel

processor = AutoProcessor.from_pretrained("/path/to/bark/model")
model = BarkModel.from_pretrained("/path/to/bark/model")

inputs = processor("some text here", voice_preset="v2/en_speaker_3")

audio_array = model.generate(
	**inputs,
	min_eos_p=0.05,
	temperature=0.6
)
audio_array = audio_array.cpu().numpy().squeeze()

scipy.io.wavfile.write("bark_out.wav", rate=model.generation_config.sample_rate, data=audio_array)

alex1001222 avatar Nov 05 '25 10:11 alex1001222