Skip to content

most likely due to a circular import #106

@minkai95

Description

@minkai95

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions