Closed SamuelLarkin closed 1 year ago
I wanted to create a micro model for #57 but it seems that there are some hardcoded values that can't be changed from a config file.
everyvoice train text-to-spec config/everyvoice-text-to-spec.yaml
│ File: config/everyvoice-shared-data.yaml ───────┼────────────────────────────────────────────────────────────────────────────── 1 │ audio: {alignment_bit_depth: 16, alignment_sampling_rate: 22050, f_max: 8000, f_min: 0, 2 │ fft_hop_frames: 4, fft_window_frames: 16, input_sampling_rate: 22050, max_audio_length: 11.0, 3 │ max_wav_value: 32767.0, min_audio_length: 0.4, n_fft: 16, n_mels: 6, norm_db: -3.0, 4 │ output_sampling_rate: 22050, sil_duration: 0.1, sil_threshold: 1.0, spec_type: mel-librosa, 5 │ target_bit_depth: 16, vocoder_segment_size: 32}
RuntimeError: Given groups=1, weight of size [12, 6, 3], expected input[1, 80, 833] to have 6 channels, but got 80 channels instead
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/cli.py:201 in train │ │ │ │ 198 │ from .dataset import FastSpeech2DataModule │ │ 199 │ from .model import FastSpeech2 │ │ 200 │ │ │ ❱ 201 │ train_base_command( │ │ 202 │ │ model_config=FastSpeech2Config, # type: ignore │ │ 203 │ │ model=FastSpeech2, # type: ignore │ │ 204 │ │ data_module=FastSpeech2DataModule, # type: ignore │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/base_cli/helpers.py:161 in │ │ train_base_command │ │ │ │ 158 │ if last_ckpt is None: │ │ 159 │ │ model_obj = model(config) │ │ 160 │ │ tensorboard_logger.log_hyperparams(config.model_dump()) │ │ ❱ 161 │ │ trainer.fit(model_obj, data) │ │ 162 │ else: │ │ 163 │ │ model_obj = model.load_from_checkpoint(last_ckpt) │ │ 164 │ │ # Check if the trainer has changed (but ignore subdir since it is specific to th │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:582 in fit │ │ │ │ 579 │ │ if not isinstance(model, pl.LightningModule): │ │ 580 │ │ │ raise TypeError(f"`Trainer.fit()` requires a `LightningModule`, got: {model. │ │ 581 │ │ self.strategy._lightning_module = model │ │ ❱ 582 │ │ call._call_and_handle_interrupt( │ │ 583 │ │ │ self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, │ │ 584 │ │ ) │ │ 585 │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/call.p │ │ y:36 in _call_and_handle_interrupt │ │ │ │ 33 │ """ │ │ 34 │ try: │ │ 35 │ │ if trainer.strategy.launcher is not None: │ │ ❱ 36 │ │ │ return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, │ │ 37 │ │ else: │ │ 38 │ │ │ return trainer_fn(*args, **kwargs) │ │ 39 │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/strategies/lau │ │ nchers/subprocess_script.py:90 in launch │ │ │ │ 87 │ │ """ │ │ 88 │ │ if not self.cluster_environment.creates_processes_externally: │ │ 89 │ │ │ self._call_children_scripts() │ │ ❱ 90 │ │ return function(*args, **kwargs) │ │ 91 │ │ │ 92 │ def _call_children_scripts(self) -> None: │ │ 93 │ │ # bookkeeping of spawned processes │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:624 in _fit_impl │ │ │ │ 621 │ │ │ model_provided=True, │ │ 622 │ │ │ model_connected=self.lightning_module is not None, │ │ 623 │ │ ) │ │ ❱ 624 │ │ self._run(model, ckpt_path=self.ckpt_path) │ │ 625 │ │ │ │ 626 │ │ assert self.state.stopped │ │ 627 │ │ self.training = False │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:1061 in _run │ │ │ │ 1058 │ │ │ │ 1059 │ │ self._checkpoint_connector.resume_end() │ │ 1060 │ │ │ │ ❱ 1061 │ │ results = self._run_stage() │ │ 1062 │ │ │ │ 1063 │ │ log.detail(f"{self.__class__.__name__}: trainer tearing down") │ │ 1064 │ │ self._teardown() │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:1140 in _run_stage │ │ │ │ 1137 │ │ │ return self._run_evaluate() │ │ 1138 │ │ if self.predicting: │ │ 1139 │ │ │ return self._run_predict() │ │ ❱ 1140 │ │ self._run_train() │ │ 1141 │ │ │ 1142 │ def _pre_training_routine(self) -> None: │ │ 1143 │ │ # wait for all to join if on distributed │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:1153 in _run_train │ │ │ │ 1150 │ │ self._pre_training_routine() │ │ 1151 │ │ │ │ 1152 │ │ with isolate_rng(): │ │ ❱ 1153 │ │ │ self._run_sanity_check() │ │ 1154 │ │ │ │ 1155 │ │ # enable train mode │ │ 1156 │ │ assert self.model is not None │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:1225 in _run_sanity_check │ │ │ │ 1222 │ │ │ │ │ 1223 │ │ │ # run eval step │ │ 1224 │ │ │ with torch.no_grad(): │ │ ❱ 1225 │ │ │ │ val_loop.run() │ │ 1226 │ │ │ │ │ 1227 │ │ │ self._call_callback_hooks("on_sanity_check_end") │ │ 1228 │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/loops/loop.py: │ │ 199 in run │ │ │ │ 196 │ │ while not self.done: │ │ 197 │ │ │ try: │ │ 198 │ │ │ │ self.on_advance_start(*args, **kwargs) │ │ ❱ 199 │ │ │ │ self.advance(*args, **kwargs) │ │ 200 │ │ │ │ self.on_advance_end() │ │ 201 │ │ │ │ self._restarting = False │ │ 202 │ │ │ except StopIteration: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/loops/dataload │ │ er/evaluation_loop.py:152 in advance │ │ │ │ 149 │ │ kwargs = OrderedDict() │ │ 150 │ │ if self.num_dataloaders > 1: │ │ 151 │ │ │ kwargs["dataloader_idx"] = dataloader_idx │ │ ❱ 152 │ │ dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs) │ │ 153 │ │ │ │ 154 │ │ # store batch level output per dataloader │ │ 155 │ │ self._outputs.append(dl_outputs) │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/loops/loop.py: │ │ 199 in run │ │ │ │ 196 │ │ while not self.done: │ │ 197 │ │ │ try: │ │ 198 │ │ │ │ self.on_advance_start(*args, **kwargs) │ │ ❱ 199 │ │ │ │ self.advance(*args, **kwargs) │ │ 200 │ │ │ │ self.on_advance_end() │ │ 201 │ │ │ │ self._restarting = False │ │ 202 │ │ │ except StopIteration: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/ev │ │ aluation_epoch_loop.py:137 in advance │ │ │ │ 134 │ │ self.batch_progress.increment_started() │ │ 135 │ │ │ │ 136 │ │ # lightning module methods │ │ ❱ 137 │ │ output = self._evaluation_step(**kwargs) │ │ 138 │ │ output = self._evaluation_step_end(output) │ │ 139 │ │ │ │ 140 │ │ self.batch_progress.increment_processed() │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/ev │ │ aluation_epoch_loop.py:234 in _evaluation_step │ │ │ │ 231 │ │ │ the outputs of the step │ │ 232 │ │ """ │ │ 233 │ │ hook_name = "test_step" if self.trainer.testing else "validation_step" │ │ ❱ 234 │ │ output = self.trainer._call_strategy_hook(hook_name, *kwargs.values()) │ │ 235 │ │ │ │ 236 │ │ return output │ │ 237 │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/trainer/traine │ │ r.py:1443 in _call_strategy_hook │ │ │ │ 1440 │ │ │ return │ │ 1441 │ │ │ │ 1442 │ │ with self.profiler.profile(f"[Strategy]{self.strategy.__class__.__name__}.{hook_ │ │ ❱ 1443 │ │ │ output = fn(*args, **kwargs) │ │ 1444 │ │ │ │ 1445 │ │ # restore current_fx when nested context │ │ 1446 │ │ pl_module._current_fx_name = prev_fx_name │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/strategies/ddp │ │ .py:360 in validation_step │ │ │ │ 357 │ │ │ assert self.model is not None │ │ 358 │ │ │ if self.lightning_module.trainer.state.fn == TrainerFn.FITTING: │ │ 359 │ │ │ │ # used when calling `trainer.fit` │ │ ❱ 360 │ │ │ │ return self.model(*args, **kwargs) │ │ 361 │ │ │ else: │ │ 362 │ │ │ │ # used when calling `trainer.validate` │ │ 363 │ │ │ │ assert isinstance(self.model, ValidationStep) │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/parallel/distributed.py │ │ :1040 in forward │ │ │ │ 1037 │ │ │ │ # Notify joined ranks whether they should sync in backwards pass or not. │ │ 1038 │ │ │ │ self._check_global_requires_backward_grad_sync(is_joined_rank=False) │ │ 1039 │ │ │ │ │ ❱ 1040 │ │ │ output = self._run_ddp_forward(*inputs, **kwargs) │ │ 1041 │ │ │ │ │ 1042 │ │ │ # sync params according to location (before/after forward) user │ │ 1043 │ │ │ # specified as part of hook, if hook was specified. │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/parallel/distributed.py │ │ :1003 in _run_ddp_forward │ │ │ │ 1000 │ │ │ │ return module_to_run(*inputs[0], **kwargs[0]) │ │ 1001 │ │ else: │ │ 1002 │ │ │ with self._inside_ddp_forward(): │ │ ❱ 1003 │ │ │ │ return module_to_run(*inputs, **kwargs) │ │ 1004 │ │ │ 1005 │ def forward(self, *inputs, **kwargs): │ │ 1006 │ │ with torch.autograd.profiler.record_function("DistributedDataParallel.forward"): │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pytorch_lightning/overrides/base │ │ .py:110 in forward │ │ │ │ 107 │ │ │ if trainer.testing: │ │ 108 │ │ │ │ return self._forward_module.test_step(*inputs, **kwargs) │ │ 109 │ │ │ if trainer.sanity_checking or trainer.validating: │ │ ❱ 110 │ │ │ │ return self._forward_module.validation_step(*inputs, **kwargs) │ │ 111 │ │ │ if trainer.predicting: │ │ 112 │ │ │ │ return self._forward_module.predict_step(*inputs, **kwargs) │ │ 113 │ │ return self._forward_module(*inputs, **kwargs) │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/model.py:242 in validation_step │ │ │ │ 239 │ │ │ │ │ self.global_step, │ │ 240 │ │ │ │ │ gt_sr, │ │ 241 │ │ │ │ ) │ │ ❱ 242 │ │ output = self(batch) │ │ 243 │ │ if batch_idx == 0: │ │ 244 │ │ │ # Currently only plots the first one, but the function is writte to support │ │ 245 │ │ │ if self.config.model.learn_alignment: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/model.py:136 in forward │ │ │ │ 133 │ │ │ x = x + lang_emb.unsqueeze(1) │ │ 134 │ │ │ │ 135 │ │ # VarianceAdaptor out │ │ ❱ 136 │ │ variance_adaptor_out = self.variance_adaptor( │ │ 137 │ │ │ inputs, x, batch, src_mask, control, inference=inference │ │ 138 │ │ ) │ │ 139 │ │ # Create inference Mel lens │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/variance_adaptor.py:249 in forward │ │ │ │ 246 │ │ │ # make sure to do the alignments before folding │ │ 247 │ │ │ attn_mask = src_mask[..., None] == 0 │ │ 248 │ │ │ # attn_mask should be 1 for unused timesteps in the text_enc_w_spkvec tensor │ │ ❱ 249 │ │ │ attn_soft, attn_logprob = self.attention( │ │ 250 │ │ │ │ batch["mel"].transpose(1, 2), │ │ 251 │ │ │ │ text_emb.transpose(1, 2), │ │ 252 │ │ │ │ batch["mel_lens"], │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/attention.py:224 in forward │ │ │ │ 221 │ │ │ if self.align_query_enc_type == "inv_conv": │ │ 222 │ │ │ │ queries_enc, _ = self.query_proj(queries) │ │ 223 │ │ │ elif self.align_query_enc_type == "3xconv": │ │ ❱ 224 │ │ │ │ queries_enc = self.query_proj(queries) │ │ 225 │ │ │ │ # log_det_W = 0.0 │ │ 226 │ │ │ else: │ │ 227 │ │ │ │ queries_enc, _ = self.query_proj(queries) │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/container.py:20 │ │ 4 in forward │ │ │ │ 201 │ # with Any as TorchScript expects a more precise type │ │ 202 │ def forward(self, input): │ │ 203 │ │ for module in self: │ │ ❱ 204 │ │ │ input = module(input) │ │ 205 │ │ return input │ │ 206 │ │ │ 207 │ def append(self, module: Module) -> 'Sequential': │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │ │ ing/fs2/attention.py:53 in forward │ │ │ │ 50 │ │ ) │ │ 51 │ │ │ 52 │ def forward(self, signal): │ │ ❱ 53 │ │ conv_signal = self.conv(signal) │ │ 54 │ │ return conv_signal │ │ 55 │ │ 56 │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/module.py:1194 │ │ in _call_impl │ │ │ │ 1191 │ │ # this function, and just call forward. │ │ 1192 │ │ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o │ │ 1193 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks): │ │ ❱ 1194 │ │ │ return forward_call(*input, **kwargs) │ │ 1195 │ │ # Do not call functions when jit is used │ │ 1196 │ │ full_backward_hooks, non_full_backward_hooks = [], [] │ │ 1197 │ │ if self._backward_hooks or _global_backward_hooks: │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/conv.py:313 in │ │ forward │ │ │ │ 310 │ │ │ │ │ │ self.padding, self.dilation, self.groups) │ │ 311 │ │ │ 312 │ def forward(self, input: Tensor) -> Tensor: │ │ ❱ 313 │ │ return self._conv_forward(input, self.weight, self.bias) │ │ 314 │ │ 315 │ │ 316 class Conv2d(_ConvNd): │ │ │ │ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/torch/nn/modules/conv.py:309 in │ │ _conv_forward │ │ │ │ 306 │ │ │ return F.conv1d(F.pad(input, self._reversed_padding_repeated_twice, mode=sel │ │ 307 │ │ │ │ │ │ │ weight, bias, self.stride, │ │ 308 │ │ │ │ │ │ │ _single(0), self.dilation, self.groups) │ │ ❱ 309 │ │ return F.conv1d(input, weight, bias, self.stride, │ │ 310 │ │ │ │ │ │ self.padding, self.dilation, self.groups) │ │ 311 │ │ │ 312 │ def forward(self, input: Tensor) -> Tensor: │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
you probably ran the preprocessing with the 80 mel configuration?
you would need to re-process it if you change the way the spectrogram is created
I wanted to create a micro model for #57 but it seems that there are some hardcoded values that can't be changed from a config file.
Traceback