【研0日记】24.01.05

今天,终于, 结束了本科生涯全部课程

考了个python,真jb无语考了个__sub__,拿来计算两个类相减,我真没想到考这个,今天是我第一次听说这个魔法方法

def __sub__(self, other): 

        return (self.x - other.x, self.y - other.y)

实际可以这样来写,但是我觉得这个玩意没什么必要,实际一个类里面肯定有很多参数,肯定还是定义一个方法更好,感觉更灵活and强大


然后今天居然发现!!!!几次预训练用的伪标注居然不一样,给我吓的,然后换成一样的重新跑一下,坐等结果

还有一个有意思的报错:

RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by (1) passing the keyword argument find_unused_parameters=True to torch.nn.parallel.DistributedDataParallel; (2) making sure all forward function outputs participate in calculating loss. If you already have done the above two steps, then the distributed data parallel module wasn’t able to locate the output tensors in the return value of your module’s forward function. Please include the loss function and the structure of the return value of forward of your module when reporting this issue (e.g. list, dict, iterable).

就是说有模块/参数没有被用来计算损失,好像据说是,要确保你的所有的forward的函数的所有输出都被用于计算损失函数了,或者说所有的模块的经过forward输出都要用来计算loss

然后我这里的问题就是,定义了一个线性层,但是没用上,又没删掉,删掉应该就好了(maybe)


好想打麻将

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值