forked from TransformerLensOrg/TransformerLens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
191 lines (175 loc) · 6.05 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
[tool.poetry]
authors=["Neel Nanda <[email protected]>"]
description="An implementation of transformers tailored for mechanistic interpretability."
license="MIT"
name="transformer-lens"
packages=[{include="transformer_lens"}]
readme="README.md"
# Version is automatically set by the pipeline on release
version="0.0.0"
[tool.poetry.scripts]
build-docs="docs.make_docs:build_docs"
docs-hot-reload="docs.make_docs:docs_hot_reload"
[tool.poetry.dependencies]
accelerate=">=0.23.0" # Needed for Llama Models
beartype="^0.14.1"
better-abc="^0.0.3"
datasets=">=2.7.1"
einops=">=0.6.0"
fancy-einsum=">=0.0.3"
jaxtyping=">=0.2.11"
numpy=[
{version=">=1.20,<1.25", python=">=3.8,<3.9"},
{version=">=1.24", python=">=3.9,<3.12"},
{version=">=1.26", python=">=3.12,<3.13"},
]
pandas=">=1.1.5"
python=">=3.8,<4.0"
rich=">=12.6.0"
sentencepiece="*"
torch=[
{platform="!=linux", version=">=1.10,!=2.0,!=2.1.0"}, # Pin >=2.1.1 on Apple devices due to known MPS errors on 2.1.0
{platform="linux", version=">=1.10"}, # We can use any torch version on Linux (e.g colab)
]
tqdm=">=4.64.1"
transformers=">=4.37.2"
typing-extensions="*"
wandb=">=0.13.5"
[tool.poetry.group]
[tool.poetry.group.dev.dependencies]
black="^23.3.0"
circuitsvis=">=1.38.1"
isort="5.8.0"
jupyter=">=1.0.0"
mypy=">=1.8.0"
nbval="^0.10.0"
plotly=">=5.12.0"
pycln="^2.1.3"
pytest=">=7.2.0"
pytest-cov=">=4.0.0"
pytest-doctestplus="^1.0.0"
[tool.poetry.group.jupyter.dependencies]
ipywidgets="^8.1.1"
jupyterlab=">=3.5.0"
[tool.poetry.group.docs.dependencies]
furo={version=">=2022.12.7"}
myst-parser={version=">=0.18.1"}
nbconvert="^7.9.2"
nbsphinx="^0.9.3"
pandoc="^2.3"
snowballstemmer="*"
sphinx={version="5.2.3"}
sphinx-autobuild={version=">=2021.3.14"}
sphinxcontrib-napoleon={version=">=0.7"}
tabulate={version=">=0.9.0"}
[tool.pytest]
[tool.pytest.ini_options]
addopts=[
"--doctest-modules",
"--doctest-plus",
"--jaxtyping-packages=transformer_lens,beartype.beartype",
"--nbval",
"-W ignore::beartype.roar.BeartypeDecorHintPep585DeprecationWarning",
]
doctest_optionflags="NORMALIZE_WHITESPACE ELLIPSIS FLOAT_CMP"
filterwarnings=[
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
# Ignore numpy.distutils deprecation warning caused by pandas
# More info: https://numpy.org/doc/stable/reference/distutils.html#module-numpy.distutils
"ignore:distutils Version classes are deprecated:DeprecationWarning",
]
[tool.isort]
extend_skip=[".venv/", "__init__.py"]
profile="black"
[tool.mypy]
check_untyped_defs=true
exclude=[".venv/", "assets", "demos", "docs", "easy_transformer", "tests"]
ignore_missing_imports=true
[tool.black]
line-length=100 # Set line length to 100 to match other tools
# Exclude snapshot tests & .venv
exclude='''
(
/snapshots/
| .venv/
)
'''
[tool.pylint]
[tool.pylint.TYPECHECK]
# Fix for Pytorch member existence checks
generated-members="torch.*"
[tool.pylint.DESIGN]
max-args=10
max-locals=30
[tool.pylint."MESSAGES CONTROL"]
disable="redefined-builtin" # Disable redefined builtin functions
[tool.pylint.'MASTER']
disable=[
"C0103", # Disable invalid file name (as we use PascalCase for classes)
]
[build-system]
build-backend="poetry.core.masonry.api"
requires=["poetry-core"]
[tool.pyright]
# All rules apart from base are shown explicitly below
deprecateTypingAliases=true
disableBytesTypePromotions=true
exclude = [
"*/**/*.py",
"!/transformer_lens/hook_points.py"
]
reportAssertAlwaysTrue=true
reportConstantRedefinition=true
reportDeprecated=true
reportDuplicateImport=true
reportFunctionMemberAccess=true
reportGeneralTypeIssues=true
reportIncompatibleMethodOverride=true
reportIncompatibleVariableOverride=true
reportIncompleteStub=true
reportInconsistentConstructor=true
reportInvalidStringEscapeSequence=true
reportInvalidStubStatement=true
reportInvalidTypeVarUse=true
reportMatchNotExhaustive=true
reportMissingParameterType=true
reportMissingTypeArgument=false
reportMissingTypeStubs=false
reportOptionalCall=true
reportOptionalContextManager=true
reportOptionalIterable=true
reportOptionalMemberAccess=true
reportOptionalOperand=true
reportOptionalSubscript=true
reportOverlappingOverload=true
reportPrivateImportUsage=true
reportPrivateUsage=true
reportSelfClsParameterName=true
reportTypeCommentUsage=true
reportTypedDictNotRequiredAccess=true
reportUnboundVariable=true
reportUnknownArgumentType=false
reportUnknownLambdaType=true
reportUnknownMemberType=false
reportUnknownParameterType=false
reportUnknownVariableType=false
reportUnnecessaryCast=true
reportUnnecessaryComparison=true
reportUnnecessaryContains=true
reportUnnecessaryIsInstance=true
reportUnsupportedDunderAll=true
reportUntypedBaseClass=true
reportUntypedClassDecorator=true
reportUntypedFunctionDecorator=true
reportUntypedNamedTuple=true
reportUnusedClass=true
reportUnusedCoroutine=true
reportUnusedExpression=true
reportUnusedFunction=true
reportUnusedImport=true
reportUnusedVariable=true
reportWildcardImportFromLibrary=true
strictDictionaryInference=true
strictListInference=true
strictParameterNoneValue=true
strictSetInference=true