nnsight 0.5.0.dev3__tar.gz → 0.5.0.dev5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/PKG-INFO +1 -1
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/_c/py_mount.c +14 -29
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/envoy.py +59 -2
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/base.py +5 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight.egg-info/PKG-INFO +1 -1
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/.github/workflows/publish.yml +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/.github/workflows/python-app.yml +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/.gitignore +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/CHANGELOG.md +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/CODE_OF_CONDUCT.md +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/LICENSE +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/NNsight_Walkthrough.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/NNsight_v0_3_guide.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/NNsight_v0_4_guide.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/README.md +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/conftest.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/Makefile +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/contributing.md +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/make.bat +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/requirements.txt +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/css/custom.css +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/css/home.css +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/css/pygments.css +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/css/status.css +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/execution.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/icon.ico +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/interleaved.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/ioi.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/nnsight_logo.svg +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/activation_patching.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/attribution_patching.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/dictionary_learning.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/function_vectors.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/future_lens.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/logit_lens.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/walkthrough.webp +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/js/.DS_Store +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/js/code.js +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/js/custom.js +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_templates/layout.html +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_templates/ndif_status.html +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/about.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/conf.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation/intervention.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation/modeling.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation/schema.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation/tracing.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation/util.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/documentation.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/features.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/index.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/conditionals.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/cross_prompt.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/custom_functions.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/early_stopping.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/editing_tutorial.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/getting.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/gradients.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/iterator.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/lora_training.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/model_editing.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/modules.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/multiple_token.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/operations.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/remote_execution.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/scan_validate.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/sessions.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/setting.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/streaming.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/vllm_support.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/LoRA_tutorial.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/activation_patching.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/attribution_patching.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/boundless_DAS.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/dict_learning.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/diffusion_lens.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/images/Activation_patching-figure1.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/images/LoRA_tutorial_figure_1.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/images/LoRA_tutorial_figure_2.png +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/logit_lens.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/start_remote_access.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/tutorial_price_tagging_utils.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/walkthrough.ipynb +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/pages/home.html +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/start.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/status.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/tutorials.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/conf.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/contexts.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/intervention.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/models.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/module.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/patching.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/tracing.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/documentation/util.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/sourcelatex/index.rst +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/pyproject.toml +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/pytest.ini +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/setup.cfg +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/setup.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/_c/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/config.yaml +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/backends/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/backends/base.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/backends/editing.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/backends/execution.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/backends/remote.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/batching.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/inject.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/interleaver.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/serialization.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/backwards.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/editing.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/globals.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/invoker.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/iterator.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/tracer.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/intervention/tracing/util.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/log.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/base.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/diffusion.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/language.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/mixins/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/mixins/loadable.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/mixins/meta.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/mixins/remoteable.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/model_runners/GPUModelRunner.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/model_runners/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/sampling.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/vllm.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/workers/GPUWorker.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/workers/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/schema/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/schema/config.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/schema/request.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/schema/response.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/util.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight.egg-info/SOURCES.txt +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight.egg-info/dependency_links.txt +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight.egg-info/requires.txt +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight.egg-info/top_level.txt +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/tests/__init__.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/tests/test_diffusion.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/tests/test_lm.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/tests/test_tiny.py +0 -0
- {nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/tests/test_vllm.py +0 -0
|
@@ -13,6 +13,15 @@ static MountedFunction* mounted_functions = NULL;
|
|
|
13
13
|
static int num_mounted_functions = 0;
|
|
14
14
|
static int mounted_functions_capacity = 0;
|
|
15
15
|
|
|
16
|
+
static PyObject* get_dict(PyTypeObject* type) {
|
|
17
|
+
#if PY_VERSION_HEX < 0x030C0000
|
|
18
|
+
PyObject* dict = type->tp_dict;
|
|
19
|
+
#else
|
|
20
|
+
PyObject* dict = PyType_GetDict(type);
|
|
21
|
+
#endif
|
|
22
|
+
return dict;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
// Function to mount a new function
|
|
17
26
|
static PyObject* mount_function(PyObject* self, PyObject* args) {
|
|
18
27
|
PyObject* func;
|
|
@@ -45,36 +54,11 @@ static PyObject* mount_function(PyObject* self, PyObject* args) {
|
|
|
45
54
|
mounted_functions[num_mounted_functions].func = func;
|
|
46
55
|
mounted_functions[num_mounted_functions].name = strdup(mount_point);
|
|
47
56
|
num_mounted_functions++;
|
|
48
|
-
|
|
49
|
-
// PyObject* modules = PyImport_GetModuleDict();
|
|
50
|
-
// PyObject* key, *value;
|
|
51
|
-
// Py_ssize_t pos = 0;
|
|
52
|
-
|
|
53
|
-
// while (PyDict_Next(modules, &pos, &key, &value)) {
|
|
54
|
-
// if (!PyModule_Check(value)) continue;
|
|
55
|
-
|
|
56
|
-
// PyObject* module_dict = PyModule_GetDict(value);
|
|
57
|
-
// if (!module_dict) continue;
|
|
58
|
-
|
|
59
|
-
// PyObject* item_key, *item_value;
|
|
60
|
-
// Py_ssize_t item_pos = 0;
|
|
61
|
-
// while (PyDict_Next(module_dict, &item_pos, &item_key, &item_value)) {
|
|
62
|
-
// if (PyType_Check(item_value)) {
|
|
63
|
-
// PyTypeObject* type = (PyTypeObject*)item_value;
|
|
64
|
-
|
|
65
|
-
// // Create an instance method
|
|
66
|
-
// PyObject* method = PyInstanceMethod_New(func);
|
|
67
|
-
// if (method) {
|
|
68
|
-
// PyDict_SetItemString(type->tp_dict, mount_point, method);
|
|
69
|
-
// Py_DECREF(method);
|
|
70
|
-
// PyType_Modified(type);
|
|
71
|
-
// }
|
|
72
|
-
// }
|
|
73
|
-
// }
|
|
74
|
-
// Mount only on the base object type
|
|
57
|
+
|
|
75
58
|
PyObject* method = PyInstanceMethod_New(func);
|
|
76
59
|
if (method) {
|
|
77
|
-
|
|
60
|
+
PyObject *dict = get_dict(&PyBaseObject_Type);
|
|
61
|
+
PyDict_SetItemString(dict, mount_point, method);
|
|
78
62
|
Py_DECREF(method);
|
|
79
63
|
PyType_Modified(&PyBaseObject_Type);
|
|
80
64
|
}
|
|
@@ -91,7 +75,8 @@ static PyObject* unmount_function(PyObject* self, PyObject* args) {
|
|
|
91
75
|
}
|
|
92
76
|
|
|
93
77
|
// Remove from base object type
|
|
94
|
-
|
|
78
|
+
PyObject *dict = get_dict(&PyBaseObject_Type);
|
|
79
|
+
PyDict_DelItemString(dict, mount_point);
|
|
95
80
|
PyType_Modified(&PyBaseObject_Type);
|
|
96
81
|
|
|
97
82
|
// Find and remove from our array
|
|
@@ -188,6 +188,7 @@ class Envoy(Batchable):
|
|
|
188
188
|
The module's input values as a tuple of positional and keyword arguments. i.e (args, kwargs)
|
|
189
189
|
|
|
190
190
|
"""
|
|
191
|
+
|
|
191
192
|
if self.interleaving:
|
|
192
193
|
return self._interleaver.current.request(
|
|
193
194
|
self._interleaver.current.iterate(f"{self.path}.input")
|
|
@@ -734,11 +735,60 @@ class Envoy(Batchable):
|
|
|
734
735
|
|
|
735
736
|
# If the module already has a sub-module named 'input' or 'output',
|
|
736
737
|
# mount the proxy access to 'nns_input' or 'nns_output instead.
|
|
738
|
+
|
|
737
739
|
if hasattr(Envoy, name):
|
|
738
740
|
self._handle_overloaded_mount(envoy, name)
|
|
739
741
|
else:
|
|
740
742
|
super().__setattr__(name, envoy)
|
|
741
743
|
|
|
744
|
+
def _handle_overloaded_mount(self, envoy: Envoy, mount_point: str) -> None:
|
|
745
|
+
"""If a given module already has an attribute of the same name as something nnsight wants to add, we need to rename it.
|
|
746
|
+
|
|
747
|
+
Directly edits the underlying class to accomplish this.
|
|
748
|
+
|
|
749
|
+
Args:
|
|
750
|
+
envoy (Envoy): Envoy to handle.
|
|
751
|
+
mount_point (str): Overloaded attribute name.
|
|
752
|
+
"""
|
|
753
|
+
|
|
754
|
+
warnings.warn(
|
|
755
|
+
f"Module `{self.path}` of type `{type(self._module)}` has pre-defined a `{mount_point}` attribute. nnsight access for `{mount_point}` will be mounted at `.nns_{mount_point}` instead of `.{mount_point}` for this module only."
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
# If we already shifted a mount point dont create another new class.
|
|
759
|
+
if "Preserved" in self.__class__.__name__:
|
|
760
|
+
|
|
761
|
+
new_cls = self.__class__
|
|
762
|
+
|
|
763
|
+
else:
|
|
764
|
+
|
|
765
|
+
new_cls = type(
|
|
766
|
+
f"{self.__class__.__name__}.Preserved",
|
|
767
|
+
(self.__class__,),
|
|
768
|
+
{},
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
self.__class__ = new_cls
|
|
772
|
+
|
|
773
|
+
# Get the normal proxy mount point
|
|
774
|
+
mount = getattr(Envoy, mount_point)
|
|
775
|
+
|
|
776
|
+
setattr(new_cls, f"nns_{mount_point}", mount)
|
|
777
|
+
|
|
778
|
+
if isinstance(mount, property):
|
|
779
|
+
|
|
780
|
+
mount = property(
|
|
781
|
+
lambda slf: slf.__dict__[mount_point],
|
|
782
|
+
mount.fset,
|
|
783
|
+
mount.fdel,
|
|
784
|
+
mount.__doc__,
|
|
785
|
+
)
|
|
786
|
+
|
|
787
|
+
setattr(new_cls, mount_point, mount)
|
|
788
|
+
|
|
789
|
+
# Move it to nns_<mount point>
|
|
790
|
+
self.__dict__[mount_point] = envoy
|
|
791
|
+
|
|
742
792
|
def _update(self, module: torch.nn.Module) -> None:
|
|
743
793
|
"""Updates the ._model attribute using a new model of the same architecture.
|
|
744
794
|
Used when loading the real weights (dispatching) and need to replace the underlying modules.
|
|
@@ -759,12 +809,19 @@ class Envoy(Batchable):
|
|
|
759
809
|
self._module.__path__ = self.path
|
|
760
810
|
|
|
761
811
|
if self._source is not None:
|
|
812
|
+
|
|
762
813
|
def wrap(fn: Callable, **kwargs):
|
|
763
814
|
|
|
764
|
-
bound_obj =
|
|
815
|
+
bound_obj = (
|
|
816
|
+
fn.__self__
|
|
817
|
+
if inspect.ismethod(fn) and fn.__name__ != "forward"
|
|
818
|
+
else None
|
|
819
|
+
)
|
|
765
820
|
|
|
766
821
|
if self.interleaving:
|
|
767
|
-
return self._interleaver.wrap_operation(
|
|
822
|
+
return self._interleaver.wrap_operation(
|
|
823
|
+
fn, **kwargs, bound_obj=bound_obj
|
|
824
|
+
)
|
|
768
825
|
else:
|
|
769
826
|
return fn
|
|
770
827
|
|
|
@@ -335,6 +335,9 @@ class Tracer:
|
|
|
335
335
|
|
|
336
336
|
if self.info is None:
|
|
337
337
|
self.capture()
|
|
338
|
+
|
|
339
|
+
if isinstance(self.info.node.body[0], ast.Pass):
|
|
340
|
+
return self
|
|
338
341
|
|
|
339
342
|
def skip(new_frame, event, arg):
|
|
340
343
|
"""
|
|
@@ -388,6 +391,8 @@ class Tracer:
|
|
|
388
391
|
|
|
389
392
|
return True
|
|
390
393
|
|
|
394
|
+
self.backend(self)
|
|
395
|
+
|
|
391
396
|
### Serialization ###
|
|
392
397
|
|
|
393
398
|
def __getstate__(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/function_vectors.webp
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/future_lens.webp
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/logit_lens.webp
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/_static/images/tutorials/walkthrough.webp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/custom_functions.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/early_stopping.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/editing_tutorial.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/lora_training.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/model_editing.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/multiple_token.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/remote_execution.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/features/scan_validate.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/LoRA_tutorial.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/activation_patching.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/attribution_patching.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/boundless_DAS.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/dict_learning.ipynb
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/diffusion_lens.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/docs/source/notebooks/tutorials/start_remote_access.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/model_runners/GPUModelRunner.py
RENAMED
|
File without changes
|
{nnsight-0.5.0.dev3 → nnsight-0.5.0.dev5}/src/nnsight/modeling/vllm/model_runners/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|