seongmin-kye / meta-SR

Pytorch implementation of Meta-Learning for Short Utterance Speaker Recognition with Imbalance Length Pairs (Interspeech, 2020)
73 stars 19 forks source link

Training error #6

Closed ooobsidian closed 3 years ago

ooobsidian commented 3 years ago

Hello, thank you for your excellent code.I used my own dataset not voxceleb to train a model, but when I run python train.py --loss_type prototypical --use_GC True --n_shot 1 --n_query 2 --use_variable True --nb_class_train 100, it gives me an error

train.py:56: UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.
  warnings.warn('You have chosen to seed training. '
Initialized Prototypical Loss
[0] 100
Traceback (most recent call last):
  File "train.py", line 233, in <module>
    main()
  File "train.py", line 91, in main
    train(train_generator, model, objective, optimizer, n_episode, log_dir, scheduler)
  File "train.py", line 101, in train
    for t, (data) in train_generator:
  File "/root/meta-SR/generator/meta_generator.py", line 34, in __next__
    return self.next()
  File "/root/meta-SR/generator/meta_generator.py", line 39, in next
    images, labels = self.sample(self.nb_classes, self.nb_samples_per_class)
  File "/root/meta-SR/generator/meta_generator.py", line 49, in sample
    sampled_characters = random.sample(self.data.keys(), nb_classes)
  File "/root/miniconda3/lib/python3.8/random.py", line 363, in sample
    raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

How to slove it, thank you!

seongmin-kye commented 3 years ago

Hi. I think that there are some class in your data which have less than 3 files. Thanks

ooobsidian commented 3 years ago

I will check it out, thank you!