Add the DAC model. (#2433)

* Add the DAC model.

* More quantization support.

* Handle DAC decoding.

* Plug the DAC decoding in parler-tts.
This commit is contained in:
Laurent Mazare
2024-08-19 07:59:51 +01:00
committed by GitHub
parent 58197e1896
commit 236b29ff15
7 changed files with 404 additions and 8 deletions

View File

@ -31,6 +31,7 @@ pub struct Config {
pub decoder: DecoderConfig,
pub text_encoder: t5::Config,
pub vocab_size: usize,
pub audio_encoder: crate::models::dac::Config,
}
#[derive(Debug, Clone)]
@ -325,6 +326,7 @@ pub struct Model {
pub text_encoder: t5::T5EncoderModel,
pub decoder_start_token_id: u32,
pub pad_token_id: u32,
pub audio_encoder: crate::models::dac::Model,
}
impl Model {
@ -347,6 +349,8 @@ impl Model {
} else {
None
};
let audio_encoder =
crate::models::dac::Model::new(&cfg.audio_encoder, vb.pp("audio_encoder"))?;
Ok(Self {
decoder,
text_encoder,
@ -354,6 +358,7 @@ impl Model {
enc_to_dec_proj,
decoder_start_token_id: cfg.decoder_start_token_id,
pad_token_id: cfg.pad_token_id,
audio_encoder,
})
}