nnsight 0.5.0.dev2__tar.gz → 0.5.0.dev4__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.
Files changed (156) hide show
  1. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/PKG-INFO +1 -1
  2. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/_c/py_mount.c +14 -29
  3. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/envoy.py +4 -1
  4. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/interleaver.py +3 -1
  5. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/base.py +5 -0
  6. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/tracer.py +2 -1
  7. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight.egg-info/PKG-INFO +1 -1
  8. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/.github/workflows/publish.yml +0 -0
  9. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/.github/workflows/python-app.yml +0 -0
  10. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/.gitignore +0 -0
  11. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/CHANGELOG.md +0 -0
  12. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/CODE_OF_CONDUCT.md +0 -0
  13. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/LICENSE +0 -0
  14. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/NNsight_Walkthrough.ipynb +0 -0
  15. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/NNsight_v0_3_guide.ipynb +0 -0
  16. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/NNsight_v0_4_guide.ipynb +0 -0
  17. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/README.md +0 -0
  18. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/conftest.py +0 -0
  19. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/.DS_Store +0 -0
  20. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/Makefile +0 -0
  21. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/contributing.md +0 -0
  22. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/make.bat +0 -0
  23. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/requirements.txt +0 -0
  24. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/.DS_Store +0 -0
  25. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/.DS_Store +0 -0
  26. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/css/custom.css +0 -0
  27. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/css/home.css +0 -0
  28. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/css/pygments.css +0 -0
  29. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/css/status.css +0 -0
  30. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/.DS_Store +0 -0
  31. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/execution.png +0 -0
  32. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/icon.ico +0 -0
  33. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/interleaved.png +0 -0
  34. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/ioi.png +0 -0
  35. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/nnsight_logo.svg +0 -0
  36. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/.DS_Store +0 -0
  37. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/activation_patching.webp +0 -0
  38. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/attribution_patching.webp +0 -0
  39. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/dictionary_learning.webp +0 -0
  40. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/function_vectors.webp +0 -0
  41. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/future_lens.webp +0 -0
  42. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/logit_lens.webp +0 -0
  43. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/images/tutorials/walkthrough.webp +0 -0
  44. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/js/.DS_Store +0 -0
  45. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/js/code.js +0 -0
  46. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_static/js/custom.js +0 -0
  47. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_templates/layout.html +0 -0
  48. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/_templates/ndif_status.html +0 -0
  49. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/about.rst +0 -0
  50. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/conf.py +0 -0
  51. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation/intervention.rst +0 -0
  52. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation/modeling.rst +0 -0
  53. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation/schema.rst +0 -0
  54. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation/tracing.rst +0 -0
  55. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation/util.rst +0 -0
  56. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/documentation.rst +0 -0
  57. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/features.rst +0 -0
  58. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/index.rst +0 -0
  59. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/conditionals.ipynb +0 -0
  60. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/cross_prompt.ipynb +0 -0
  61. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/custom_functions.ipynb +0 -0
  62. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/early_stopping.ipynb +0 -0
  63. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/editing_tutorial.ipynb +0 -0
  64. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/getting.ipynb +0 -0
  65. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/gradients.ipynb +0 -0
  66. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/iterator.ipynb +0 -0
  67. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/lora_training.ipynb +0 -0
  68. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/model_editing.ipynb +0 -0
  69. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/modules.ipynb +0 -0
  70. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/multiple_token.ipynb +0 -0
  71. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/operations.ipynb +0 -0
  72. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/remote_execution.ipynb +0 -0
  73. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/scan_validate.ipynb +0 -0
  74. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/sessions.ipynb +0 -0
  75. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/setting.ipynb +0 -0
  76. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/streaming.ipynb +0 -0
  77. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/features/vllm_support.ipynb +0 -0
  78. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/LoRA_tutorial.ipynb +0 -0
  79. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/activation_patching.ipynb +0 -0
  80. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/attribution_patching.ipynb +0 -0
  81. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/boundless_DAS.ipynb +0 -0
  82. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/dict_learning.ipynb +0 -0
  83. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/diffusion_lens.ipynb +0 -0
  84. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/images/Activation_patching-figure1.png +0 -0
  85. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/images/LoRA_tutorial_figure_1.png +0 -0
  86. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/images/LoRA_tutorial_figure_2.png +0 -0
  87. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/logit_lens.ipynb +0 -0
  88. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/start_remote_access.ipynb +0 -0
  89. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/tutorial_price_tagging_utils.py +0 -0
  90. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/notebooks/tutorials/walkthrough.ipynb +0 -0
  91. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/pages/home.html +0 -0
  92. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/start.rst +0 -0
  93. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/status.rst +0 -0
  94. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/source/tutorials.rst +0 -0
  95. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/conf.py +0 -0
  96. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/contexts.rst +0 -0
  97. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/intervention.rst +0 -0
  98. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/models.rst +0 -0
  99. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/module.rst +0 -0
  100. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/patching.rst +0 -0
  101. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/tracing.rst +0 -0
  102. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/documentation/util.rst +0 -0
  103. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/docs/sourcelatex/index.rst +0 -0
  104. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/pyproject.toml +0 -0
  105. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/pytest.ini +0 -0
  106. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/setup.cfg +0 -0
  107. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/setup.py +0 -0
  108. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/__init__.py +0 -0
  109. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/_c/__init__.py +0 -0
  110. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/config.yaml +0 -0
  111. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/__init__.py +0 -0
  112. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/backends/__init__.py +0 -0
  113. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/backends/base.py +0 -0
  114. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/backends/editing.py +0 -0
  115. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/backends/execution.py +0 -0
  116. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/backends/remote.py +0 -0
  117. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/batching.py +0 -0
  118. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/inject.py +0 -0
  119. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/serialization.py +0 -0
  120. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/__init__.py +0 -0
  121. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/backwards.py +0 -0
  122. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/editing.py +0 -0
  123. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/globals.py +0 -0
  124. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/invoker.py +0 -0
  125. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/iterator.py +0 -0
  126. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/intervention/tracing/util.py +0 -0
  127. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/log.py +0 -0
  128. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/__init__.py +0 -0
  129. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/base.py +0 -0
  130. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/diffusion.py +0 -0
  131. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/language.py +0 -0
  132. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/mixins/__init__.py +0 -0
  133. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/mixins/loadable.py +0 -0
  134. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/mixins/meta.py +0 -0
  135. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/mixins/remoteable.py +0 -0
  136. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/__init__.py +0 -0
  137. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/model_runners/GPUModelRunner.py +0 -0
  138. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/model_runners/__init__.py +0 -0
  139. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/sampling.py +0 -0
  140. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/vllm.py +0 -0
  141. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/workers/GPUWorker.py +0 -0
  142. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/modeling/vllm/workers/__init__.py +0 -0
  143. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/schema/__init__.py +0 -0
  144. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/schema/config.py +0 -0
  145. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/schema/request.py +0 -0
  146. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/schema/response.py +0 -0
  147. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight/util.py +0 -0
  148. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight.egg-info/SOURCES.txt +0 -0
  149. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight.egg-info/dependency_links.txt +0 -0
  150. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight.egg-info/requires.txt +0 -0
  151. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/src/nnsight.egg-info/top_level.txt +0 -0
  152. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/tests/__init__.py +0 -0
  153. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/tests/test_diffusion.py +0 -0
  154. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/tests/test_lm.py +0 -0
  155. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/tests/test_tiny.py +0 -0
  156. {nnsight-0.5.0.dev2 → nnsight-0.5.0.dev4}/tests/test_vllm.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nnsight
