You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running into this error when trying to use a ml.p2.xlarge ec2 instance on aws for the Finetuning tutorial. It seems the tensors aren't automatically moved to the GPU.
RuntimeError Traceback (most recent call last)
<ipython-input-32-0bf1915c8e43> in <module>
----> 1 prediction = finder.get_answers(question=question, top_k_retriever=2, top_k_reader=5)
~/SageMaker/haystack/haystack/__init__.py in get_answers(self, question, top_k_reader, top_k_retriever, filters)
49 paragrahps=paragraphs,
50 meta_data_paragraphs=meta_data,
---> 51 top_k=top_k_reader)
52
53 return results
~/SageMaker/haystack/haystack/reader/farm.py in predict(self, question, paragrahps, meta_data_paragraphs, top_k, max_processes)
186 # get answers from QA model (Top 5 per input paragraph)
187 predictions = self.inferencer.inference_from_dicts(
--> 188 dicts=input_dicts, rest_api_schema=True, max_processes=max_processes
189 )
190
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/farm/infer.py in inference_from_dicts(self, dicts, rest_api_schema, max_processes)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/farm/infer.py in _get_predictions(self, dataset, tensor_names, baskets, rest_api_schema)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/farm/modeling/adaptive_model.py in forward(self, **kwargs)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/farm/modeling/language_model.py in forward(self, input_ids, padding_mask, **kwargs)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/transformers/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds)
481
482 if inputs_embeds is None:
--> 483 inputs_embeds = self.embeddings(input_ids) # (bs, seq_length, dim)
484 tfmr_output = self.transformer(x=inputs_embeds, attn_mask=attention_mask, head_mask=head_mask)
485 hidden_state = tfmr_output[0]
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/transformers/modeling_distilbert.py in forward(self, input_ids)
87 position_ids = position_ids.unsqueeze(0).expand_as(input_ids) # (bs, max_seq_length)
88
---> 89 word_embeddings = self.word_embeddings(input_ids) # (bs, max_seq_length, dim)
90 position_embeddings = self.position_embeddings(position_ids) # (bs, max_seq_length, dim)
91
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/modules/sparse.py in forward(self, input)
112 return F.embedding(
113 input, self.weight, self.padding_idx, self.max_norm,
--> 114 self.norm_type, self.scale_grad_by_freq, self.sparse)
115
116 def extra_repr(self):
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/torch/nn/functional.py in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
1482 # remove once script supports set_grad_enabled
1483 _no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
-> 1484 return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
1485
1486
RuntimeError: Expected object of device type cuda but got device type cpu for argument #3 'index' in call to _th_index_select
The text was updated successfully, but these errors were encountered:
Running into this error when trying to use a ml.p2.xlarge ec2 instance on aws for the Finetuning tutorial. It seems the tensors aren't automatically moved to the GPU.
The text was updated successfully, but these errors were encountered: