diff --git a/setup.py b/setup.py index 42c865b1b9ba..f272e2d2b76f 100644 --- a/setup.py +++ b/setup.py @@ -162,9 +162,6 @@ "libcst", "rich", "ray[tune]>=2.7.0", - "opentelemetry-api", - "opentelemetry-exporter-otlp", - "opentelemetry-sdk", ] # This is a lookup table with items like: {"tokenizers": "tokenizers==0.9.4", "packaging": "packaging"}, i.e. @@ -211,8 +208,6 @@ def deps_list(*pkgs): extras["ja"] = deps_list("fugashi", "ipadic", "unidic_lite", "unidic", "rhoknp") if PYTHON_MINOR_VERSION < 14: extras["ja"] += deps_list("sudachipy", "sudachidict_core") -# OpenTelemetry dependencies for metrics collection in continuous batching -extras["open-telemetry"] = deps_list("opentelemetry-api", "opentelemetry-exporter-otlp", "opentelemetry-sdk") extras["testing"] = ( deps_list( @@ -330,7 +325,7 @@ def run(self): setup( name="transformers", - version="5.7.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) + version="5.10.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) author="The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)", author_email="transformers@huggingface.co", description="Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.", diff --git a/src/transformers/dependency_versions_table.py b/src/transformers/dependency_versions_table.py index 1a721ca2a82a..39d7900c5f2e 100644 --- a/src/transformers/dependency_versions_table.py +++ b/src/transformers/dependency_versions_table.py @@ -89,7 +89,4 @@ "libcst": "libcst", "rich": "rich", "ray[tune]": "ray[tune]>=2.7.0", - "opentelemetry-api": "opentelemetry-api", - "opentelemetry-exporter-otlp": "opentelemetry-exporter-otlp", - "opentelemetry-sdk": "opentelemetry-sdk", } diff --git a/src/transformers/models/zamba2/configuration_zamba2.py b/src/transformers/models/zamba2/configuration_zamba2.py index f64cd5968552..6d754d1ecf7a 100644 --- a/src/transformers/models/zamba2/configuration_zamba2.py +++ b/src/transformers/models/zamba2/configuration_zamba2.py @@ -29,12 +29,12 @@ class Zamba2Config(PreTrainedConfig): Number of groups for the evolution matrices of mamba 2. n_mamba_heads (`int`, *optional*, defaults to 8): Number of heads for the evolution matrices of mamba 2. + use_mamba_kernels (`bool`, *optional*, defaults to `True`): + Flag indicating whether or not to use the fast mamba kernels. use_conv_bias (`bool`, *optional*, defaults to `True`): Whether or not to use bias in the convolution layer of the mixer block. chunk_size (`int`, *optional*, defaults to 256): Size of the chunks that will comprise the sequence. - use_mamba_kernels (`bool`, *optional*, defaults to `True`): - Flag indicating whether or not to use the fast mamba kernels. use_mem_eff_path (`bool`, *optional*, defaults to `False`): Whether or not to use the fused conv1d and scan in mamba2 layers. add_bias_linear (`bool`, *optional*, defaults to `False`): diff --git a/src/transformers/quantizers/base.py b/src/transformers/quantizers/base.py index 5390a9c3e8d3..c786eeedc826 100644 --- a/src/transformers/quantizers/base.py +++ b/src/transformers/quantizers/base.py @@ -57,6 +57,13 @@ def get_keys_to_not_convert(model) -> list: } modules_to_not_convert = tied_keys | last_module_key | output_emb_keys + # Audio modules in multimodal models are typically small and not worth quantizing. + # Skipping them also prevents uint8 dtype crashes during inference. + # Use named_modules() to find audio modules regardless of nesting depth. + for name, _ in model.named_modules(): + if name.endswith(("audio_tower", "embed_audio")): + modules_to_not_convert.add(name) + modules_to_not_convert = list({k.removesuffix(".weight") for k in modules_to_not_convert}) return list(modules_to_not_convert) diff --git a/tests/quantization/bnb/test_4bit.py b/tests/quantization/bnb/test_4bit.py index f442df6a299a..02715def7211 100644 --- a/tests/quantization/bnb/test_4bit.py +++ b/tests/quantization/bnb/test_4bit.py @@ -868,3 +868,28 @@ def test_generate_compile(self): max_new_tokens=10, cache_implementation="static", ) + + def test_get_keys_to_not_convert_excludes_audio_modules(self): + """Audio modules should be excluded from quantization by default.""" + import torch.nn as nn + + from transformers.quantizers.base import get_keys_to_not_convert + + class DummyInnerModel(nn.Module): + def __init__(self): + super().__init__() + self.audio_tower = nn.Sequential(nn.Linear(10, 10), nn.Linear(10, 10)) + self.embed_audio = nn.Linear(10, 10) + self.language_model = nn.Linear(10, 10) + + class DummyMultimodalModel(nn.Module): + def __init__(self): + super().__init__() + self.model = DummyInnerModel() + + model = DummyMultimodalModel() + keys = get_keys_to_not_convert(model) + + self.assertIn("model.audio_tower", keys) + self.assertIn("model.embed_audio", keys) + self.assertNotIn("model.audio_tower.0", keys) diff --git a/utils/add_dates.py b/utils/add_dates.py index 06a0bc937497..ea1704095425 100644 --- a/utils/add_dates.py +++ b/utils/add_dates.py @@ -16,7 +16,7 @@ "label": "Model dates", # Approximate: also reads docs/source/en/model_doc/*.md and uses git log + network # calls to GitHub/HuggingFace for commit dates and paper metadata. - "file_globs": ["src/transformers/models/**/__init__.py", "docs/source/en/model_doc/**/*.md"], + "cache_globs": ["src/transformers/models/**/__init__.py", "docs/source/en/model_doc/**/*.md"], "check_args": ["--check-only"], "fix_args": [], } diff --git a/utils/check_copies.py b/utils/check_copies.py index 908f82e39314..a0d90c72b60b 100644 --- a/utils/check_copies.py +++ b/utils/check_copies.py @@ -49,7 +49,7 @@ "name": "copies", "label": "Copied code consistency", # Actual scope: all of src/transformers/**/*.py and tests/models/**/*.py via glob.glob(). - "file_globs": ["src/transformers/**/*.py", "tests/models/**/*.py"], + "cache_globs": ["src/transformers/**/*.py", "tests/models/**/*.py"], "check_args": [], "fix_args": ["--fix_and_overwrite"], } diff --git a/utils/check_doc_toc.py b/utils/check_doc_toc.py index 405e6e25987b..8427814b0fba 100644 --- a/utils/check_doc_toc.py +++ b/utils/check_doc_toc.py @@ -41,7 +41,7 @@ "name": "doc_toc", "label": "Documentation table of contents", # Also reads docs/source/en/_toctree.yml; the .md glob catches new/renamed doc files. - "file_globs": ["docs/**/*.md", "docs/source/en/_toctree.yml"], + "cache_globs": ["docs/**/*.md", "docs/source/en/_toctree.yml"], "check_args": [], "fix_args": ["--fix_and_overwrite"], } diff --git a/utils/check_docstrings.py b/utils/check_docstrings.py index cadaf24ec657..bec9ffa62bf6 100644 --- a/utils/check_docstrings.py +++ b/utils/check_docstrings.py @@ -67,7 +67,7 @@ "label": "Docstring formatting", # Approximate: at runtime the checker also introspects the live transformers module for # @auto_docstring-decorated objects. These globs cover the files it reads via glob.glob(). - "file_globs": [ + "cache_globs": [ "src/transformers/models/**/modeling_*.py", "src/transformers/models/**/modular_*.py", "src/transformers/models/**/configuration_*.py", diff --git a/utils/check_doctest_list.py b/utils/check_doctest_list.py index 6a4885cb6734..188eb330e841 100644 --- a/utils/check_doctest_list.py +++ b/utils/check_doctest_list.py @@ -39,7 +39,7 @@ "label": "Doctest list", # Over-approximation: the checker validates that paths in .txt list files exist and are # sorted. The broad globs ensure cache invalidation when source files are added/removed. - "file_globs": [ + "cache_globs": [ "utils/not_doctested.txt", "utils/slow_documentation_tests.txt", "src/transformers/**/*.py", diff --git a/utils/check_dummies.py b/utils/check_dummies.py index 3cf564b4fd2d..f114d6fdc22d 100644 --- a/utils/check_dummies.py +++ b/utils/check_dummies.py @@ -43,7 +43,7 @@ "label": "Dummy objects", # Over-approximation: only reads __init__.py and utils/dummy_*_objects.py, but any # new public object added anywhere could require a dummy update. - "file_globs": ["src/transformers/**/*.py"], + "cache_globs": ["src/transformers/**/*.py"], "check_args": [], "fix_args": ["--fix_and_overwrite"], } diff --git a/utils/check_modular_conversion.py b/utils/check_modular_conversion.py index c6bb10dd2905..a1a1e6c317e4 100644 --- a/utils/check_modular_conversion.py +++ b/utils/check_modular_conversion.py @@ -20,7 +20,7 @@ "name": "modular_conversion", "label": "Modular file conversions", # Globs the modular sources; also reads generated modeling_*.py at runtime for diffing. - "file_globs": ["src/transformers/models/**/modular_*.py", "src/transformers/models/**/modeling_*.py"], + "cache_globs": ["src/transformers/models/**/modular_*.py", "src/transformers/models/**/modeling_*.py"], "check_args": [], "fix_args": ["--fix_and_overwrite"], } diff --git a/utils/check_pipeline_typing.py b/utils/check_pipeline_typing.py index db3d697eeba3..a6c2534e3ba8 100644 --- a/utils/check_pipeline_typing.py +++ b/utils/check_pipeline_typing.py @@ -6,7 +6,7 @@ CHECKER_CONFIG = { "name": "pipeline_typing", "label": "Pipeline type hints", - "file_globs": ["src/transformers/pipelines/__init__.py"], + "cache_globs": ["src/transformers/pipelines/__init__.py"], "check_args": [], "fix_args": ["--fix_and_overwrite"], } diff --git a/utils/custom_init_isort.py b/utils/custom_init_isort.py index 1356ecb08b0c..28d9f99243b0 100644 --- a/utils/custom_init_isort.py +++ b/utils/custom_init_isort.py @@ -44,7 +44,7 @@ CHECKER_CONFIG = { "name": "init_isort", "label": "Import ordering", - "file_globs": ["src/transformers/**/__init__.py"], + "cache_globs": ["src/transformers/**/__init__.py"], "check_args": ["--check_only"], "fix_args": [], } diff --git a/utils/sort_auto_mappings.py b/utils/sort_auto_mappings.py index 655f056eb376..9441b3b1ee17 100644 --- a/utils/sort_auto_mappings.py +++ b/utils/sort_auto_mappings.py @@ -37,7 +37,7 @@ CHECKER_CONFIG = { "name": "sort_auto_mappings", "label": "Sort auto mappings", - "file_globs": ["src/transformers/models/auto/*.py"], + "cache_globs": ["src/transformers/models/auto/*.py"], "check_args": ["--check_only"], "fix_args": [], }