openvpi / DiffSinger

An advanced singing voice synthesis system with high fidelity, expressiveness, controllability and flexibility based on DiffSinger: Singing Voice Synthesis via Shallow Diffusion Mechanism
Apache License 2.0
2.73k stars 288 forks source link

KeyError: 'ph2word' #209

Closed CLydq closed 1 month ago

CLydq commented 1 month ago

如题。

进度条出现一会后报错:

raceback (most recent call last):
  File "scripts/train.py", line 31, in <module>
    run_task()
  File "scripts/train.py", line 27, in run_task
    task_cls.start()
  File "D:\AITools\DiffSinger\basics\base_task.py", line 468, in start
    trainer.fit(task, ckpt_path=get_latest_checkpoint_path(work_dir))
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 543, in fit
    call._call_and_handle_interrupt(
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\call.py", line 44, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 579, in _fit_impl
    self._run(model, ckpt_path=ckpt_path)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 986, in _run
    results = self._run_stage()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 1028, in _run_stage
    self._run_sanity_check()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 1057, in _run_sanity_check
    val_loop.run()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\loops\utilities.py", line 182, in _decorator
    return loop_run(self, *args, **kwargs)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\loops\evaluation_loop.py", line 128, in run
    batch, batch_idx, dataloader_idx = next(data_fetcher)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\loops\fetchers.py", line 133, in __next__
    batch = super().__next__()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\loops\fetchers.py", line 60, in __next__
    batch = next(self.iterator)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\utilities\combined_loader.py", line 341, in __next__
    out = next(self._iterator)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\lightning\pytorch\utilities\combined_loader.py", line 142, in __next__
    out = next(self.iterators[0])
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\utils\data\dataloader.py", line 630, in __next__
    data = self._next_data()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\utils\data\dataloader.py", line 1344, in _next_data
    return self._process_data(data)
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\utils\data\dataloader.py", line 1370, in _process_data
    data.reraise()
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\_utils.py", line 706, in reraise
    raise exception
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\utils\data\_utils\worker.py", line 309, in _worker_loop
    data = fetcher.fetch(index)  # type: ignore[possibly-undefined]
  File "C:\Users\china\.conda\envs\DiffSinger\lib\site-packages\torch\utils\data\_utils\fetch.py", line 55, in fetch
    return self.collate_fn(data)
  File "D:\AITools\DiffSinger\training\variance_task.py", line 45, in collater
    batch['ph2word'] = utils.collate_nd([s['ph2word'] for s in samples], 0)
  File "D:\AITools\DiffSinger\training\variance_task.py", line 45, in <listcomp>
    batch['ph2word'] = utils.collate_nd([s['ph2word'] for s in samples], 0)
KeyError: 'ph2word'

我的配置文件:

base_config:
  - configs/variance.yaml

raw_data_dir:
  - data/Firefly/raw
speakers:
  - Firefly
spk_ids: []
test_prefixes:
  - Firefly (1)
  - Firefly (2)
  - Firefly (3)
  - Firefly (4)
  - Firefly (5)
dictionary: dictionaries/opencpop-extension.txt
binary_data_dir: data/Firefly/binary
binarization_args:
  num_workers: 0

pe: parselmouth
pe_ckpt: 'checkpoints/rmvpe/model.pt'
hnsep: vr
hnsep_ckpt: 'checkpoints/vr/model.pt'

use_spk_id: false
num_spk: 1
# NOTICE: before enabling variance modules, please read the docs at
# https://github.com/openvpi/DiffSinger/tree/main/docs/BestPractices.md#mutual-influence-between-variance-modules
predict_dur: true
predict_pitch: true
# NOTICE: before enabling variance predictions, please read the docs at
# https://github.com/openvpi/DiffSinger/tree/main/docs/BestPractices.md#choosing-variance-parameters
predict_energy: true
predict_breathiness: true
predict_voicing: true
predict_tension: false

energy_db_min: -96.0
energy_db_max: -12.0

breathiness_db_min: -96.0
breathiness_db_max: -20.0

voicing_db_min: -96.0
voicing_db_max: -12.0

tension_logit_min: -10.0
tension_logit_max: 10.0

hidden_size: 256
dur_prediction_args:
  arch: fs2
  hidden_size: 512
  dropout: 0.1
  num_layers: 5
  kernel_size: 3
  log_offset: 1.0
  loss_type: mse
  lambda_pdur_loss: 0.3
  lambda_wdur_loss: 1.0
  lambda_sdur_loss: 3.0

use_melody_encoder: false
melody_encoder_args:
  hidden_size: 128
  enc_layers: 4
use_glide_embed: false
glide_types: [up, down]
glide_embed_scale: 11.313708498984760  # sqrt(128)

diffusion_type: reflow

pitch_prediction_args:
  pitd_norm_min: -8.0
  pitd_norm_max: 8.0
  pitd_clip_min: -12.0
  pitd_clip_max: 12.0
  repeat_bins: 64
  residual_layers: 20
  residual_channels: 256
  dilation_cycle_length: 5  # *

variances_prediction_args:
  total_repeat_bins: 48
  residual_layers: 10
  residual_channels: 192
  dilation_cycle_length: 4  # *

lambda_dur_loss: 1.0
lambda_pitch_loss: 1.0
lambda_var_loss: 1.0

optimizer_args:
  lr: 0.0006
lr_scheduler_args:
  scheduler_cls: torch.optim.lr_scheduler.StepLR
  step_size: 10000
  gamma: 0.75
max_batch_frames: 80000
max_batch_size: 48
max_updates: 160000

num_valid_plots: 10
val_check_interval: 2000
num_ckpt_keep: 5
permanent_ckpt_start: 80000
permanent_ckpt_interval: 10000
pl_trainer_devices: 'auto'
pl_trainer_precision: '16-mixed'

拉取一次主分支后错误仍然存在。

yqzhishen commented 1 month ago

修改配置文件后需要重新预处理才能训练

CLydq commented 1 month ago

修改配置文件后需要重新预处理才能训练

感谢。

回头有时间去试一下。

CLydq commented 1 month ago

问题解决了。

感谢。