OFA-Sys / Chinese-CLIP

Chinese version of CLIP which achieves Chinese cross-modal retrieval and representation generation.
MIT License
4.21k stars 439 forks source link

train.py中sampler.set_epoch的判断不够严谨 #254

Closed ChesonHuang closed 5 months ago

ChesonHuang commented 6 months ago

在train.py第151-152行,代码是这样的: if sampler is not None: sampler.set_epoch(epoch)

当我自定义main入口函数,想用RandomSampler采样时,就会报:RandomSampler没有set_epoch的方法 只有分布式采样时,才会有set_epoch方法,所以,更严谨的方法是: if sampler is not None and isinstance(sampler, DistributedSampler): sampler.set_epoch(epoch)