zyw-stu / CPA-Enhancer

This is the official repository of the paper: CPA-Enhancer: Chain-of-Thought Prompted Adaptive Enhancer for Object Detection under Unknown Degradations
Apache License 2.0
40 stars 1 forks source link

作者你好,将CPA_enhance模块应用在我的项目时出现张量所在设备不匹配问题,有没有可能的解决方法,非常感谢您的工作。 #2

Open wangdalu4399 opened 7 months ago

wangdalu4399 commented 7 months ago

x4_prompt = self.prompt3(x4, prompt_param3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Faker-Lost commented 7 months ago

x4_prompt = self.prompt3(x4, prompt_param3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

您好,您解决了么

zyw-stu commented 6 months ago
self.transformer_block = nn.Sequential(*[
            TransformerBlock(dim=dim // num_splits, num_heads=1, ffn_expansion_factor=2.66, bias=False,
                             LayerNorm_type='WithBias') for _ in range(num_splits)])

添加nn.Sequential(*)