AniPortrait
AniPortrait copied to clipboard
Bug in train_stage_1.py, causing list out of range
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.
I'm not sure the specific situation. May be the max value of sampe_idx is len(dataset_len) - 1?
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.