PromptAD
PromptAD copied to clipboard
script run_cls.py has error
Hi, Thanks for sharing your code. I get an issue when I run the run_cls.py script. Here is the error:
File "/home/alexandre/projects/PromptAD/train_cls.py", line 257, in <module>
main(args)
File "/home/alexandre/projects/PromptAD/train_cls.py", line 189, in main
metrics = fit(model, args, test_dataloader, device, check_path=check_path, train_data=train_dataloader)
File "/home/alexandre/projects/PromptAD/train_cls.py", line 76, in fit
abnormal_text_features_learned = model.encode_text_embedding(abnormal_text_prompt_learned, model.tokenized_abnormal_prompts_learned)
File "/home/alexandre/projects/PromptAD/PromptAD/model.py", line 252, in encode_text_embedding
text_features = self.model.encode_text_embeddings(text_embedding, original_tokens)
File "/home/alexandre/projects/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
I followed the procedure that is proposed in the readme. How can I solve the problem ? thanks in advance
ps: run_seg.py seems working like a charm
please see: https://github.com/FuNz-0/PromptAD/issues/9