mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
python: don't use importlib as_file for a directory
The only reason to use as_file is to support copying a file from a frozen package. We don't currently support this anyway, and as_file isn't supported until Python 3.9, so get rid of it. Fixes #1605
This commit is contained in:
parent
1df3da0a88
commit
778264fbab
@ -1,4 +1,3 @@
|
|||||||
import atexit
|
|
||||||
import ctypes
|
import ctypes
|
||||||
import importlib.resources
|
import importlib.resources
|
||||||
import logging
|
import logging
|
||||||
@ -8,20 +7,14 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from contextlib import ExitStack
|
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Callable, Iterable, List
|
from typing import Callable, Iterable, List
|
||||||
|
|
||||||
logger: logging.Logger = logging.getLogger(__name__)
|
logger: logging.Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
file_manager = ExitStack()
|
|
||||||
atexit.register(file_manager.close) # clean up files on exit
|
|
||||||
|
|
||||||
# TODO: provide a config file to make this more robust
|
# TODO: provide a config file to make this more robust
|
||||||
MODEL_LIB_PATH = file_manager.enter_context(importlib.resources.as_file(
|
MODEL_LIB_PATH = importlib.resources.files("gpt4all") / "llmodel_DO_NOT_MODIFY" / "build"
|
||||||
importlib.resources.files("gpt4all") / "llmodel_DO_NOT_MODIFY" / "build",
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
def load_llmodel_library():
|
def load_llmodel_library():
|
||||||
|
Loading…
Reference in New Issue
Block a user