Just add local gguf to path unless environ forbids it
This commit is contained in:
parent
31fc2bdebe
commit
459d3e799d
5 changed files with 10 additions and 15 deletions
|
@ -15,9 +15,8 @@ import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from transformers import AutoTokenizer # type: ignore[import]
|
from transformers import AutoTokenizer # type: ignore[import]
|
||||||
|
|
||||||
# Use local gguf module if available.
|
if 'NO_LOCAL_GGUF' not in os.environ:
|
||||||
if 'NO_LOCAL_GGUF' not in os.environ and Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf', '__init__.py').is_file():
|
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py' / 'gguf'))
|
||||||
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf')))
|
|
||||||
import gguf
|
import gguf
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,8 @@ import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from transformers import AutoTokenizer # type: ignore[import]
|
from transformers import AutoTokenizer # type: ignore[import]
|
||||||
|
|
||||||
# Use local gguf module if available.
|
if 'NO_LOCAL_GGUF' not in os.environ:
|
||||||
if 'NO_LOCAL_GGUF' not in os.environ and Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf', '__init__.py').is_file():
|
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py' / 'gguf'))
|
||||||
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf')))
|
|
||||||
import gguf
|
import gguf
|
||||||
|
|
||||||
# ref: https://github.com/openai/gpt-2/blob/master/src/encoder.py
|
# ref: https://github.com/openai/gpt-2/blob/master/src/encoder.py
|
||||||
|
|
|
@ -10,9 +10,8 @@ from pathlib import Path
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import os
|
import os
|
||||||
# Use local gguf module if available.
|
if 'NO_LOCAL_GGUF' not in os.environ:
|
||||||
if 'NO_LOCAL_GGUF' not in os.environ and Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf', '__init__.py').is_file():
|
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py' / 'gguf'))
|
||||||
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf')))
|
|
||||||
import gguf
|
import gguf
|
||||||
|
|
||||||
# Note: Does not support GGML_QKK_64
|
# Note: Does not support GGML_QKK_64
|
||||||
|
|
|
@ -29,9 +29,8 @@ import numpy as np
|
||||||
from sentencepiece import SentencePieceProcessor # type: ignore[import]
|
from sentencepiece import SentencePieceProcessor # type: ignore[import]
|
||||||
|
|
||||||
import os
|
import os
|
||||||
# Use local gguf module if available.
|
if 'NO_LOCAL_GGUF' not in os.environ:
|
||||||
if 'NO_LOCAL_GGUF' not in os.environ and Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf', '__init__.py').is_file():
|
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py' / 'gguf'))
|
||||||
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf')))
|
|
||||||
import gguf
|
import gguf
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -8,9 +8,8 @@ import sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Use local gguf module if available.
|
if 'NO_LOCAL_GGUF' not in os.environ:
|
||||||
if 'NO_LOCAL_GGUF' not in os.environ and Path(__file__).parent.absolute().joinpath('..', '..', 'gguf-py', 'gguf', '__init__.py').is_file():
|
sys.path.insert(1, str(Path(__file__).parent / '..' / '..' / 'gguf-py' / 'gguf'))
|
||||||
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('..', '..', 'gguf-py', 'gguf')))
|
|
||||||
import gguf
|
import gguf
|
||||||
|
|
||||||
# gguf constants
|
# gguf constants
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue