SwiftSyft
SwiftSyft copied to clipboard
Notebook for "Running the Demo App" fails
Description
Following the "Running the Demo App" description, I get the following error in the "01-Create-plan" notebook in execution cell 7:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-c3dd000bb342> in <module>
6 batch_size = th.tensor([3.0])
7
----> 8 _ = training_plan.build(X, y, batch_size, lr, model_params, trace_autograd=True)
PyGrid/venv/lib/python3.8/site-packages/syft/execution/plan.py in build(self, trace_autograd, *args)
271 framework_kwargs[f_name] = wrap_framework_func(self.role)
272
--> 273 results = self.forward(*args, **framework_kwargs)
274
275 # Register inputs in role
<ipython-input-6-fa8d649c2603> in training_plan(X, y, batch_size, lr, model_params)
5
6 # forward pass
----> 7 logits = model.forward(X)
8
9 # loss
<ipython-input-3-e527d4aba9da> in forward(self, x)
6
7 def forward(self, x):
----> 8 x = self.fc1(x)
9 x = nn.functional.relu(x)
10 x = self.fc2(x)
PyGrid/venv/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
PyGrid/venv/lib/python3.8/site-packages/torch/nn/modules/linear.py in forward(self, input)
89
90 def forward(self, input: Tensor) -> Tensor:
---> 91 return F.linear(input, self.weight, self.bias)
92
93 def extra_repr(self) -> str:
PyGrid/venv/lib/python3.8/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_func(*args, **kwargs)
333 handle_func_command = syft.framework.Tensor.handle_func_command
334
--> 335 response = handle_func_command(command)
336
337 return response
PyGrid/venv/lib/python3.8/site-packages/syft/frameworks/torch/tensors/interpreters/autograd.py in handle_func_command(cls, command)
292
293 if cmd is not None:
--> 294 return cmd(*args_, **kwargs_)
295
296 # Replace all AutogradTensor with their child attribute
PyGrid/venv/lib/python3.8/site-packages/syft/frameworks/torch/tensors/interpreters/autograd.py in linear(*args)
252 Un-hook the function to have its detailed behaviour
253 """
--> 254 return torch.nn.functional.native_linear(*args)
255
256 module.linear = linear
PyGrid/venv/lib/python3.8/site-packages/torch/nn/functional.py in linear(input, weight, bias)
1668 tens_ops = (input, weight)
1669 if not torch.jit.is_scripting():
-> 1670 if any([type(t) is not Tensor for t in tens_ops]) and has_torch_function(tens_ops):
1671 return handle_torch_function(linear, tens_ops, input, weight, bias=bias)
1672 if input.dim() == 2 and bias is not None:
PyGrid/venv/lib/python3.8/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_func(*args, **kwargs)
333 handle_func_command = syft.framework.Tensor.handle_func_command
334
--> 335 response = handle_func_command(command)
336
337 return response
PyGrid/venv/lib/python3.8/site-packages/syft/frameworks/torch/tensors/interpreters/autograd.py in handle_func_command(cls, command)
303
304 # Send it to the appropriate class and get the response
--> 305 response = new_type.handle_func_command(new_command)
306
307 # Put back AutogradTensor on the tensors found in the response
PyGrid/venv/lib/python3.8/site-packages/syft/execution/placeholder.py in handle_func_command(cls, command)
77 template_placeholder = arg
78
---> 79 placeholders = PlaceHolder.convert_to_placeholders(response, template_placeholder)
80
81 if template_placeholder.tracing:
PyGrid/venv/lib/python3.8/site-packages/syft/execution/placeholder.py in convert_to_placeholders(response, template_placeholder)
99 else:
100 placeholders = PlaceHolder.create_from(
--> 101 response, role=template_placeholder.role, tracing=template_placeholder.tracing
102 )
103
AttributeError: 'NoneType' object has no attribute 'role'
System Information
- OS: macOS 10.15.6
- Language Version: Python 3.8.5
- Package Manager Version: pip 20.1.1