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

Python type hint cannot work: A: list[int]=[] when run chat_with_bot.py #53

Closed
Oshibuki opened this issue May 7, 2023 · 3 comments · Fixed by #75
Closed

Python type hint cannot work: A: list[int]=[] when run chat_with_bot.py #53

Oshibuki opened this issue May 7, 2023 · 3 comments · Fixed by #75

Comments

@Oshibuki
Copy link

Oshibuki commented May 7, 2023

Should I add some code like below?

from typing import List
A: List[int]=[]

Error

Traceback (most recent call last):
    processed_tokens: list[int] = []
TypeError: 'type' object is not subscriptable
Exception ignored in: <function RWKVModel.__del__ at 0x000001DEFD5F7D30>

environment:

  • win10
  • Anaconda3
  • python 3.8.8
@stoneAoxiang
Copy link

怎么解决的呢兄弟? 我也遇到这个问题了

@Oshibuki
Copy link
Author

Oshibuki commented May 9, 2023

怎么解决的呢兄弟? 我也遇到这个问题了

看来是用了不支持的type hint语法。就改成

from typing import List
from typing import Dict
……: List[int]=……
……: Dict[int]=……

@stoneAoxiang
Copy link

谢谢兄弟 我直接改成不指定类型的了

@saharNooby saharNooby linked a pull request May 27, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants