为 _TruncatedDataLoader 添加 __setattr__

This commit is contained in:
YWMditto 2022-08-08 19:35:04 +08:00
parent c11c30a5fc
commit d7ce92975c

View File

@ -132,6 +132,10 @@ class _TruncatedDataLoader:
def __getattr__(self, item):
return getattr(self.dataloader, item)
def __setattr__(self, key, value):
# 添加该函数使得在进行实验性训练或者评测时,用户对于 trainer.dataloader 的感觉和正常训练完全一样;
setattr(self.dataloader, key, value)
def check_evaluate_every(evaluate_every):
r"""