AniPortrait icon indicating copy to clipboard operation
AniPortrait copied to clipboard

Bug in train_stage_1.py, causing list out of range

Open nuo1wang opened this issue 1 year ago • 2 comments

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.

nuo1wang avatar May 22 '24 01:05 nuo1wang

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

Zejun-Yang avatar May 31 '24 03:05 Zejun-Yang

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.

nuo1wang avatar May 31 '24 10:05 nuo1wang