mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix for importllib compatibility issue for python 3.8
was tested for python versions 3.8, 3.9, 3.10, 3.11, 3.12
This commit is contained in:
parent
73ecc706e6
commit
4b5d537dcd
1 changed files with 9 additions and 8 deletions
|
@ -31,16 +31,17 @@ from dataclasses import (
|
|||
field,
|
||||
) # for storing API inputs, outputs, and metadata
|
||||
|
||||
# import pkg_resources
|
||||
from importlib import resources
|
||||
|
||||
# filename = pkg_resources.resource_filename(__name__, "llms/tokenizers")
|
||||
|
||||
try:
|
||||
filename = str(
|
||||
resources.files().joinpath("llms/tokenizers") # type: ignore
|
||||
) # for python 3.8 and 3.12
|
||||
# this works in python 3.8
|
||||
import pkg_resources
|
||||
filename = pkg_resources.resource_filename(__name__, "llms/tokenizers")
|
||||
# try:
|
||||
# filename = str(
|
||||
# resources.files().joinpath("llms/tokenizers") # type: ignore
|
||||
# ) # for python 3.8 and 3.12
|
||||
except:
|
||||
# this works in python 3.9+
|
||||
from importlib import resources
|
||||
filename = str(
|
||||
resources.files(litellm).joinpath("llms/tokenizers") # for python 3.10
|
||||
) # for python 3.10+
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue