-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] KeyError: 2670675173184. #293
Comments
Hi @OliverZar, can you tell me a bit more about your model so I can narrow down the issue? What kinds of layers does it contain? |
These are the layers of my model. It has ReLU activations. Model: "model_7" Layer (type) Output Shape Param #input_1 (InputLayer) [(None, 224, 224, 3)] 0 conv1 (Conv2D) (None, 112, 112, 32) 864 conv1_bn (BatchNormalizatio (None, 112, 112, 32) 128 conv1_relu (ReLU) (None, 112, 112, 32) 0 conv_dw_1 (DepthwiseConv2D) (None, 112, 112, 32) 288 conv_dw_1_bn (BatchNormaliz (None, 112, 112, 32) 128 conv_dw_1_relu (ReLU) (None, 112, 112, 32) 0 conv_pw_1 (Conv2D) (None, 112, 112, 64) 2048 conv_pw_1_bn (BatchNormaliz (None, 112, 112, 64) 256 flatten (Flatten) (None, 802816) 0 fc1 (Dense) (None, 128) 102760576 dropout_40 (Dropout) (None, 128) 0 fc2 (Dense) (None, 128) 16512 dropout_41 (Dropout) (None, 128) 0 fc3 (Dense) (None, 128) 16512 dropout_42 (Dropout) (None, 128) 0 fc4 (Dense) (None, 128) 16512 dropout_43 (Dropout) (None, 128) 0 output (Dense) (None, 3) 387 |
Did you use This could be related to #292 due to the use of |
Describe the bug
I have a problem with certain architectures, that when I try to create 2 parsers, it gives me this error, and only in some cases, when I restart the jupyter server, it allows me to run them. I get this error: KeyError: 2670675173184.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
KeyError Traceback (most recent call last)
Input In [7], in <cell line: 2>()
1 analyzer = innvestigate.create_analyzer("deep_taylor", model_wo_sm)
----> 2 a = analyzer.analyze(xt)
4 # Aggregate along color channels and normalize to [-1, 1]
5 a = a.sum(axis=np.argmax(np.asarray(a.shape) == 3))
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\analyzer\network_base.py:250, in AnalyzerNetworkBase.analyze(self, X, neuron_selection)
247 # TODO: what does should mean in docstring?
249 if self._analyzer_model_done is False:
--> 250 self.create_analyzer_model()
252 if neuron_selection is not None and self._neuron_selection_mode != "index":
253 raise ValueError(
254 f"neuron_selection_mode {self._neuron_selection_mode} doesn't support ",
255 "'neuron_selection' parameter.",
256 )
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\analyzer\network_base.py:164, in AnalyzerNetworkBase.create_analyzer_model(self)
161 self._analysis_inputs = analysis_inputs
162 self._prepared_model = model
--> 164 tmp = self._create_analysis(
165 model, stop_analysis_at_tensors=stop_analysis_at_tensors
166 )
167 if isinstance(tmp, tuple):
168 if len(tmp) == 3:
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\analyzer\deeptaylor.py:134, in DeepTaylor._create_analysis(self, *args, **kwargs)
110 # Layers w/o transformation
111 self._add_conditional_reverse_mapping(
112 lambda l: isinstance(
113 l,
(...)
131 name="deep_taylor_no_transform",
132 )
--> 134 return super()._create_analysis(*args, **kwargs)
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\analyzer\reverse_base.py:269, in ReverseAnalyzerBase._create_analysis(self, model, stop_analysis_at_tensors)
261 return_all_reversed_tensors = (
262 self._reverse_check_min_max_values
263 or self._reverse_check_finite
264 or self._reverse_keep_tensors
265 )
267 # if return_all_reversed_tensors is False,
268 # reversed_tensors will be None
--> 269 reversed_input_tensors, reversed_tensors = self._reverse_model(
270 model,
271 stop_analysis_at_tensors=stop_analysis_at_tensors,
272 return_all_reversed_tensors=return_all_reversed_tensors,
273 )
274 ret = self._postprocess_analysis(reversed_input_tensors)
276 if return_all_reversed_tensors:
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\analyzer\reverse_base.py:242, in ReverseAnalyzerBase._reverse_model(self, model, stop_analysis_at_tensors, return_all_reversed_tensors)
239 if stop_analysis_at_tensors is None:
240 stop_analysis_at_tensors = []
--> 242 return igraph.reverse_model(
243 model,
244 reverse_mappings=self._reverse_mapping,
245 default_reverse_mapping=self._default_reverse_mapping,
246 head_mapping=self._head_mapping,
247 stop_mapping_at_tensors=stop_analysis_at_tensors,
248 verbose=self._reverse_verbose,
249 clip_all_reversed_tensors=self._reverse_clip_values,
250 project_bottleneck_tensors=self._reverse_project_bottleneck_layers,
251 return_all_reversed_tensors=return_all_reversed_tensors,
252 )
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\backend\graph.py:1252, in reverse_model(model, reverse_mappings, default_reverse_mapping, head_mapping, stop_mapping_at_tensors, verbose, return_all_reversed_tensors, clip_all_reversed_tensors, project_bottleneck_tensors, execution_trace, reapply_on_copied_layers)
1249 add_reversed_tensors(nid, Xs, reversed_Xs)
1251 # Return requested values
-> 1252 reversed_input_tensors = [
1253 get_reversed_tensor(tmp)
1254 for tmp in model.inputs
1255 if id(tmp) not in stop_mapping_at_ids
1256 ]
1257 if return_all_reversed_tensors is True:
1258 return reversed_input_tensors, reversed_tensors
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\backend\graph.py:1253, in (.0)
1249 add_reversed_tensors(nid, Xs, reversed_Xs)
1251 # Return requested values
1252 reversed_input_tensors = [
-> 1253 get_reversed_tensor(tmp)
1254 for tmp in model.inputs
1255 if id(tmp) not in stop_mapping_at_ids
1256 ]
1257 if return_all_reversed_tensors is True:
1258 return reversed_input_tensors, reversed_tensors
File C:\ProgramData\Anaconda3\envs\TestNweEntorno\lib\site-packages\innvestigate\backend\graph.py:1104, in reverse_model..get_reversed_tensor(tensor)
1102 def get_reversed_tensor(tensor: Tensor) -> Tensor:
1103 tmp: ReverseTensorDict
-> 1104 tmp = reversed_tensors[id(tensor)]
1106 if tmp["final_tensor"] is None:
1107 if len(tmp["tensors"]) == 1:
KeyError: 2670675173184
Platform information
The text was updated successfully, but these errors were encountered: