We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7ed4ae commit 8b6e2b5Copy full SHA for 8b6e2b5
gbmi/utils/hashing.py
@@ -27,6 +27,7 @@
27
28
import numpy
29
import torch
30
+import transformer_lens
31
from transformer_lens import HookedTransformer
32
33
# Implemented for https://github.com/lemon24/reader/issues/179
@@ -149,6 +150,16 @@ def _json_default(
149
150
exclude_filter=exclude_filter,
151
dictify_by_default=dictify_by_default,
152
)
153
+ elif isinstance(thing, torch.nn.Module):
154
+ return _json_dumps(
155
+ {
156
+ "type": type(thing),
157
+ "repr": repr(thing),
158
+ "module.parameters": list(thing.parameters()),
159
+ },
160
+ exclude_filter=exclude_filter,
161
+ dictify_by_default=dictify_by_default,
162
+ )
163
elif isinstance(thing, type):
164
return f"{thing.__module__}.{thing.__name__}"
165
elif (
0 commit comments