nnsight 0.5.0.dev14__tar.gz → 0.5.0.dev15__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 (74) hide show
  1. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/PKG-INFO +1 -1
  2. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/backends/remote.py +13 -6
  3. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/envoy.py +5 -3
  4. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/inject.py +6 -3
  5. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/tracer.py +4 -2
  6. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight.egg-info/PKG-INFO +1 -1
  7. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/.github/workflows/publish.yml +0 -0
  8. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/.github/workflows/python-app.yml +0 -0
  9. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/.gitignore +0 -0
  10. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/CHANGELOG.md +0 -0
  11. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/CODE_OF_CONDUCT.md +0 -0
  12. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/LICENSE +0 -0
  13. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/NNsight_Walkthrough.ipynb +0 -0
  14. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/NNsight_v0_3_guide.ipynb +0 -0
  15. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/NNsight_v0_4_guide.ipynb +0 -0
  16. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/README.md +0 -0
  17. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/conftest.py +0 -0
  18. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/pyproject.toml +0 -0
  19. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/pytest.ini +0 -0
  20. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/setup.cfg +0 -0
  21. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/setup.py +0 -0
  22. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/__init__.py +0 -0
  23. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/_c/__init__.py +0 -0
  24. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/_c/py_mount.c +0 -0
  25. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/config.yaml +0 -0
  26. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/__init__.py +0 -0
  27. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/backends/__init__.py +0 -0
  28. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/backends/base.py +0 -0
  29. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/backends/editing.py +0 -0
  30. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/backends/execution.py +0 -0
  31. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/batching.py +0 -0
  32. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/interleaver.py +0 -0
  33. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/serialization.py +0 -0
  34. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/__init__.py +0 -0
  35. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/backwards.py +0 -0
  36. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/base.py +0 -0
  37. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/editing.py +0 -0
  38. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/globals.py +0 -0
  39. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/invoker.py +0 -0
  40. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/iterator.py +0 -0
  41. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/intervention/tracing/util.py +0 -0
  42. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/log.py +0 -0
  43. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/__init__.py +0 -0
  44. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/base.py +0 -0
  45. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/diffusion.py +0 -0
  46. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/language.py +0 -0
  47. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/mixins/__init__.py +0 -0
  48. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/mixins/loadable.py +0 -0
  49. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/mixins/meta.py +0 -0
  50. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/mixins/remoteable.py +0 -0
  51. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/__init__.py +0 -0
  52. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/model_runners/GPUModelRunner copy.py +0 -0
  53. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/model_runners/GPUModelRunner.py +0 -0
  54. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/model_runners/__init__.py +0 -0
  55. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/sampling copy.py +0 -0
  56. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/sampling.py +0 -0
  57. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/vllm.py +0 -0
  58. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/workers/GPUWorker.py +0 -0
  59. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/workers/__init__.py +0 -0
  60. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/modeling/vllm/workers/gpu_input_batch.py +0 -0
  61. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/schema/__init__.py +0 -0
  62. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/schema/config.py +0 -0
  63. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/schema/request.py +0 -0
  64. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/schema/response.py +0 -0
  65. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight/util.py +0 -0
  66. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight.egg-info/SOURCES.txt +0 -0
  67. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight.egg-info/dependency_links.txt +0 -0
  68. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight.egg-info/requires.txt +0 -0
  69. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/src/nnsight.egg-info/top_level.txt +0 -0
  70. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/tests/__init__.py +0 -0
  71. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/tests/test_diffusion.py +0 -0
  72. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/tests/test_lm.py +0 -0
  73. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/tests/test_tiny.py +0 -0
  74. {nnsight-0.5.0.dev14 → nnsight-0.5.0.dev15}/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.dev14
3
+ Version: 0.5.0.dev15
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
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import inspect
4
4
  import io
5
- import sys
5
+ import os
6
6
  import time
7
7
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple
8
8
 
@@ -46,17 +46,20 @@ class RemoteBackend(Backend):
46
46
  ) -> None:
47
47
 
48
48
  self.model_key = model_key
49
+
50
+ self.host = host or os.environ.get("NDIF_HOST", None) or CONFIG.API.HOST
51
+ self.api_key = api_key or os.environ.get("NDIF_API_KEY", None) or CONFIG.API.APIKEY
49
52
 
50
53
  self.job_id = job_id or CONFIG.API.JOB_ID
51
54
  self.ssl = CONFIG.API.SSL if ssl is None else ssl
52
55
  self.zlib = CONFIG.API.ZLIB
53
- self.api_key = api_key or CONFIG.API.APIKEY
54
56
  self.blocking = blocking
55
57
  self.callback = callback
56
-
57
- self.host = host or CONFIG.API.HOST
58
+
58
59
  self.address = f"http{'s' if self.ssl else ''}://{self.host}"
59
60
  self.ws_address = f"ws{'s' if CONFIG.API.SSL else ''}://{self.host}"
61
+
62
+ self.job_status = None
60
63
 
61
64
  def request(self, tracer: Tracer) -> Tuple[bytes, Dict[str, str]]:
62
65
 
@@ -77,7 +80,7 @@ class RemoteBackend(Backend):
77
80
 
78
81
  return data, headers
79
82
 
80
- def __call__(self, tracer):
83
+ def __call__(self, tracer = None):
81
84
 
82
85
  if self.blocking:
83
86
 
@@ -89,8 +92,10 @@ class RemoteBackend(Backend):
89
92
  # Otherwise we are getting the status / result of the existing job.
90
93
  result = self.non_blocking_request(tracer)
91
94
 
92
- if result is not None:
95
+ if tracer is not None and result is not None:
93
96
  tracer.push(result)
97
+
98
+ return result
94
99
 
95
100
  def handle_response(
96
101
  self, response: ResponseModel, tracer: Optional[Tracer] = None
@@ -112,6 +117,8 @@ class RemoteBackend(Backend):
112
117
  ResponseModel: ResponseModel.
113
118
  """
114
119
 
120
+ self.job_status = response.status
121
+
115
122
  if response.status == ResponseModel.JobStatus.ERROR:
116
123
  raise RemoteException(f"{response.description}\nRemote exception.")
117
124
 
@@ -868,10 +868,12 @@ class Envoy(Batchable):
868
868
  """
869
869
  Update the alias for this Envoy and its children.
870
870
  """
871
- self._alias = alias
871
+ if alias is not None:
872
+ self._alias = Aliaser(alias)
873
+ self._alias.build(self)
872
874
 
873
- for envoy in self._children:
874
- envoy._update_alias(alias)
875
+ for envoy in self._children:
876
+ envoy._update_alias(alias)
875
877
 
876
878
 
877
879
 
@@ -1,9 +1,12 @@
1
1
  import ast
2
- import astor
3
- import textwrap
4
- from typing import Callable
5
2
  import inspect
3
+ import textwrap
4
+ from builtins import compile, exec
6
5
  from collections import defaultdict
6
+ from typing import Callable
7
+
8
+ import astor
9
+
7
10
 
8
11
  class FunctionCallWrapper(ast.NodeTransformer):
9
12
 
@@ -460,11 +460,12 @@ class InterleavingTracer(Tracer):
460
460
  def __getstate__(self):
461
461
  """Get the state of the tracer for serialization."""
462
462
  state = super().__getstate__()
463
- state["fn"] = self.fn.__name__
463
+ state["fn"] = self.fn if isinstance(self.fn, str) else self.fn.__name__
464
464
  state["model"] = self.model
465
465
  state["tracer_var_name"] = self.tracer_var_name
466
466
  state["batcher"] = self.batcher
467
467
  state["mediators"] = self.mediators
468
+ state["rename"] = self.model._alias.rename if self.model._alias is not None else None
468
469
 
469
470
  return state
470
471
 
@@ -478,7 +479,8 @@ class InterleavingTracer(Tracer):
478
479
  self.tracer_var_name = state["tracer_var_name"]
479
480
  self.mediators = state["mediators"]
480
481
  self.batcher = state["batcher"]
481
-
482
+ if state["rename"] is not None:
483
+ self.model._update_alias(state["rename"])
482
484
  self.obj_var_name = None
483
485
  self.user_cache = list()
484
486
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nnsight
3
- Version: 0.5.0.dev14
3
+ Version: 0.5.0.dev15
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