【Training Error】 IndexError: list index out of range
Traceback (most recent call last): | 0/1 [00:00<?, ?it/s]
File "audio2video/AniPortrait/train_stage_1.py", line 762, in
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.
Seems the length of self.data_dic_name_list is abnormal. Please check if your dataset json file is correct.
@JunZhan2000 Hi, I also encountered the same problem as you. Have you solved your problem?
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.