Some checks failed
Self-hosted runner (nightly-past-ci-caller) / Get number (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.11 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.10 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.9 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.8 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.7 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.6 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.5 (push) Has been cancelled
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
Build documentation / build (push) Has been cancelled
Build documentation / build_other_lang (push) Has been cancelled
CodeQL Security Analysis / CodeQL Analysis (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
PR CI / pr-ci (push) Has been cancelled
Slow tests on important models (on Push - A10) / Get all modified files (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
Slow tests on important models (on Push - A10) / Model CI (push) Has been cancelled
Check Tiny Models / Check tiny models (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Model CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Pipeline CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Example CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / DeepSpeed CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI - Flash Attn / Setup (push) Has been cancelled
Nvidia CI - Flash Attn / Model CI (push) Has been cancelled
Nvidia CI / Setup (push) Has been cancelled
Nvidia CI / Model CI (push) Has been cancelled
Nvidia CI / Torch pipeline CI (push) Has been cancelled
Nvidia CI / Example CI (push) Has been cancelled
Nvidia CI / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI / DeepSpeed CI (push) Has been cancelled
Nvidia CI / Quantization CI (push) Has been cancelled
Nvidia CI / Kernels CI (push) Has been cancelled
Doctests / Setup (push) Has been cancelled
Doctests / Call doctest jobs (push) Has been cancelled
Doctests / Send results to webhook (push) Has been cancelled
Extras Smoke Test / Get supported Python versions (push) Has been cancelled
Extras Smoke Test / Test extras on Python ${{ matrix.python-version }} (push) Has been cancelled
Extras Smoke Test / Check Slack token availability (push) Has been cancelled
Extras Smoke Test / Notify failures to Slack (push) Has been cancelled
Self-hosted runner (AMD scheduled CI caller) / Trigger Scheduled AMD CI (push) Has been cancelled
Stale Bot / Close Stale Issues (push) Has been cancelled
124 lines
6.0 KiB
TOML
124 lines
6.0 KiB
TOML
[tool.coverage.run]
|
|
source = ["transformers"]
|
|
omit = [
|
|
"*/convert_*",
|
|
"*/__main__.py"
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"raise",
|
|
"except",
|
|
"register_parameter"
|
|
]
|
|
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 119
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"F", # Pyflakes
|
|
"I", # isort
|
|
"W", # pycodestyle warnings
|
|
"UP", # pyupgrade
|
|
"FURB", # refurb
|
|
"SIM", # flake8-simplify
|
|
"S110", # bandit's try-except-pass rule
|
|
"C4", # flake8-comprehensions
|
|
"C901", # McCabe complexity
|
|
"RUF013", # Checks for the use of implicit Optional in type annotations when the default parameter value is None.
|
|
"PERF102", # Checks for uses of dict.items() that discard either the key or the value when iterating over the dictionary.
|
|
"PLC1802", # Checks for len calls on sequences in a boolean test context.
|
|
"PLC0208", # Checks for iteration over a set literal where each element in the set is itself a literal value.
|
|
"PIE794", # Checks for duplicate field definitions in classes.
|
|
]
|
|
ignore = [
|
|
"E501", # Checks for lines that exceed the specified maximum character length.
|
|
"E741", # Checks for the use of the characters 'l', 'O', or 'I' as variable names.
|
|
"SIM1", # All SIM1XX rules
|
|
"SIM905", # Checks for static str.split calls that can be replaced with list literals.
|
|
"UP015", # Checks for redundant open mode arguments.
|
|
"UP031", # Checks for printf-style string formatting, and offers to replace it with str.format calls.
|
|
]
|
|
extend-safe-fixes = [
|
|
"UP006", # Checks for the use of generics that can be replaced with standard library variants based on PEP 585.
|
|
]
|
|
|
|
# Ignore import violations in all `__init__.py` files.
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"__init__.py" = ["E402", "F401", "F403", "F811"]
|
|
"examples/**/*.py" = ["C901"]
|
|
"src/transformers/file_utils.py" = ["F401"]
|
|
"src/transformers/utils/dummy_*.py" = ["F401"]
|
|
|
|
[tool.ruff.lint.isort]
|
|
lines-after-imports = 2
|
|
known-first-party = ["transformers"]
|
|
|
|
[tool.ruff.format]
|
|
# Like Black, use double quotes for strings.
|
|
quote-style = "double"
|
|
# Like Black, indent with spaces, rather than tabs.
|
|
indent-style = "space"
|
|
# Like Black, respect magic trailing commas.
|
|
skip-magic-trailing-comma = false
|
|
# Like Black, automatically detect the appropriate line ending.
|
|
line-ending = "auto"
|
|
|
|
[tool.ruff.lint.mccabe]
|
|
max-complexity = 75
|
|
|
|
[tool.pytest.ini_options]
|
|
addopts = "--doctest-glob='**/*.md'"
|
|
doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
|
|
markers = [
|
|
"all_flash_attn_test: marks tests related to all mainline flash attentions at once (deselect with '-m \"not all_flash_attn_test\"')",
|
|
"flash_attn_4_test: marks tests related to flash attention 4 (deselect with '-m \"not flash_attn_4_test\"')",
|
|
"flash_attn_3_test: marks tests related to flash attention 3 (deselect with '-m \"not flash_attn_3_test\"')",
|
|
"flash_attn_test: marks tests related to flash attention (deselect with '-m \"not flash_attn_test\"')",
|
|
"bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests",
|
|
"generate: marks tests that use the GenerationTesterMixin",
|
|
"is_training_test: marks tests that use the TrainingTesterMixin (deselect with '-m \"not is_training_test\"')",
|
|
"is_tensor_parallel_test: marks tests that use the TensorParallelTesterMixin (deselect with '-m \"not is_tensor_parallel_test\"')",
|
|
]
|
|
log_cli = 1
|
|
log_cli_level = "WARNING"
|
|
asyncio_default_fixture_loop_scope = "function"
|
|
filterwarnings = [
|
|
# The above pytest-asyncio rule emits unnessecary warnings when it's not installed, so skip it here
|
|
"ignore:Unknown config option.*asyncio_default_fixture_loop_scope",
|
|
# Latest sentencepiece (v0.2.1) triggers those warnings when installed due to its build with afflicted version of swig - skip them
|
|
"ignore:builtin type SwigPyPacked has no __module__ attribute:DeprecationWarning",
|
|
"ignore:builtin type SwigPyObject has no __module__ attribute:DeprecationWarning",
|
|
"ignore:builtin type swigvarlink has no __module__ attribute:DeprecationWarning",
|
|
]
|
|
env = [
|
|
# Avoid any ReadTimeout when making requests to the Hub (default is 10)
|
|
# Note: 'D:' means default value from laptop or CI won't be overwritten
|
|
"D:HF_HUB_DOWNLOAD_TIMEOUT=60",
|
|
]
|
|
|
|
[tool.ty]
|
|
# ty type checker configuration
|
|
# Using default settings for comprehensive type checking
|
|
|
|
[tool.ty.rules]
|
|
# Disable specific rules that produce false positives or are too strict for this codebase
|
|
invalid-method-override = "ignore" # Parameter name differences are acceptable (e.g., x vs input, new_embeddings vs value)
|
|
not-subscriptable = "ignore" # False positives on tensor slicing (e.g., self.position_ids[:, :seq_length])
|
|
no-matching-overload = "ignore" # False positives on torch.zeros and similar functions accepting Size/tuple
|
|
unsupported-operator = "ignore" # False positives on tuple concatenation with += when properly initialized
|
|
unresolved-import = "ignore" # Optional dependencies (mlx, torch_npu, habana_frameworks, etc.) checked at runtime
|
|
call-non-callable = "ignore" # Mixin pattern issues where classes are used as both types and callables
|
|
unresolved-reference = "ignore" # Forward references with noqa: F821 that ty doesn't respect
|
|
invalid-argument-type = "ignore" # Complex type narrowing and union type issues
|
|
not-iterable = "ignore" # Complex async/Future type patterns
|
|
invalid-return-type = "ignore" # Return type mismatches that would require refactoring
|
|
deprecated = "ignore" # Deprecation warnings from dependencies
|
|
invalid-assignment = "ignore" # Low-level assignments that are runtime-safe
|
|
unused-ignore-comment = "ignore" # Ignore comments that became unnecessary after adding broader per-file-ignores
|
|
unused-type-ignore-comment = "ignore" # A `# type: ignore` counts as "used" only when its suppressed error fires, which needs optional deps (torch, openai, ...) installed. CI's lean `quality` env lacks them, so directives used locally look unused in CI.
|