lholten / dialogpt-mmi-decoder Goto Github PK
View Code? Open in Web Editor NEWMMI decoder for DialoGPT and discord bot
License: MIT License
MMI decoder for DialoGPT and discord bot
License: MIT License
Hi,
Thank you very much for this great work. Could you share your running environment(python version / pip list)? With Python3.7 and PyTorch 1.3.1 for Cuda 10.1 I got the runtime error
usr >> hello
Traceback (most recent call last):
File "interact.py", line 116, in <module>
my_response = generate_message(my_message_list)
File "interact.py", line 98, in generate_message
result = _get_response(total_input[:, -1:], past)
File "interact.py", line 47, in _get_response
output_token = torch.multinomial(F.softmax(output_token, dim=-1), num_samples=1)
RuntimeError: "multinomial_kernel_cuda" not implemented for 'Half'
I imagine this wouldn't happen if I use the same environment.
Thank you.
When I run interact.py, the process just waits for a long time and then gets killed. It just gets stuck at line 16.
Any idea why this could be happening?
I get this error when running interact.py:
usr >> Hi, how's it going?
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-54-e36819c98f47> in <module>()
4 my_message = input('usr >> ')
5 append_messages(my_message_list, [my_message])
----> 6 my_response = generate_message(my_message_list)
7 print('bot >>', my_response)
8 append_messages(my_message_list, [my_response])
<ipython-input-39-b33e0e46d913> in generate_message(message_list, focus_last_message)
104 for i in range(num_samples):
105 result = _get_response(total_input[:, -1:], past)
--> 106 score = _score_response(result[0].to(device_r), total_input_reversed.to(device_r))
107 results.append(result + (score,))
108
<ipython-input-39-b33e0e46d913> in _score_response(output_token, correct_token)
67 labels = torch.cat((mask, correct_token), dim=1)
68
---> 69 loss, _, _ = reverse_model(inputs, labels=labels)
70
71 return -loss.float()
/usr/local/lib/python3.6/dist-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)
/usr/local/lib/python3.6/dist-packages/transformers/modeling_gpt2.py in forward(self, input_ids, past, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, labels)
610 # Flatten the tokens
611 loss_fct = CrossEntropyLoss()
--> 612 loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
613 outputs = (loss,) + outputs
614
/usr/local/lib/python3.6/dist-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)
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py in forward(self, input, target)
914 def forward(self, input, target):
915 return F.cross_entropy(input, target, weight=self.weight,
--> 916 ignore_index=self.ignore_index, reduction=self.reduction)
917
918
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction)
2019 if size_average is not None or reduce is not None:
2020 reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 2021 return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
2022
2023
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
1836 .format(input.size(0), target.size(0)))
1837 if dim == 2:
-> 1838 ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
1839 elif dim == 4:
1840 ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
IndexError: Target -1 is out of bounds.
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Name: torch
Version: 1.4.0
Name: transformers
Version: 2.8.0
I'm running this on a Google Colab notebook.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.