diff --git a/.github/workflows/python-type-check.yml b/.github/workflows/python-type-check.yml index 2c62678726..dc7aebe24c 100644 --- a/.github/workflows/python-type-check.yml +++ b/.github/workflows/python-type-check.yml @@ -31,7 +31,7 @@ jobs: uses: actions/setup-python@v6 with: python-version: "3.11" - pip-install: -r requirements/requirements-all.txt ty==0.0.24 + pip-install: -r requirements/requirements-all.txt ty==0.0.26 # - name: Type-check with Pyright # uses: jakebailey/pyright-action@v2 # with: diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index bcf98cfae7..51f0d1ab15 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -31,10 +31,10 @@ import gguf from gguf.vocab import MistralTokenizerType, MistralVocab try: - from mistral_common.tokens.tokenizers.base import TokenizerVersion # type: ignore[import-not-found] - from mistral_common.tokens.tokenizers.multimodal import DATASET_MEAN as _MISTRAL_COMMON_DATASET_MEAN, DATASET_STD as _MISTRAL_COMMON_DATASET_STD # type: ignore[import-not-found] - from mistral_common.tokens.tokenizers.tekken import Tekkenizer # type: ignore[import-not-found] - from mistral_common.tokens.tokenizers.sentencepiece import ( # type: ignore[import-not-found] + from mistral_common.tokens.tokenizers.base import TokenizerVersion # type: ignore[import-not-found, ty:unresolved-import] + from mistral_common.tokens.tokenizers.multimodal import DATASET_MEAN as _MISTRAL_COMMON_DATASET_MEAN, DATASET_STD as _MISTRAL_COMMON_DATASET_STD # type: ignore[import-not-found, ty:unresolved-import] + from mistral_common.tokens.tokenizers.tekken import Tekkenizer # type: ignore[import-not-found, ty:unresolved-import] + from mistral_common.tokens.tokenizers.sentencepiece import ( # type: ignore[import-not-found, ty:unresolved-import] SentencePieceTokenizer, ) diff --git a/examples/model-conversion/scripts/causal/compare-logits.py b/examples/model-conversion/scripts/causal/compare-logits.py index 83bd14c659..181c048630 100755 --- a/examples/model-conversion/scripts/causal/compare-logits.py +++ b/examples/model-conversion/scripts/causal/compare-logits.py @@ -7,7 +7,7 @@ import os # Add utils directory to path for direct script execution sys.path.insert(0, str(Path(__file__).parent.parent / "utils")) -from common import get_model_name_from_env_path, compare_tokens, exit_with_warning # type: ignore[import-not-found] +from common import get_model_name_from_env_path, compare_tokens, exit_with_warning # type: ignore[import-not-found, ty:unresolved-import] def quick_logits_check(pytorch_file, llamacpp_file): """Lightweight sanity check before NMSE""" diff --git a/examples/model-conversion/scripts/utils/check-nmse.py b/examples/model-conversion/scripts/utils/check-nmse.py index 83f63f9ff3..324e3858e3 100755 --- a/examples/model-conversion/scripts/utils/check-nmse.py +++ b/examples/model-conversion/scripts/utils/check-nmse.py @@ -5,7 +5,7 @@ import sys import os import argparse from pathlib import Path -from common import get_model_name_from_env_path # type: ignore[import-not-found] +from common import get_model_name_from_env_path # type: ignore[import-not-found, ty:unresolved-import] def calculate_nmse(reference, test): mse = np.mean((test - reference) ** 2) diff --git a/examples/model-conversion/scripts/utils/compare_tokens.py b/examples/model-conversion/scripts/utils/compare_tokens.py index 62826ec7a6..55e3f26ab4 100755 --- a/examples/model-conversion/scripts/utils/compare_tokens.py +++ b/examples/model-conversion/scripts/utils/compare_tokens.py @@ -2,7 +2,7 @@ import argparse import sys -from common import compare_tokens # type: ignore[import-not-found] +from common import compare_tokens # type: ignore[import-not-found, ty:unresolved-import] def parse_arguments(): diff --git a/examples/model-conversion/scripts/utils/semantic_check.py b/examples/model-conversion/scripts/utils/semantic_check.py index 73e20ea489..db0d004dab 100644 --- a/examples/model-conversion/scripts/utils/semantic_check.py +++ b/examples/model-conversion/scripts/utils/semantic_check.py @@ -7,7 +7,7 @@ import importlib from pathlib import Path from transformers import AutoTokenizer, AutoConfig, AutoModelForCausalLM, AutoModel -from common import compare_tokens, exit_with_warning # type: ignore[import-not-found] +from common import compare_tokens, exit_with_warning # type: ignore[import-not-found, ty:unresolved-import] unreleased_model_name = os.getenv('UNRELEASED_MODEL_NAME') diff --git a/gguf-py/gguf/vocab.py b/gguf-py/gguf/vocab.py index e4ab5e1e4b..5cd729dfa8 100644 --- a/gguf-py/gguf/vocab.py +++ b/gguf-py/gguf/vocab.py @@ -14,12 +14,12 @@ except ImportError: SentencePieceProcessor: Any = None try: - from mistral_common.tokens.tokenizers.mistral import MistralTokenizer # type: ignore[import-not-found] - from mistral_common.tokens.tokenizers.tekken import Tekkenizer # type: ignore[import-not-found] - from mistral_common.tokens.tokenizers.utils import ( # type: ignore[import-not-found] + from mistral_common.tokens.tokenizers.mistral import MistralTokenizer # type: ignore[import-not-found, ty:unresolved-import] + from mistral_common.tokens.tokenizers.tekken import Tekkenizer # type: ignore[import-not-found, ty:unresolved-import] + from mistral_common.tokens.tokenizers.utils import ( # type: ignore[import-not-found, ty:unresolved-import] _filter_valid_tokenizer_files, ) - from mistral_common.tokens.tokenizers.sentencepiece import ( # type: ignore[import-not-found] + from mistral_common.tokens.tokenizers.sentencepiece import ( # type: ignore[import-not-found, ty:unresolved-import] SentencePieceTokenizer, ) except ImportError: @@ -32,7 +32,7 @@ else: _mistral_common_installed = True try: - from mistral_common.tokens.tokenizers.utils import ( # type: ignore[import-not-found] + from mistral_common.tokens.tokenizers.utils import ( # type: ignore[import-not-found, ty:unresolved-import] get_one_valid_tokenizer_file, ) except ImportError: diff --git a/scripts/gen-unicode-data.py b/scripts/gen-unicode-data.py index 2d9bde01c3..0fa78b22ec 100644 --- a/scripts/gen-unicode-data.py +++ b/scripts/gen-unicode-data.py @@ -147,7 +147,7 @@ ranges_nfd: list[tuple[int, int, int]] = [(0, 0, 0)] # start, last, nfd for codepoint, norm in table_nfd: start = ranges_nfd[-1][0] if ranges_nfd[-1] != (start, codepoint - 1, norm): - ranges_nfd.append(None) # type: ignore[arg-type] # dummy, will be replaced below + ranges_nfd.append((0, 0, 0)) # dummy, will be replaced below start = codepoint ranges_nfd[-1] = (start, codepoint, norm) diff --git a/tools/server/tests/utils.py b/tools/server/tests/utils.py index 8f62210bcc..a9a7e3c4f3 100644 --- a/tools/server/tests/utils.py +++ b/tools/server/tests/utils.py @@ -116,7 +116,7 @@ class ServerProcess: self.server_port = int(os.environ["PORT"]) self.external_server = "DEBUG_EXTERNAL" in os.environ - def start(self, timeout_seconds: int | None = DEFAULT_HTTP_TIMEOUT) -> None: + def start(self, timeout_seconds: int = DEFAULT_HTTP_TIMEOUT) -> None: if self.external_server: print(f"[external_server]: Assuming external server running on {self.server_host}:{self.server_port}") return