WenbinLee / CovaMNet

The Pytorch code of "Distribution Consistency based Covariance Metric Networks for Few-shot Learning", AAAI 2019.
Other
56 stars 10 forks source link

AttributeError: 'torch.dtype' object has no attribute 'type' #1

Closed yangfeifei02 closed 4 years ago

yangfeifei02 commented 5 years ago

Hello, when I tested, I encountered the following problem。

Traceback (most recent call last): File "D:/yy/2019.3-/code/CovaMNet-master/CovaMNet_Test_5way1shot.py", line 293, in test_accuracy, h = mean_confidence_interval(accuracies) File "D:/yy/2019.3-/code/CovaMNet-master/CovaMNet_Test_5way1shot.py", line 246, in mean_confidence_interval m, se = np.mean(a), scipy.stats.sem(a) File "D:\Program\Anaconda3\envs\env_name\lib\site-packages\numpy\core\fromnumeric.py", line 3118, in mean out=out, **kwargs) File "D:\Program\Anaconda3\envs\env_name\lib\site-packages\numpy\core_methods.py", line 85, in _mean ret = ret.dtype.type(ret / rcount) AttributeError: 'torch.dtype' object has no attribute 'type'

I tried to make some changes, replacing np.mean(a) with torch.mean(torch.stack(a)), but there are still other problems.

I will be great appreciate that if you can tell me how to solve this problem.

WenbinLee commented 5 years ago

Hi, this may be caused by the different versions of Pytorch. I have modified the function mean_confidence_interval. Can you try this new test file? If you have any problem, please let me know.

yangfeifei02 commented 5 years ago

你好,我刚才尝试测试了一下,然后现在没有那个问题,如果有其他问题的话,我在给你发邮件。 还有另外一个问题是在训练阶段设置的num_workers参数,你设置的是8,但是我训练的时候必须将参数设置为0,这样的话训练时间会变得很长,但是如果不修改的话,就会出现BrokenPipeError:[Errno 32]Broken pipe,请问你还有其他解决方法吗?谢谢你能及时的给我回复。

------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年6月5日(星期三) 晚上9:54 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Author"author@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

Hi, this may be caused by the different versions of Pytorch. I have modified the function mean_confidence_interval. Can you try this new test file? If you have any problem, please let me know.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

是的,不好意思,这个问题的原因在于一次性采样了300000个episodes,所以导致系统open files过多,我近期会重新修改一下,如果你着急,可以参考我github主页CVPR19的代码把代码修改成epoch模式,问题应该就解决了。

yangfeifei02 commented 5 years ago

嗯,好的,我明天去先看一下,谢谢

