.pre-commit-config.yaml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. repos:
  2. - repo: meta
  3. hooks:
  4. - id: check-hooks-apply
  5. - id: check-useless-excludes
  6. - repo: https://github.com/pre-commit/pre-commit-hooks
  7. rev: v4.0.1
  8. hooks:
  9. - id: check-case-conflict
  10. - id: check-json
  11. - id: check-symlinks
  12. - id: check-yaml
  13. - id: destroyed-symlinks
  14. - id: end-of-file-fixer
  15. exclude: docs/CNAME
  16. - id: fix-byte-order-marker
  17. - id: fix-encoding-pragma
  18. args: [--remove]
  19. - id: mixed-line-ending
  20. args: [--fix=lf]
  21. - id: requirements-txt-fixer
  22. - id: trailing-whitespace
  23. - repo: https://github.com/google/yapf
  24. rev: v0.32.0
  25. hooks:
  26. - id: yapf
  27. - repo: https://gitlab.com/daverona/pre-commit/cpp
  28. rev: 0.8.0
  29. hooks:
  30. - id: clang-format # formatter of C/C++ code based on a style guide: LLVM, Google, Chromium, Mozilla, and WebKit available
  31. args: []
  32. - repo: local
  33. hooks:
  34. - id: check-torchdist
  35. name: check-torchdist
  36. entry: ./scripts/check-torchdist.py
  37. language: python
  38. exclude: ^(deepspeed/comm/|docs/|benchmarks/|scripts/check-torchdist.py|deepspeed/moe/sharded_moe.py|deepspeed/runtime/comm/coalesced_collectives.py|deepspeed/elasticity/elastic_agent.py|deepspeed/launcher/launch.py|tests/unit/comm/test_dist.py)
  39. # Specific deepspeed/ files are excluded for now until we wrap ProcessGroup in deepspeed.comm
  40. - repo: local
  41. hooks:
  42. - id: check-license
  43. name: check-license
  44. entry: ./scripts/check-license.py
  45. language: python
  46. files: \.(py|c|cpp|cu|cc|h|hpp|cuh|hip|tr)$
  47. exclude: ^(deepspeed/inference/v2/kernels/ragged_ops/blocked_flash|deepspeed/inference/v2/kernels/cutlass_ops/grouped_gemm)
  48. - repo: https://github.com/codespell-project/codespell
  49. rev: v2.1.0
  50. hooks:
  51. - id: codespell
  52. args: [
  53. # Do not check files that are automatically generated
  54. '--skip=docs/Gemfile.lock,tests/unit/gpt2-merges.txt,tests/unit/gpt2-vocab.json',
  55. '--ignore-regex=\\n', # Do not count the 'n' in an escaped newline as part of a word
  56. '--ignore-words-list=youn,unsupport,noe,cann', # Word used in error messages that need rewording
  57. --check-filenames,
  58. --check-hidden
  59. ]
  60. - repo: https://github.com/pycqa/flake8
  61. rev: 4.0.1
  62. hooks:
  63. - id: flake8
  64. args: ['--config=.flake8']
  65. - repo: local
  66. hooks:
  67. - id: check-torchcuda
  68. name: check-torchcuda
  69. entry: ./scripts/check-torchcuda.py
  70. language: python
  71. exclude: ^(.github/workflows/|scripts/check-torchcuda.py|docs/_tutorials/accelerator-abstraction-interface.md|docs/_tutorials/deepnvme.md|accelerator/cuda_accelerator.py|deepspeed/inference/engine.py|deepspeed/model_implementations/transformers/clip_encoder.py|deepspeed/model_implementations/diffusers/vae.py|deepspeed/model_implementations/diffusers/unet.py|op_builder/spatial_inference.py|op_builder/transformer_inference.py|op_builder/builder.py|setup.py|tests/unit/ops/sparse_attention/test_sparse_attention.py)
  72. # Specific deepspeed/ files are excluded for now until we wrap ProcessGroup in deepspeed.comm
  73. - repo: local
  74. hooks:
  75. - id: check-extraindexurl
  76. name: check-extraindexurl
  77. entry: ./scripts/check-extraindexurl.py
  78. language: python
  79. files: \.(yml|yaml|sh|py)$
  80. exclude: ^(scripts/check-extraindexurl.py)