From 8bdeb54d153020db456fc65e0b56e09b08ac341c Mon Sep 17 00:00:00 2001 From: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com> Date: Fri, 25 Aug 2023 13:30:39 +0100 Subject: [PATCH] [CLAP] Fix logit scales dtype for fp16 (#25754) --- src/transformers/models/clap/modeling_clap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/models/clap/modeling_clap.py b/src/transformers/models/clap/modeling_clap.py index 357baa650225..1d17a5188387 100644 --- a/src/transformers/models/clap/modeling_clap.py +++ b/src/transformers/models/clap/modeling_clap.py @@ -1955,8 +1955,8 @@ def __init__(self, config: ClapConfig): text_config = config.text_config audio_config = config.audio_config - self.logit_scale_a = nn.Parameter(torch.log(torch.tensor(config.logit_scale_init_value))) - self.logit_scale_t = nn.Parameter(torch.log(torch.tensor(config.logit_scale_init_value))) + self.logit_scale_a = nn.Parameter(torch.tensor(math.log(config.logit_scale_init_value))) + self.logit_scale_t = nn.Parameter(torch.tensor(math.log(config.logit_scale_init_value))) self.projection_dim = config.projection_dim