ChenRocks / ChenRocks/Distill-BERT-Textgen
Error when extracting top-k logits
- Dominant language
- Python
- Stars
- 128
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for the awesome work on BERT for Text Generation. But I am facing the following problem when trying to extract topk logits
```python dump_teacher_topk.py --bert_hidden /home/aniruddha/aniruddha-raid/pretam/Distill-BERT-Textgen/data/dump/english computing topk...: 0%| | 0/160239 [00:00
main(args)
File "dump_teacher_topk.py", line 42, in main
topk = linear(bert_hidden).topk(dim=-1, k=opts.topk)
File "/home/aniruddha/anaconda3/envs/bert-textgen/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/aniruddha/anaconda3/envs/bert-textgen/lib/python3.6/site-packages/torch/nn/modules/linear.py", line 93, in forward
return F.linear(input, self.weight, self.bias)
File "/home/aniruddha/anaconda3/envs/bert-textgen/lib/python3.6/site-packages/torch/nn/functional.py", line 1690, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: expected scalar type Float but found Half
```
The C-MLM fine-tuning went fine without any errors, and also the task of extracting logits from teacher hidden states. I have switched off the fp16 flag so as not to get the above error, but still getting it. How to mitigate the issue?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.