From 36360c62ac82ac857041e81093da90e436ad1745 Mon Sep 17 00:00:00 2001 From: Alexandre Sorokine Date: Mon, 12 Feb 2024 16:28:38 -0500 Subject: [PATCH] Update utils.py: switched from pkg_resources to importlib.resources for `filename` stored in the `os/environ(TIKTOKEN_CACHE_DIR)` --- litellm/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index ac26e08640..bbdb280cac 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -29,9 +29,11 @@ from dataclasses import ( dataclass, field, ) # for storing API inputs, outputs, and metadata -import pkg_resources +#import pkg_resources +from importlib import resources -filename = pkg_resources.resource_filename(__name__, "llms/tokenizers") +# filename = pkg_resources.resource_filename(__name__, "llms/tokenizers") +filename = str(resources.files().joinpath("llms/tokenizers")) os.environ[ "TIKTOKEN_CACHE_DIR" ] = filename # use local copy of tiktoken b/c of - https://github.com/BerriAI/litellm/issues/1071