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

[requires_grad]在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad' #201

Open
masterandmiku opened this issue Apr 30, 2024 · 0 comments

Comments

@masterandmiku
Copy link

打扰了,这里是在本地部署CHATRWKV时在运行python chat.py时遇到的问题:

Traceback (most recent call last):
File "chat.py", line 218, in
model = RWKV_RNN(args)
File "D:\尼诺尔AI\src\model_run.py", line 48, in init
w[x].requires_grad = False
AttributeError: 'str' object has no attribute 'requires_grad'
个人在代码方面比较小白,更倾向于这个错误属于字符串类型的变量赋值给了需要求梯度的变量,需要将需要求梯度的变量定义为合适的类型(如 tensor),或者将字符串转换为需要的类型,我检查chat.py这段代码,觉得可能是由于args里的str类型被算入model_run.py其中,但我想这段代码应该是必须保留下来的,我在网上搜索时似乎发现没有人遇到这个问题,除了这两段,我不知道是args哪个地方出了纰漏让其中的str类型囊括于此,更不知如何修改:

args.RUN_DEVICE = "cpu"
args.FLOAT_MODE = "fp32"
至于其他的args的问题,我个人似乎看不出问题所在。

args.vocab_size = 50277
args.head_qk = 0
args.pre_ffn = 0
args.grad_cp = 0
args.my_pos_emb = 0
MODEL_NAME = args.MODEL_NAME

希望如果有其他人在探究本地部署CHATRWKV的时候能与我一起交谈下这个问题出自于哪里,麻烦了,多谢。

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