AniPortrait icon indicating copy to clipboard operation
AniPortrait copied to clipboard

【Training Error】 IndexError: list index out of range

Open JunZhan2000 opened this issue 1 year ago • 3 comments

Traceback (most recent call last): | 0/1 [00:00<?, ?it/s] File "audio2video/AniPortrait/train_stage_1.py", line 762, in main(config)
File "audio2video/AniPortrait/train_stage_1.py", line 654, in main sample_dicts = log_validation(
File "audio2video/AniPortrait/train_stage_1.py", line 169, in log_validation sample = valid_dataset[idx]
File "audio2video/AniPortrait/src/dataset/dataset_face.py", line 157, in getitem ref_img, pixel_values_pose, tar_gt, pixel_values_ref_pose = self.get_batch_wo_pose(idx)
File "AniPortrait/src/dataset/dataset_face.py", line 90, in get_batch_wo_pose
video_name = self.data_dic_name_list[index] IndexError: list index out of range

Occasionally occurs during training, seems to be related to the size of the data.

JunZhan2000 avatar Apr 11 '24 01:04 JunZhan2000

Seems the length of self.data_dic_name_list is abnormal. Please check if your dataset json file is correct.

Zejun-Yang avatar Apr 15 '24 02:04 Zejun-Yang

@JunZhan2000 Hi, I also encountered the same problem as you. Have you solved your problem?

Mxwgreat avatar May 09 '24 01:05 Mxwgreat

https://github.com/Zejun-Yang/AniPortrait/blob/cb86caa741d6ab1e119ea7ac2554eb28aabc631b/train_stage_1.py#L166-L169 @Mxwgreat random.randint(0, dataset_len) can generate random integer including dataset_len, and dataset_len will cause index out of range error because the index range for valid_dataset is 0~dataset_len-1 and you can simply change it into random.randint(0, dataset_len-1)

@JunZhan2000 You can update the code to fix this error.

Vincent-luo avatar Jun 06 '24 07:06 Vincent-luo