------------------ Original ------------------ From: WenbinLee notifications@github.com Date: Wed,Jun 5,2019 10:23 PM To: WenbinLee/CovaMNet CovaMNet@noreply.github.com Cc: yangfeifei02 1156483469@qq.com, Comment comment@noreply.github.com Subject: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has no attribute 'type' (#1)

是的,不好意思,这个问题的原因在于一次性采样了300000个episodes,所以导致系统open files过多,我近期会重新修改一下,如果你着急,可以参考我github主页CVPR19的代码把代码修改成epoch模式,问题应该就解决了。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

不客气呢

WenbinLee commented 5 years ago

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

yangfeifei02 commented 5 years ago

你好,修改之后的代码还是会出现这个问题,BrokenPipeError: [Errno 32] Broken pipe 还有一个问题是测试时的准确率很低,是我复现时有什么问题吗?

------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年6月6日(星期四) 上午8:50 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

请问你用的Pytorch 版本是?

On 06/05/2019 22:23, yangfeifei02 wrote: 你好,修改之后的代码还是会出现这个问题,BrokenPipeError: [Errno 32] Broken pipe

还有一个问题是测试时的准确率很低,是我复现时有什么问题吗?

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午8:50

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561", "url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

yangfeifei02 commented 5 years ago

torch 1.1.0

------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年6月6日(星期四) 上午10:27 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

请问你用的Pytorch 版本是?

On 06/05/2019 22:23, yangfeifei02 wrote: 你好,修改之后的代码还是会出现这个问题,BrokenPipeError: [Errno 32] Broken pipe

还有一个问题是测试时的准确率很低,是我复现时有什么问题吗?

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午8:50

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561", "url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

我今天只在Pytorch0.4 上简单测试了一下,新版本上还没有测试

On 06/05/2019 22:29, yangfeifei02 wrote: torch 1.1.0

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午10:27

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

请问你用的Pytorch 版本是?

On 06/05/2019 22:23, yangfeifei02 wrote: 你好,修改之后的代码还是会出现这个问题,BrokenPipeError: [Errno 32] Broken pipe

还有一个问题是测试时的准确率很低,是我复现时有什么问题吗?

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午8:50

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

[

{

"@context": "http://schema.org",

"@type": "EmailMessage",

"potentialAction": {

"@type": "ViewAction",

"target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561",

"url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561",

"name": "View Issue"

},

"description": "View this Issue on GitHub",

"publisher": {

"@type": "Organization",

"name": "GitHub",

"url": "https://github.com"

}

}

]

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHF77HTKE6H7DRABCVDPZBZCDA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBROBI#issuecomment-499324677", "url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHF77HTKE6H7DRABCVDPZBZCDA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBROBI#issuecomment-499324677", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

yangfeifei02 commented 5 years ago

嗯,好的,这个是因为pytorch的版本的关系吗?

------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年6月6日(星期四) 上午10:41 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

我今天只在Pytorch0.4 上简单测试了一下,新版本上还没有测试

On 06/05/2019 22:29, yangfeifei02 wrote: torch 1.1.0

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午10:27

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

请问你用的Pytorch 版本是?

On 06/05/2019 22:23, yangfeifei02 wrote: 你好,修改之后的代码还是会出现这个问题,BrokenPipeError: [Errno 32] Broken pipe

还有一个问题是测试时的准确率很低,是我复现时有什么问题吗?

------------------ 原始邮件 ------------------

发件人: "WenbinLee"notifications@github.com;

发送时间: 2019年6月6日(星期四) 上午8:50

收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com;

抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com;

主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

[

{

"@context": "http://schema.org",

"@type": "EmailMessage",

"potentialAction": {

"@type": "ViewAction",

"target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561",

"url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHAXMJK2MVIOMDKG3TLPZBYJRA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBRFKI#issuecomment-499323561",

"name": "View Issue"

},

"description": "View this Issue on GitHub",

"publisher": {

"@type": "Organization",

"name": "GitHub",

"url": "https://github.com"

}

}

]

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHF77HTKE6H7DRABCVDPZBZCDA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBROBI#issuecomment-499324677", "url": "https://github.com/WenbinLee/CovaMNet/issues/1?email_source=notifications\u0026email_token=AE3GGHF77HTKE6H7DRABCVDPZBZCDA5CNFSM4HTW2VWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBROBI#issuecomment-499324677", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

我暂时还不太清楚,我之前没遇到过这个错误,我这两天会系统的测试一下,包括在新版本下,然后再告诉你可行

yangfeifei02 commented 5 years ago

好的,谢谢

------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年6月6日(星期四) 中午11:08 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

我暂时还不太清楚,我之前没遇到过这个错误,我这两天会系统的测试一下,包括在新版本下,然后再告诉你可行

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

你好,不好意思,现在才回复,先问一下之前的问题还存在么,我在其实版本的pytorch的版本上进行了测试,好像没什么问题,我又重新更新了一下代码。请问一下你用的是windows系统么 https://discuss.pytorch.org/t/brokenpipeerror-errno-32-broken-pipe-on-windows-and-cuda-10/35894

yangfeifei02 commented 5 years ago

嗯,存在,是win10+cuda92+pytorch 1.1.0 ------------------ 原始邮件 ------------------ 发件人: "WenbinLee"notifications@github.com; 发送时间: 2019年7月3日(星期三) 晚上7:24 收件人: "WenbinLee/CovaMNet"CovaMNet@noreply.github.com; 抄送: "杨莹"1156483469@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [WenbinLee/CovaMNet] AttributeError: 'torch.dtype' object has noattribute 'type' (#1)

你好,不好意思,现在才回复,先问一下之前的问题还存在么,我在其实版本的pytorch的版本上进行了测试,好像没什么问题,我又重新更新了一下代码。请问一下你用的是windows系统么 https://discuss.pytorch.org/t/brokenpipeerror-errno-32-broken-pipe-on-windows-and-cuda-10/35894

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

WenbinLee commented 5 years ago

你看一下这个链接呢,我查了一下好像是系统的问题,如果linux系统应该是没问题的,我在ubuntu下做了很多测试,应该是没问题的