3
- Version: 0.5.0.dev2
3
+ Version: 0.5.0.dev4
4
4
  Summary: Package for interpreting and manipulating the internals of deep learning models.
5
5
  Author-email: Jaden Fiotto-Kaufman <jadenfk@outlook.com>
6
6
  License: MIT License
@@ -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
- // Inject into all currently loaded types
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
- PyDict_SetItemString(PyBaseObject_Type.tp_dict, mount_point, method);
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
- PyDict_DelItemString(PyBaseObject_Type.tp_dict, mount_point);
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
@@ -1023,6 +1023,7 @@ class OperationEnvoy:
1023
1023
  self._interleaver = interleaver
1024
1024
 
1025
1025
  self._source: EnvoySource = None
1026
+ self._fn: Callable = None
1026
1027
 
1027
1028
  def __str__(self):
1028
1029
  """
@@ -1186,7 +1187,9 @@ class OperationEnvoy:
1186
1187
  self.name, source, line_numbers, interleaver=self._interleaver
1187
1188
  )
1188
1189
 
1189
- self._interleaver.current.swap(f"{self.name}.fn", fn)
1190
+ self._fn = fn
1191
+
1192
+ self._interleaver.current.swap(f"{self.name}.fn", self._fn)
1190
1193
 
1191
1194
  return self._source
1192
1195
 
@@ -223,9 +223,11 @@ class Interleaver:
223
223
  Returns:
224
224
  A wrapped version of the backward method
225
225
  """
226
- from .tracing.backwards import BackwardsTracer
226
+
227
227
 
228
228
  def inner(tensor: torch.Tensor, *args, **kwargs):
229
+
230
+ from .tracing.backwards import BackwardsTracer
229
231
 
230
232
  try:
231
233
 
@@ -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):
@@ -419,8 +419,9 @@ class InterleavingTracer(Tracer):
419
419
  """Set the state of the tracer for deserialization."""
420
420
  super().__setstate__(state)
421
421
 
422
- self.fn = state["fn"]
422
+
423
423
  self.model = state["model"]
424
+ self.fn = getattr(self.model, state["fn"])
424
425
  self.tracer_var_name = state["tracer_var_name"]
425
426
  self.mediators = state["mediators"]
426
427
  self.batcher = state["batcher"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nnsight
3
- Version: 0.5.0.dev2
3
+ Version: 0.5.0.dev4
4
4
  Summary: Package for interpreting and manipulating the internals of deep learning models.
5
5
  Author-email: Jaden Fiotto-Kaufman <jadenfk@outlook.com>
6
6
  License: MIT License
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