Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最后一个epoch验证不完,以及shape问题 #9261

Open
3 tasks done
sdreamforchen opened this issue Jan 2, 2025 · 0 comments
Open
3 tasks done

最后一个epoch验证不完,以及shape问题 #9261

sdreamforchen opened this issue Jan 2, 2025 · 0 comments
Assignees

Comments

@sdreamforchen
Copy link

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

您好
1 在训练RT-DETR的时候,老是最后的eval,只eval到1000就不动了,每次都需要手动eval 最后的权重,有点麻烦。
2 在rtdetr_transformer.py里面使用x=self.lamda * F.softmax(x) + (1 - self.lamda) * F.sigmoid(x),在169行和170行的attention_weights = F.sigmoid(attention_weights).reshape([bs, Len_q, self.num_heads, self.num_levels, self.num_points])会报 shape错误。完整代码是
class Act(nn.Layer):
def init(self, step=30000, r0=1.0):
super(Act, self).init()
self.iter = step+1
self.total_step=step
self.r0 = r0

    self.lamda = paddle.full([1],1,"float32")
    
def forward(self, x):
    
    if self.training:
        
        if self.iter > 0:
            self.iter=self.iter - 1
        #    a = self.iter
        
        
        #print(self.iter)
        
        x1 = F.softmax(x)
        x2 = F.sigmoid(x)
                                 
        if self.iter<=self.total_step:
            self.lamda = paddle.to_tensor(self.r0*self.iter/self.total_step)
        else:
            self.lamda = paddle.to_tensor(self.r0)
        x = paddle.to_tensor(self.lamda * x1 + (1 - self.lamda) * x2)
    else:
        #x = self.norm2(x)
        if self.iter==0:
            x = paddle.to_tensor(F.sigmoid(x))
        else:
            x = paddle.to_tensor(self.lamda * F.softmax(x) + (1 - self.lamda) * F.sigmoid(x))
    #mm=self.lamda
    return x

class PPMSDeformableAttention(MSDeformableAttention):
........
attention_weights = Act(attention_weights).reshape([bs, Len_q, self.num_heads, self.num_levels, self.num_points])
.......

复现环境 Environment

最新版

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants