MCPcopy Create free account
hub / github.com/deepbrainai-research/float / __init__

Method __init__

models/float/FLOAT.py:180–200  ·  view source on GitHub ↗
(self, opt)

Source from the content-addressed store, hash-verified

178################ Condition Encoders ################
179class AudioEncoder(BaseModel):
180 def __init__(self, opt):
181 super().__init__()
182 self.opt = opt
183 self.only_last_features = opt.only_last_features
184
185 self.num_frames_for_clip = int(opt.wav2vec_sec * self.opt.fps)
186 self.num_prev_frames = int(opt.num_prev_frames)
187
188 self.wav2vec2 = Wav2VecModel.from_pretrained(opt.wav2vec_model_path, local_files_only = True)
189 self.wav2vec2.feature_extractor._freeze_parameters()
190
191 for name, param in self.wav2vec2.named_parameters():
192 param.requires_grad = False
193
194 audio_input_dim = 768 if opt.only_last_features else 12 * 768
195
196 self.audio_projection = nn.Sequential(
197 nn.Linear(audio_input_dim, opt.dim_w),
198 nn.LayerNorm(opt.dim_w),
199 nn.SiLU()
200 )
201
202 def get_wav2vec2_feature(self, a: torch.Tensor, seq_len:int) -> torch.Tensor:
203 a = self.wav2vec2(a, seq_len=seq_len, output_hidden_states = not self.only_last_features)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected