Skip to content

ValueError: tiktoken plugin tiktoken_ext.openai_public does not define ENCODING_CONSTRUCTORS #377

@renata-gotler

Description

@renata-gotler

Hi,

I was running the following code and it started to return error.

import tiktoken
tiktoken.get_encoding("o200k_base")

The error:
AttributeError: module 'tiktoken_ext.openai_public' has no attribute 'ENCODING_CONSTRUCTORS'

The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File , line 2
1 import tiktoken
----> 2 tiktoken.get_encoding("o200k_base")
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-38b8f866-2ee0-46b2-9e25-6778b2c2c9d7/lib/python3.11/site-packages/tiktoken/registry.py:75, in get_encoding(encoding_name)
72 return ENCODINGS[encoding_name]
74 if ENCODING_CONSTRUCTORS is None:
---> 75 _find_constructors()
76 assert ENCODING_CONSTRUCTORS is not None
78 if encoding_name not in ENCODING_CONSTRUCTORS:
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-38b8f866-2ee0-46b2-9e25-6778b2c2c9d7/lib/python3.11/site-packages/tiktoken/registry.py:46, in _find_constructors()
44 constructors = mod.ENCODING_CONSTRUCTORS
45 except AttributeError as e:
---> 46 raise ValueError(
47 f"tiktoken plugin {mod_name} does not define ENCODING_CONSTRUCTORS"
48 ) from e
49 for enc_name, constructor in constructors.items():
50 if enc_name in ENCODING_CONSTRUCTORS:

It is weird because around 1h30min ago it worked and now it is throwing this error. Can some help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions