Zejun-Yang / AniPortrait

AniPortrait: Audio-Driven Synthesis of Photorealistic Portrait Animation
Apache License 2.0
4.54k stars 570 forks source link

Bug in train_stage_1.py, causing list out of range #162

Open fredkingdom opened 4 months ago

fredkingdom commented 4 months ago

In train_stage_1.py, line 167, the correct code should be sample_idx = [random.randint(0, dataset_len-1) for _ in range(2)] instead of sample_idx = [random.randint(0, dataset_len) for _ in range(2)], since if you happen to choose idx=dataset_len, it will be out of range.

Zejun-Yang commented 4 months ago

I'm not sure the specific situation. May be the max value of sampe_idx is len(dataset_len) - 1?

fredkingdom commented 4 months ago

May be the max value of sampe_idx is len(dataset_len) - 1?

Yes. Randint function chooses from [0, dataset_len], which includes idx==dataset_len, thus causing the problem.