FuNz-0 / PromptAD

Official implementation of CVPR 2024 PromptAD: Learning Prompts with Only Normal Samples for Few-Shot Anomaly Detection
The Unlicense
86 stars 4 forks source link

Execution error with run_cls.py #9

Open CaesarDingg opened 3 months ago

CaesarDingg commented 3 months ago

I executed the run_cls.py file according to the readme and encountered the following error (my env: win10 with rtx3060): Traceback (most recent call last): File "C:\Users\35314\Desktop\PromptAD\PromptAD\CLIPAD\model.py", line 236, in encode_text_embeddings x = x + self.positional_embedding.to(cast_dtype) RuntimeError: The size of tensor a (105) must match the size of tensor b (77) at non-singleton dimension 1

可能是显卡不支持?

FuNz-0 commented 3 months ago

你是不是修改了backbone 

------------------ Original ------------------ From: CaesarDingg @.> Date: Tue,Jun 11,2024 11:29 AM To: FuNz-0/PromptAD @.> Cc: Subscribed @.***> Subject: Re: [FuNz-0/PromptAD] Execution error with run_cls.py (Issue #9)

I executed the run_cls.py file according to the readme and encountered the following error (my env: win10 with rtx3060): Traceback (most recent call last): File "C:\Users\35314\Desktop\PromptAD\PromptAD\CLIPAD\model.py", line 236, in encode_text_embeddings x = x + self.positional_embedding.to(cast_dtype) RuntimeError: The size of tensor a (105) must match the size of tensor b (77) at non-singleton dimension 1

可能是显卡不支持?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

CaesarDingg commented 3 months ago

你是不是修改了backbone  ------------------ Original ------------------ From: CaesarDingg @.> Date: Tue,Jun 11,2024 11:29 AM To: FuNz-0/PromptAD @.> Cc: Subscribed @.> Subject: Re: [FuNz-0/PromptAD] Execution error with run_cls.py (Issue #9) I executed the run_cls.py file according to the readme and encountered the following error (my env: win10 with rtx3060): Traceback (most recent call last): File "C:\Users\35314\Desktop\PromptAD\PromptAD\CLIPAD\model.py", line 236, in encode_text_embeddings x = x + self.positional_embedding.to(cast_dtype) RuntimeError: The size of tensor a (105) must match the size of tensor b (77) at non-singleton dimension 1 可能是显卡不支持? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

没改,只尝试跑了visa

FuNz-0 commented 3 months ago

77的尺度应该是正常的你debug跟踪一下x看看是哪里的问题;

@.***

From: CaesarDingg Date: 2024-06-11 11:34 To: FuNz-0/PromptAD CC: FuNz; Comment Subject: Re: [FuNz-0/PromptAD] Execution error with run_cls.py (Issue #9) 你是不是修改了backbone … ------------------ Original ------------------ From: CaesarDingg @.> Date: Tue,Jun 11,2024 11:29 AM To: FuNz-0/PromptAD @.> Cc: Subscribed @.> Subject: Re: [FuNz-0/PromptAD] Execution error with run_cls.py (Issue #9) I executed the run_cls.py file according to the readme and encountered the following error (my env: win10 with rtx3060): Traceback (most recent call last): File "C:\Users\35314\Desktop\PromptAD\PromptAD\CLIPAD\model.py", line 236, in encode_text_embeddings x = x + self.positional_embedding.to(cast_dtype) RuntimeError: The size of tensor a (105) must match the size of tensor b (77) at non-singleton dimension 1 可能是显卡不支持? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.> 没改,只尝试跑了visa — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

WangFengJiee commented 3 months ago

Prompt 具体是这个Prompt是105

FuNz-0 commented 3 months ago

Prompt 具体是这个Prompt是105

image 这是我这边debug的结果,你看看你的问题在哪里

WangFengJiee commented 3 months ago

Prompt 具体是这个Prompt是105

image 这是我这边debug的结果,你看看你的问题在哪里

image # 问题貌似出在这里,源代码默认的是100,应该是1吧

CaesarDingg commented 3 months ago

Prompt 具体是这个Prompt是105

image 这是我这边debug的结果,你看看你的问题在哪里

image

问题貌似出在这里,源代码默认的是100,应该是1吧

跑通了,谢谢!

AlirezaSalehy commented 1 month ago

这里

And by changing the n_ctx_ab to 1 can you just reproduce the reported results on ViSA?