From a6f5742a53f4567a39fec6eee97aa654c1282841 Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Tue, 7 Nov 2023 20:28:35 -0500 Subject: [PATCH] sort imports with isort (again) --- gguf-py/gguf/__init__.py | 2 +- gguf-py/gguf/constants.py | 2 +- gguf-py/gguf/gguf_reader.py | 6 +++--- gguf-py/gguf/gguf_writer.py | 7 ++++--- gguf-py/gguf/tensor_mapping.py | 2 ++ gguf-py/gguf/vocab.py | 1 + 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gguf-py/gguf/__init__.py b/gguf-py/gguf/__init__.py index dde602b8b..110ab342c 100644 --- a/gguf-py/gguf/__init__.py +++ b/gguf-py/gguf/__init__.py @@ -1,5 +1,5 @@ from .constants import * -from .gguf_writer import * from .gguf_reader import * +from .gguf_writer import * from .tensor_mapping import * from .vocab import * diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py index 7b39c3512..7a0f5c709 100644 --- a/gguf-py/gguf/constants.py +++ b/gguf-py/gguf/constants.py @@ -1,7 +1,7 @@ from __future__ import annotations import sys -from enum import Enum, IntEnum, auto, StrEnum +from enum import Enum, IntEnum, StrEnum, auto from typing import Any, NamedTuple, Type # diff --git a/gguf-py/gguf/gguf_reader.py b/gguf-py/gguf/gguf_reader.py index 84b889657..479fae2a3 100644 --- a/gguf-py/gguf/gguf_reader.py +++ b/gguf-py/gguf/gguf_reader.py @@ -2,7 +2,7 @@ from __future__ import annotations import os from collections import OrderedDict -from typing import Any, TypeVar, NamedTuple, Dict, Type, Literal +from typing import Any, Dict, Literal, NamedTuple, Type, TypeVar import numpy as np import numpy.typing as npt @@ -15,12 +15,12 @@ if __name__ == "__main__": sys.path.insert(0, str(Path(__file__).parent.parent)) from gguf.constants import ( + GGML_QUANT_SIZES, GGUF_DEFAULT_ALIGNMENT, GGUF_MAGIC, GGUF_VERSION, - GGML_QUANT_SIZES, GGMLQuantizationType, - GGUFValueType, + GGUFValueType ) READER_SUPPORTED_VERSIONS = [2, GGUF_VERSION] diff --git a/gguf-py/gguf/gguf_writer.py b/gguf-py/gguf/gguf_writer.py index 21362f844..bf7c4a7df 100644 --- a/gguf-py/gguf/gguf_writer.py +++ b/gguf-py/gguf/gguf_writer.py @@ -4,9 +4,9 @@ import os import shutil import struct import tempfile -from io import BufferedWriter from enum import Enum, auto -from typing import Any, IO, Sequence +from io import BufferedWriter +from typing import IO, Any, Sequence import numpy as np @@ -19,9 +19,10 @@ from .constants import ( GGUFEndian, GGUFValueType, RopeScalingType, - TokenType, + TokenType ) + class WriterState(Enum): EMPTY = auto() HEADER = auto() diff --git a/gguf-py/gguf/tensor_mapping.py b/gguf-py/gguf/tensor_mapping.py index d67c4cff1..55df1ba0f 100644 --- a/gguf-py/gguf/tensor_mapping.py +++ b/gguf-py/gguf/tensor_mapping.py @@ -1,8 +1,10 @@ from __future__ import annotations + from typing import Sequence from .constants import MODEL_ARCH, MODEL_TENSOR, MODEL_TENSORS, TENSOR_NAMES + class TensorNameMap: mappings_cfg: dict[MODEL_TENSOR, tuple[str, ...]] = { # Token embeddings diff --git a/gguf-py/gguf/vocab.py b/gguf-py/gguf/vocab.py index c11c2ab5d..92040199d 100644 --- a/gguf-py/gguf/vocab.py +++ b/gguf-py/gguf/vocab.py @@ -8,6 +8,7 @@ from typing import Any, Callable from .gguf_writer import GGUFWriter + class SpecialVocab: merges: list[str] special_token_ids: dict[str, int]