From 177425d79500f209515772be2b4f2a956674e9e3 Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Tue, 30 Dec 2025 15:04:12 +0800 Subject: [PATCH 1/6] chore: bump version to 2.0.0b5 --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a9660a5c..ed7115cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lm-saes" -version = "2.0.0b4" +version = "2.0.0b5" description = "For OpenMOSS Mechanistic Interpretability Team's Sparse Autoencoder (SAE) research. Open-sourced and constantly updated." dependencies = [ "transformer-lens", diff --git a/uv.lock b/uv.lock index a7bec3f8..ab2c8614 100644 --- a/uv.lock +++ b/uv.lock @@ -1480,7 +1480,7 @@ wheels = [ [[package]] name = "lm-saes" -version = "2.0.0b4" +version = "2.0.0b5" source = { editable = "." } dependencies = [ { name = "datasets" }, From 9b1ac478008372c7b217acd6b4e8c4efc4aa6659 Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Tue, 30 Dec 2025 15:49:08 +0800 Subject: [PATCH 2/6] chore: add commitizen --- pyproject.toml | 10 ++++- uv.lock | 109 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ed7115cf..9eaae6b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,6 +95,7 @@ dev = [ "gradio>=5.34.0", "sqlalchemy>=2.0.44", "apscheduler>=3.11.1", + "commitizen>=4.11.0", ] docs = [ "mkdocs-gen-files>=0.5.0", @@ -198,4 +199,11 @@ requires-dist = ["torch", "einops"] [tool.uv.sources.transformer-lens] path = "./TransformerLens" -editable = true \ No newline at end of file +editable = true + +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "v$version" +version_scheme = "pep440" +version_provider = "uv" +update_changelog_on_bump = true diff --git a/uv.lock b/uv.lock index ab2c8614..a8a90654 100644 --- a/uv.lock +++ b/uv.lock @@ -141,6 +141,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/58/9f/d3c76f76c73fcc959d28e9def45b8b1cc3d7722660c5003b19c1022fd7f4/apscheduler-3.11.1-py3-none-any.whl", hash = "sha256:6162cb5683cb09923654fa9bdd3130c4be4bfda6ad8990971c9597ecd52965d2", size = 64278, upload-time = "2025-10-31T18:55:41.186Z" }, ] +[[package]] +name = "argcomplete" +version = "3.6.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/38/61/0b9ae6399dd4a58d8c1b1dc5a27d6f2808023d0b5dd3104bb99f45a33ff6/argcomplete-3.6.3.tar.gz", hash = "sha256:62e8ed4fd6a45864acc8235409461b72c9a28ee785a2011cc5eb78318786c89c", size = 73754, upload-time = "2025-10-20T03:33:34.741Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/74/f5/9373290775639cb67a2fce7f629a1c240dce9f12fe927bc32b2736e16dfc/argcomplete-3.6.3-py3-none-any.whl", hash = "sha256:f5007b3a600ccac5d25bbce33089211dfd49eab4a7718da3f10e3082525a92ce", size = 43846, upload-time = "2025-10-20T03:33:33.021Z" }, +] + [[package]] name = "argon2-cffi" version = "25.1.0" @@ -448,6 +457,29 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/60/97/891a0971e1e4a8c5d2b20bbe0e524dc04548d2307fee33cdeba148fd4fc7/comm-0.2.3-py3-none-any.whl", hash = "sha256:c615d91d75f7f04f095b30d1c1711babd43bdc6419c1be9886a85f2f4e489417", size = 7294, upload-time = "2025-07-25T14:02:02.896Z" }, ] +[[package]] +name = "commitizen" +version = "4.11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "argcomplete" }, + { name = "charset-normalizer" }, + { name = "colorama" }, + { name = "decli" }, + { name = "deprecated" }, + { name = "jinja2" }, + { name = "packaging" }, + { name = "prompt-toolkit" }, + { name = "pyyaml" }, + { name = "questionary" }, + { name = "termcolor" }, + { name = "tomlkit" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c4/aa/e0188faa6eecd4293a1d4213ea2b2ddcbed7f8f248ef41594662a78bba92/commitizen-4.11.0.tar.gz", hash = "sha256:d311297a0165ef9f30e0877e04608b786d5fd69760f32245fbf1c21e793e91df", size = 57939, upload-time = "2025-12-29T11:26:36.67Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/80/4a/a466d904f0b218dd357669b8585540c0b086ff335fd8182bf35456f4f41b/commitizen-4.11.0-py3-none-any.whl", hash = "sha256:a30fdf326bb0913b7b25f8b30530c899159b1757efa9969b0aa1808dad102c02", size = 82851, upload-time = "2025-12-29T11:26:34.718Z" }, +] + [[package]] name = "config2py" version = "0.1.45" @@ -535,6 +567,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b0/d0/89247ec250369fc76db477720a26b2fce7ba079ff1380e4ab4529d2fe233/debugpy-1.8.17-py2.py3-none-any.whl", hash = "sha256:60c7dca6571efe660ccb7a9508d73ca14b8796c4ed484c2002abba714226cfef", size = 5283210, upload-time = "2025-09-17T16:34:25.835Z" }, ] +[[package]] +name = "decli" +version = "0.6.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/0c/59/d4ffff1dee2c8f6f2dd8f87010962e60f7b7847504d765c91ede5a466730/decli-0.6.3.tar.gz", hash = "sha256:87f9d39361adf7f16b9ca6e3b614badf7519da13092f2db3c80ca223c53c7656", size = 7564, upload-time = "2025-06-01T15:23:41.25Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d8/fa/ec878c28bc7f65b77e7e17af3522c9948a9711b9fa7fc4c5e3140a7e3578/decli-0.6.3-py3-none-any.whl", hash = "sha256:5152347c7bb8e3114ad65db719e5709b28d7f7f45bdb709f70167925e55640f3", size = 7989, upload-time = "2025-06-01T15:23:40.228Z" }, +] + [[package]] name = "decorator" version = "5.2.1" @@ -553,6 +594,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/07/6c/aa3f2f849e01cb6a001cd8554a88d4c77c5c1a31c95bdf1cf9301e6d9ef4/defusedxml-0.7.1-py2.py3-none-any.whl", hash = "sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61", size = 25604, upload-time = "2021-03-08T10:59:24.45Z" }, ] +[[package]] +name = "deprecated" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "wrapt" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/49/85/12f0a49a7c4ffb70572b6c2ef13c90c88fd190debda93b23f026b25f9634/deprecated-1.3.1.tar.gz", hash = "sha256:b1b50e0ff0c1fddaa5708a2c6b0a6588bb09b892825ab2b214ac9ea9d92a5223", size = 2932523, upload-time = "2025-10-30T08:19:02.757Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/84/d0/205d54408c08b13550c733c4b85429e7ead111c7f0014309637425520a9a/deprecated-1.3.1-py2.py3-none-any.whl", hash = "sha256:597bfef186b6f60181535a29fbe44865ce137a5079f295b479886c82729d5f3f", size = 11298, upload-time = "2025-10-30T08:19:00.758Z" }, +] + [[package]] name = "dill" version = "0.4.0" @@ -1531,6 +1584,7 @@ dev = [ { name = "apscheduler" }, { name = "argparse" }, { name = "basedpyright" }, + { name = "commitizen" }, { name = "gradio" }, { name = "ipykernel" }, { name = "ipywidgets" }, @@ -1606,6 +1660,7 @@ dev = [ { name = "apscheduler", specifier = ">=3.11.1" }, { name = "argparse", specifier = ">=1.4.0" }, { name = "basedpyright", specifier = ">=1.21.0" }, + { name = "commitizen", specifier = ">=4.11.0" }, { name = "gradio", specifier = ">=5.34.0" }, { name = "ipykernel", specifier = ">=6.29.5" }, { name = "ipywidgets", specifier = ">=8.1.5" }, @@ -2545,14 +2600,14 @@ wheels = [ [[package]] name = "prompt-toolkit" -version = "3.0.52" +version = "3.0.51" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "wcwidth" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a1/96/06e01a7b38dce6fe1db213e061a4602dd6032a8a97ef6c1a862537732421/prompt_toolkit-3.0.52.tar.gz", hash = "sha256:28cde192929c8e7321de85de1ddbe736f1375148b02f2e17edd840042b1be855", size = 434198, upload-time = "2025-08-27T15:24:02.057Z" } +sdist = { url = "https://files.pythonhosted.org/packages/bb/6e/9d084c929dfe9e3bfe0c6a47e31f78a25c54627d64a66e884a8bf5474f1c/prompt_toolkit-3.0.51.tar.gz", hash = "sha256:931a162e3b27fc90c86f1b48bb1fb2c528c2761475e57c9c06de13311c7b54ed", size = 428940, upload-time = "2025-04-15T09:18:47.731Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/84/03/0d3ce49e2505ae70cf43bc5bb3033955d2fc9f932163e84dc0779cc47f48/prompt_toolkit-3.0.52-py3-none-any.whl", hash = "sha256:9aac639a3bbd33284347de5ad8d68ecc044b91a762dc39b7c21095fcd6a19955", size = 391431, upload-time = "2025-08-27T15:23:59.498Z" }, + { url = "https://files.pythonhosted.org/packages/ce/4f/5249960887b1fbe561d9ff265496d170b55a735b76724f10ef19f9e40716/prompt_toolkit-3.0.51-py3-none-any.whl", hash = "sha256:52742911fde84e2d423e2f9a4cf1de7d7ac4e51958f648d9540e0fb8db077b07", size = 387810, upload-time = "2025-04-15T09:18:44.753Z" }, ] [[package]] @@ -2955,6 +3010,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/01/1b/5dbe84eefc86f48473947e2f41711aded97eecef1231f4558f1f02713c12/pyzmq-27.1.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:c9f7f6e13dff2e44a6afeaf2cf54cee5929ad64afaf4d40b50f93c58fc687355", size = 544862, upload-time = "2025-09-08T23:09:56.509Z" }, ] +[[package]] +name = "questionary" +version = "2.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "prompt-toolkit" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f6/45/eafb0bba0f9988f6a2520f9ca2df2c82ddfa8d67c95d6625452e97b204a5/questionary-2.1.1.tar.gz", hash = "sha256:3d7e980292bb0107abaa79c68dd3eee3c561b83a0f89ae482860b181c8bd412d", size = 25845, upload-time = "2025-08-28T19:00:20.851Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3c/26/1062c7ec1b053db9e499b4d2d5bc231743201b74051c973dadeac80a8f43/questionary-2.1.1-py3-none-any.whl", hash = "sha256:a51af13f345f1cdea62347589fbb6df3b290306ab8930713bfae4d475a7d4a59", size = 36753, upload-time = "2025-08-28T19:00:19.56Z" }, +] + [[package]] name = "qwen-vl-utils" version = "0.0.14" @@ -3465,6 +3532,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e5/30/643397144bfbfec6f6ef821f36f33e57d35946c44a2352d3c9f0ae847619/tenacity-9.1.2-py3-none-any.whl", hash = "sha256:f77bf36710d8b73a50b2dd155c97b870017ad21afe6ab300326b0371b3b05138", size = 28248, upload-time = "2025-04-02T08:25:07.678Z" }, ] +[[package]] +name = "termcolor" +version = "3.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/46/79/cf31d7a93a8fdc6aa0fbb665be84426a8c5a557d9240b6239e9e11e35fc5/termcolor-3.3.0.tar.gz", hash = "sha256:348871ca648ec6a9a983a13ab626c0acce02f515b9e1983332b17af7979521c5", size = 14434, upload-time = "2025-12-29T12:55:21.882Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/33/d1/8bb87d21e9aeb323cc03034f5eaf2c8f69841e40e4853c2627edf8111ed3/termcolor-3.3.0-py3-none-any.whl", hash = "sha256:cf642efadaf0a8ebbbf4bc7a31cec2f9b5f21a9f726f4ccbb08192c9c26f43a5", size = 7734, upload-time = "2025-12-29T12:55:20.718Z" }, +] + [[package]] name = "terminado" version = "0.18.1" @@ -3858,16 +3934,16 @@ wheels = [ [[package]] name = "virtualenv" -version = "20.35.1" +version = "20.35.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "distlib" }, { name = "filelock" }, { name = "platformdirs" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/b4/55/a15050669ab087762c2c63010ef54643032ac1b32b5e15cc4ba75897806b/virtualenv-20.35.1.tar.gz", hash = "sha256:041dac43b6899858a91838b616599e80000e545dee01a21172a6a46746472cb2", size = 6005687, upload-time = "2025-10-09T22:21:16.139Z" } +sdist = { url = "https://files.pythonhosted.org/packages/20/28/e6f1a6f655d620846bd9df527390ecc26b3805a0c5989048c210e22c5ca9/virtualenv-20.35.4.tar.gz", hash = "sha256:643d3914d73d3eeb0c552cbb12d7e82adf0e504dbf86a3182f8771a153a1971c", size = 6028799, upload-time = "2025-10-29T06:57:40.511Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/37/32/8ab08a0cf98bdc8e9fd7522111327e33089da79c7d6b05542626be34cbb8/virtualenv-20.35.1-py3-none-any.whl", hash = "sha256:1d9d93cd01d35b785476e2fa7af711a98d40d227a078941695bbae394f8737e2", size = 5984643, upload-time = "2025-10-09T22:21:13.739Z" }, + { url = "https://files.pythonhosted.org/packages/79/0c/c05523fa3181fdf0c9c52a6ba91a23fbf3246cc095f26f6516f9c60e6771/virtualenv-20.35.4-py3-none-any.whl", hash = "sha256:c21c9cede36c9753eeade68ba7d523529f228a403463376cf821eaae2b650f1b", size = 6005095, upload-time = "2025-10-29T06:57:37.598Z" }, ] [[package]] @@ -3994,6 +4070,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ca/51/5447876806d1088a0f8f71e16542bf350918128d0a69437df26047c8e46f/widgetsnbextension-4.0.14-py3-none-any.whl", hash = "sha256:4875a9eaf72fbf5079dc372a51a9f268fc38d46f767cbf85c43a36da5cb9b575", size = 2196503, upload-time = "2025-04-10T13:01:23.086Z" }, ] +[[package]] +name = "wrapt" +version = "2.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2a/6de8a50cb435b7f42c46126cf1a54b2aab81784e74c8595c8e025e8f36d3/wrapt-2.0.1.tar.gz", hash = "sha256:9c9c635e78497cacb81e84f8b11b23e0aacac7a136e73b8e5b2109a1d9fc468f", size = 82040, upload-time = "2025-11-07T00:45:33.312Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/98/60/553997acf3939079dab022e37b67b1904b5b0cc235503226898ba573b10c/wrapt-2.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0e17283f533a0d24d6e5429a7d11f250a58d28b4ae5186f8f47853e3e70d2590", size = 77480, upload-time = "2025-11-07T00:43:30.573Z" }, + { url = "https://files.pythonhosted.org/packages/2d/50/e5b3d30895d77c52105c6d5cbf94d5b38e2a3dd4a53d22d246670da98f7c/wrapt-2.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:85df8d92158cb8f3965aecc27cf821461bb5f40b450b03facc5d9f0d4d6ddec6", size = 60690, upload-time = "2025-11-07T00:43:31.594Z" }, + { url = "https://files.pythonhosted.org/packages/f0/40/660b2898703e5cbbb43db10cdefcc294274458c3ca4c68637c2b99371507/wrapt-2.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c1be685ac7700c966b8610ccc63c3187a72e33cab53526a27b2a285a662cd4f7", size = 61578, upload-time = "2025-11-07T00:43:32.918Z" }, + { url = "https://files.pythonhosted.org/packages/5b/36/825b44c8a10556957bc0c1d84c7b29a40e05fcf1873b6c40aa9dbe0bd972/wrapt-2.0.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:df0b6d3b95932809c5b3fecc18fda0f1e07452d05e2662a0b35548985f256e28", size = 114115, upload-time = "2025-11-07T00:43:35.605Z" }, + { url = "https://files.pythonhosted.org/packages/83/73/0a5d14bb1599677304d3c613a55457d34c344e9b60eda8a737c2ead7619e/wrapt-2.0.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4da7384b0e5d4cae05c97cd6f94faaf78cc8b0f791fc63af43436d98c4ab37bb", size = 116157, upload-time = "2025-11-07T00:43:37.058Z" }, + { url = "https://files.pythonhosted.org/packages/01/22/1c158fe763dbf0a119f985d945711d288994fe5514c0646ebe0eb18b016d/wrapt-2.0.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ec65a78fbd9d6f083a15d7613b2800d5663dbb6bb96003899c834beaa68b242c", size = 112535, upload-time = "2025-11-07T00:43:34.138Z" }, + { url = "https://files.pythonhosted.org/packages/5c/28/4f16861af67d6de4eae9927799b559c20ebdd4fe432e89ea7fe6fcd9d709/wrapt-2.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7de3cc939be0e1174969f943f3b44e0d79b6f9a82198133a5b7fc6cc92882f16", size = 115404, upload-time = "2025-11-07T00:43:39.214Z" }, + { url = "https://files.pythonhosted.org/packages/a0/8b/7960122e625fad908f189b59c4aae2d50916eb4098b0fb2819c5a177414f/wrapt-2.0.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:fb1a5b72cbd751813adc02ef01ada0b0d05d3dcbc32976ce189a1279d80ad4a2", size = 111802, upload-time = "2025-11-07T00:43:40.476Z" }, + { url = "https://files.pythonhosted.org/packages/3e/73/7881eee5ac31132a713ab19a22c9e5f1f7365c8b1df50abba5d45b781312/wrapt-2.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3fa272ca34332581e00bf7773e993d4f632594eb2d1b0b162a9038df0fd971dd", size = 113837, upload-time = "2025-11-07T00:43:42.921Z" }, + { url = "https://files.pythonhosted.org/packages/45/00/9499a3d14e636d1f7089339f96c4409bbc7544d0889f12264efa25502ae8/wrapt-2.0.1-cp311-cp311-win32.whl", hash = "sha256:fc007fdf480c77301ab1afdbb6ab22a5deee8885f3b1ed7afcb7e5e84a0e27be", size = 58028, upload-time = "2025-11-07T00:43:47.369Z" }, + { url = "https://files.pythonhosted.org/packages/70/5d/8f3d7eea52f22638748f74b102e38fdf88cb57d08ddeb7827c476a20b01b/wrapt-2.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:47434236c396d04875180171ee1f3815ca1eada05e24a1ee99546320d54d1d1b", size = 60385, upload-time = "2025-11-07T00:43:44.34Z" }, + { url = "https://files.pythonhosted.org/packages/14/e2/32195e57a8209003587bbbad44d5922f13e0ced2a493bb46ca882c5b123d/wrapt-2.0.1-cp311-cp311-win_arm64.whl", hash = "sha256:837e31620e06b16030b1d126ed78e9383815cbac914693f54926d816d35d8edf", size = 58893, upload-time = "2025-11-07T00:43:46.161Z" }, + { url = "https://files.pythonhosted.org/packages/15/d1/b51471c11592ff9c012bd3e2f7334a6ff2f42a7aed2caffcf0bdddc9cb89/wrapt-2.0.1-py3-none-any.whl", hash = "sha256:4d2ce1bf1a48c5277d7969259232b57645aae5686dba1eaeade39442277afbca", size = 44046, upload-time = "2025-11-07T00:45:32.116Z" }, +] + [[package]] name = "xxhash" version = "3.6.0" From a1b3e99454a92511fd9c694456076e7deced5cbb Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Tue, 30 Dec 2025 16:48:54 +0800 Subject: [PATCH 3/6] chore: add commitizen version bump action --- .github/workflows/bumpversion.yml | 23 +++++++++++++++++++++++ .pre-commit-config.yaml | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/bumpversion.yml diff --git a/.github/workflows/bumpversion.yml b/.github/workflows/bumpversion.yml new file mode 100644 index 00000000..2d862b65 --- /dev/null +++ b/.github/workflows/bumpversion.yml @@ -0,0 +1,23 @@ +name: Bump version + +on: + push: + branches: + - main + +jobs: + bump-version: + if: "!startsWith(github.event.head_commit.message, 'bump:')" + runs-on: ubuntu-latest + name: "Bump version and create changelog with commitizen" + steps: + - name: Check out + uses: actions/checkout@v3 + with: + token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" + fetch-depth: 0 + - name: Create bump and changelog + uses: commitizen-tools/commitizen-action@master + with: + github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + prerelease: beta diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 859511ac..e19c67bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,3 +19,9 @@ repos: language: system pass_filenames: false files: ^ui-ssr/ + + - repo: https://github.com/commitizen-tools/commitizen + rev: v1.17.0 + hooks: + - id: commitizen + stages: [commit-msg] From 4aaad55311f13847fd197d6a4d190e077a87929e Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Tue, 30 Dec 2025 19:13:52 +0800 Subject: [PATCH 4/6] fix(examples): remove use of Path --- .../analyze_pythia_sae_with_pre_generated_activations.py | 2 +- examples/generate_pythia_activation_1d.py | 9 ++++----- examples/generate_pythia_activation_2d.py | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/analyze_pythia_sae_with_pre_generated_activations.py b/examples/analyze_pythia_sae_with_pre_generated_activations.py index aa49c3d7..5c0ad6ae 100644 --- a/examples/analyze_pythia_sae_with_pre_generated_activations.py +++ b/examples/analyze_pythia_sae_with_pre_generated_activations.py @@ -35,7 +35,7 @@ def parse_args(): activation_factory=ActivationFactoryConfig( sources=[ ActivationFactoryActivationsSource( - path=str(args.activation_path), + path=os.path.expanduser(args.activation_path), name="pythia-160m-2d", device="cuda", dtype=torch.float16, diff --git a/examples/generate_pythia_activation_1d.py b/examples/generate_pythia_activation_1d.py index 23e9acbc..e3dc0309 100644 --- a/examples/generate_pythia_activation_1d.py +++ b/examples/generate_pythia_activation_1d.py @@ -1,6 +1,5 @@ import argparse import os -from pathlib import Path import torch @@ -64,15 +63,15 @@ def parse_args(): dataset=DatasetConfig(dataset_name_or_path="Hzfinfdu/SlimPajama-3B"), dataset_name="SlimPajama-3B", hook_points=[f"blocks.{layer}.hook_resid_post" for layer in layers], - output_dir=Path(args.activation_path).expanduser(), + output_dir=os.path.expanduser(args.activation_path), total_tokens=800_000_000, context_size=2048, n_samples_per_chunk=None, - model_batch_size=int(32), + model_batch_size=32, num_workers=None, target=ActivationFactoryTarget.ACTIVATIONS_1D, - batch_size=int(2048 * 64), - buffer_size=int(2048 * 200), + batch_size=2048 * 64, + buffer_size=2048 * 200, buffer_shuffle=BufferShuffleConfig( perm_seed=42, generator_device="cuda", diff --git a/examples/generate_pythia_activation_2d.py b/examples/generate_pythia_activation_2d.py index cf115f1a..a12bbb99 100644 --- a/examples/generate_pythia_activation_2d.py +++ b/examples/generate_pythia_activation_2d.py @@ -1,6 +1,5 @@ import argparse import os -from pathlib import Path import torch @@ -64,7 +63,7 @@ def parse_args(): dataset=DatasetConfig(dataset_name_or_path="Hzfinfdu/SlimPajama-3B"), dataset_name="SlimPajama-3B", hook_points=[f"blocks.{layer}.hook_resid_post" for layer in layers], - output_dir=Path(args.activation_path).expanduser(), + output_dir=os.path.expanduser(args.activation_path), total_tokens=100_000_000, context_size=2048, model_batch_size=args.model_batch_size, From af5dc1874b4f3afde08ab7864622a364c65035b4 Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Wed, 31 Dec 2025 02:46:04 +0800 Subject: [PATCH 5/6] chore: make commitizen modify version in README --- README.md | 4 ++-- pyproject.toml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8ead733..f7d0d3c2 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ Use [pip](https://pypi.org/project/pip/) to install Language-Model-SAEs: ```bash -pip install lm-saes==2.0.0b4 +pip install lm-saes==2.0.0b5 ``` We also highly recommend using [uv](https://docs.astral.sh/uv/) to manage your own project dependencies. You can use ```bash -uv add lm-saes==2.0.0b4 +uv add lm-saes==2.0.0b5 ``` to add Language-Model-SAEs as your project dependency. diff --git a/pyproject.toml b/pyproject.toml index 9eaae6b9..ced69d7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -207,3 +207,7 @@ tag_format = "v$version" version_scheme = "pep440" version_provider = "uv" update_changelog_on_bump = true +version_files = [ + "README.md:pip install lm-saes=={version}", + "README.md:uv add lm-saes=={version}", +] \ No newline at end of file From 305791056f1aeda9668e71a15a0282d525932529 Mon Sep 17 00:00:00 2001 From: Xuyang Ge Date: Wed, 31 Dec 2025 03:06:52 +0800 Subject: [PATCH 6/6] fix(examples): add amp_dtype configuration --- examples/train_pythia_clt_topk.py | 1 + examples/train_pythia_lorsa_topk.py | 1 + examples/train_pythia_sae_batchtopk.py | 1 + examples/train_pythia_sae_jumprelu.py | 1 + examples/train_pythia_sae_topk.py | 1 + examples/train_pythia_sae_with_pre_generated_activations.py | 4 ++-- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/train_pythia_clt_topk.py b/examples/train_pythia_clt_topk.py index 76c2032c..02957400 100644 --- a/examples/train_pythia_clt_topk.py +++ b/examples/train_pythia_clt_topk.py @@ -36,6 +36,7 @@ init_encoder_with_decoder_transpose=False, ), trainer=TrainerConfig( + amp_dtype=torch.float32, initial_k=768 * 12 * 8 // 2, k_warmup_steps=1.0, k_schedule_type="exponential", diff --git a/examples/train_pythia_lorsa_topk.py b/examples/train_pythia_lorsa_topk.py index b6e4c788..c30696c0 100644 --- a/examples/train_pythia_lorsa_topk.py +++ b/examples/train_pythia_lorsa_topk.py @@ -47,6 +47,7 @@ encoder_uniform_bound=1 / math.sqrt(768 * 8), ), trainer=TrainerConfig( + amp_dtype=torch.float32, lr=2e-4, initial_k=64, k_warmup_steps=0.1, diff --git a/examples/train_pythia_sae_batchtopk.py b/examples/train_pythia_sae_batchtopk.py index 6a7d59a4..6646b85a 100644 --- a/examples/train_pythia_sae_batchtopk.py +++ b/examples/train_pythia_sae_batchtopk.py @@ -35,6 +35,7 @@ grid_search_init_norm=True, ), trainer=TrainerConfig( + amp_dtype=torch.float32, lr=1e-4, initial_k=50, k_warmup_steps=0.1, diff --git a/examples/train_pythia_sae_jumprelu.py b/examples/train_pythia_sae_jumprelu.py index 83252046..35bff6c8 100644 --- a/examples/train_pythia_sae_jumprelu.py +++ b/examples/train_pythia_sae_jumprelu.py @@ -37,6 +37,7 @@ init_log_jumprelu_threshold_value=math.log(0.1), ), trainer=TrainerConfig( + amp_dtype=torch.float32, lr=5e-5, l1_coefficient=0.3, total_training_tokens=800_000_000, diff --git a/examples/train_pythia_sae_topk.py b/examples/train_pythia_sae_topk.py index 296b579a..3d450cdf 100644 --- a/examples/train_pythia_sae_topk.py +++ b/examples/train_pythia_sae_topk.py @@ -35,6 +35,7 @@ grid_search_init_norm=True, ), trainer=TrainerConfig( + amp_dtype=torch.float32, lr=1e-4, initial_k=50, k_warmup_steps=0.1, diff --git a/examples/train_pythia_sae_with_pre_generated_activations.py b/examples/train_pythia_sae_with_pre_generated_activations.py index 167378a1..d3209982 100644 --- a/examples/train_pythia_sae_with_pre_generated_activations.py +++ b/examples/train_pythia_sae_with_pre_generated_activations.py @@ -1,7 +1,6 @@ import argparse import math import os -from pathlib import Path import torch @@ -56,6 +55,7 @@ def parse_args(): init_encoder_with_decoder_transpose_factor=1.0, ), trainer=TrainerConfig( + amp_dtype=torch.float32, lr=5e-5, l1_coefficient=0.3, total_training_tokens=800_000_000, @@ -74,7 +74,7 @@ def parse_args(): activation_factory=ActivationFactoryConfig( sources=[ ActivationFactoryActivationsSource( - path=str(Path(args.activation_path).expanduser()), + path=os.path.expanduser(args.activation_path), name="pythia-160m-1d", device="cuda", dtype=torch.float32,