You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, The following problem occurred when i try to run python case.
Could you help me check it? thank you.
I have installed tiktoken package.
Here is my Python code. import tiktoken enc = tiktoken.get_encoding("cl100k_base") assert enc.decode(enc.encode("hello world")) == "hello world" enc = tiktoken.encoding_for_model("gpt-4")
When I run it, console report an error as follows: Traceback (most recent call last): File "/PycharmProjects/pythonProjectStudy/tokencount/tiktoken.py", line 1, in <module> import tiktoken File "/PycharmProjects/pythonProjectStudy/tokencount/tiktoken.py", line 2, in <module> enc = tiktoken.get_encoding("cl100k_base") AttributeError: partially initialized module 'tiktoken' has no attribute 'get_encoding' (most likely due to a circular import)
Thank you.
The text was updated successfully, but these errors were encountered:
This is a general Python error, I can see the Python file you created is named "tiktoken.py".
I would recommend you rename it with something else rather than using the same library name.
For example rename "tiktoken.py" as "tiktoken_test.py".
Hi, The following problem occurred when i try to run python case.
Could you help me check it? thank you.
I have installed tiktoken package.
Here is my Python code.
import tiktoken
enc = tiktoken.get_encoding("cl100k_base")
assert enc.decode(enc.encode("hello world")) == "hello world"
enc = tiktoken.encoding_for_model("gpt-4")
When I run it, console report an error as follows:
Traceback (most recent call last):
File "/PycharmProjects/pythonProjectStudy/tokencount/tiktoken.py", line 1, in <module>
import tiktoken
File "/PycharmProjects/pythonProjectStudy/tokencount/tiktoken.py", line 2, in <module>
enc = tiktoken.get_encoding("cl100k_base")
AttributeError: partially initialized module 'tiktoken' has no attribute 'get_encoding' (most likely due to a circular import)
Thank you.
The text was updated successfully, but these errors were encountered: