Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the val dataset sampler from sequential to deterministically shuffled #29

Merged
merged 1 commit into from
Dec 11, 2022

Conversation

yangapku
Copy link
Member

@yangapku yangapku commented Dec 11, 2022

改动前的代码,在模型finetune时,对于验证集使用分布式顺序读取的样本sampler(训练集则使用shuffle的分布式样本sampler)。如果验证集中,图文对原始标注存在一条文本对应多个图片(如MUGE),在卡数较少的情况下(如单卡或两卡),容易出现验证时一张GPU上的local batch内几个图文对样本的文本相同的情况。现在我们训练中计算的验证集inbatch accuracy,是最简单的以样本自身的图文作为ground truth的机制,不能正确处理local batch里面,文对图一对多的这种情况,会导致其验证集inbatch accuracy呈现结果偏低(参见issue #28 )。但是模型本身的训练和收敛不受任何影响,也完全不影响最终模型的Recall效果指标,只是finetune过程中打印的inbatch accuracy结果偏低。 因此,我们将验证集也按照固定的随机种子进行shuffle,规避掉这种特殊情况,从而能使inbatch accuracy正确反映模型的训练趋势。

Copy link
Member Author

@yangapku yangapku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

@yangapku yangapku self-assigned this Dec 11, 2022
Copy link
Member Author

@yangapku yangapku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

@yangapku yangapku merged commit 1924b1b into master Dec 11, 2022
@yangapku yangapku deleted the dev_modify_val_sampler branch December 11, 2022 13:04
@yangapku yangapku mentioned this pull request Dec 11, 2022
@yangapku yangapku changed the title change the val dataset sampler from sequential to determisticly shuffled change the val dataset sampler from sequential to deterministically shuffled Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant