IMLHF / SE_DCUNet

Deep Complex UNet for speech enhancement, init from "https://github.com/chanil1218/DCUnet.pytorch"
13 stars 2 forks source link

complexbatchnormal存在内存升高的问题 #3

Closed hidehowever1 closed 3 years ago

hidehowever1 commented 3 years ago

您好,我跑了这个代码发现在使用你写的complexbatchnormal时内存消耗一直在升高,不知道你有没有这样的问题,以及这个问题该如何解决,谢谢

IMLHF commented 3 years ago

dataloader的worker数量设置为0,或者升级pytorch

IMLHF commented 3 years ago

https://github.com/pytorch/pytorch/issues/13246

hidehowever1 commented 3 years ago

我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理

------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3)

dataloader的worker数量设置为0,或者升级pytorch

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

IMLHF commented 3 years ago

我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理 ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) dataloader的worker数量设置为0,或者升级pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

你这内存占用必然会上升啊,每次register_buffer都会写到内存里。除非debug,否则把这个关掉

hidehowever1 commented 3 years ago

那我训练测试的时候可以把track_running_stats设为false吗,还是训练的时候就必然存在这个内存升高的问题

------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:33 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3)

我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) dataloader的worker数量设置为0,或者升级pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

你这内存占用必然会上升啊,每次register_buffer都会写到内存里。除非debug,否则把这个关掉

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

IMLHF commented 3 years ago

那我训练测试的时候可以把track_running_stats设为false吗,还是训练的时候就必然存在这个内存升高的问题 ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:33 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) 我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) dataloader的worker数量设置为0,或者升级pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. 你这内存占用必然会上升啊,每次register_buffer都会写到内存里。除非debug,否则把这个关掉 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

训练和测试都不需要track_running_stats

hidehowever1 commented 3 years ago

好的,多谢解答

------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:51 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3)

那我训练测试的时候可以把track_running_stats设为false吗,还是训练的时候就必然存在这个内存升高的问题 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:33 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) 我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) dataloader的worker数量设置为0,或者升级pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. 你这内存占用必然会上升啊,每次register_buffer都会写到内存里。除非debug,否则把这个关掉 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

训练和测试都不需要track_running_stats

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

RuqiaoLiu commented 2 years ago

好的,多谢解答 ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:51 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) 那我训练测试的时候可以把track_running_stats设为false吗,还是训练的时候就必然存在这个内存升高的问题 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 下午2:33 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) 我试过num_worker设为0,但内存还是上升, if self.track_running_stats: self.register_buffer('RMr', torch.zeros(num_features)) self.register_buffer('RMi', torch.zeros(num_features)) self.register_buffer('RVrr', torch.ones (num_features)) self.register_buffer('RVri', torch.zeros(num_features)) self.register_buffer('RVii', torch.ones (num_features)) self.register_buffer('num_batches_tracked', torch.tensor(0, dtype=torch.long))这段代码,只要我把track_running_stats设为false,内存就不会上升,所以我觉得这边register_buffer导致内存的上升,但我不懂具体的原理 … ------------------ 原始邮件 ------------------ 发件人: "IMLHF/SE_DCUNet" @.>; 发送时间: 2021年4月21日(星期三) 中午1:59 @.>; @.>;"State @.>; 主题: Re: [IMLHF/SE_DCUNet] complexbatchnormal存在内存升高的问题 (#3) dataloader的worker数量设置为0,或者升级pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. 你这内存占用必然会上升啊,每次register_buffer都会写到内存里。除非debug,否则把这个关掉 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. 训练和测试都不需要track_running_stats — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

您好,我也发现了track_running_stats=True会出现内存占用上升问题,但是训练和测试都不需要track_running_stats不会出问题吗?因为pytorch官方文档中的BatchNorm中track_running_stats默认为True。