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

运行脚本train_cls.py报错,AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute '__getitem__' #276

Open
ShaunZhang7 opened this issue Dec 21, 2023 · 0 comments

Comments

@ShaunZhang7
Copy link

您好,非常感谢您查阅此问题。
我的问题是在运行脚本python train_cls.py --epochs 200 --lr 5e-4 --dataset cls_davis时打印:

(moltrans) D:\PaddleHelix-dev\apps\drug_target_interaction\moltrans_dti>python train_cls.py --batchsize 64 --epochs 200 --lr 5e-4 --dataset cls_davis
Traceback (most recent call last):
File "train_cls.py", line 18, in
from helper import utils
File "D:\PaddleHelix-dev\apps\drug_target_interaction\moltrans_dti\helper\utils_init_.py", line 23, in
from .paddle_varbase import *
File "D:\PaddleHelix-dev\apps\drug_target_interaction\moltrans_dti\helper\utils\paddle_varbase.py", line 21, in
VarBase.tmp = VarBase.getitem
AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute 'getitem'

提示:属性/方法错误:没有方法'getitem'
之前以为是版本导致的API问题,但后面查询这个错误通常表示正在尝试访问None对象中不存在的属性或方法,它通常与使用函数中的None值作为返回值有关,而不是返回正确的值。
但是代码里这个方法报错的地方我不太确定为什么会出错:
VarBase.tmp = VarBase.getitem
包括下面的:
VarBase.setitem_tmp = VarBase.setitem

本人水平有限,如果您知道为什么出错以及怎么解决此类问题的话希望能不吝赐教,非常期待得到您的回复,此致感谢!

联系邮箱:1090257784@qq.com

@ShaunZhang7 ShaunZhang7 changed the title 运行脚本python train_cls.py报错,AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute '__getitem__' 运行脚本train_cls.py报错,AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute '__getitem__' Dec 21, 2023
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

1 participant