Skip to content

Commit

Permalink
⚠️ [CLAP] Fix dtype of logit scales in init (huggingface#25682)
Browse files Browse the repository at this point in the history
[CLAP] Fix dtype of logit scales
  • Loading branch information
sanchit-gandhi authored and parambharat committed Sep 26, 2023
1 parent 28e25e9 commit e4e1f35
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/transformers/models/clap/modeling_clap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from dataclasses import dataclass
from typing import Any, List, Optional, Tuple, Union

import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
Expand Down Expand Up @@ -1956,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.tensor(np.log(config.logit_scale_init_value)))
self.logit_scale_t = nn.Parameter(torch.tensor(np.log(config.logit_scale_init_value)))
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.projection_dim = config.projection_dim

Expand Down

0 comments on commit e4e1f35

Please sign in to comment.