Output Score

#7
by mosama - opened

I believe the output score is obtained by global max pooling right? Can we have the score normalized between 0 and 1. That would really help a lot.

Beijing Academy of Artificial Intelligence org

The score is computed via a linear layer over the last hidden state of CLS. You can use a sigmoid function to normalize the score: https://pytorch.org/docs/stable/generated/torch.sigmoid.html

+1呀,如果没有阈值的话,真的很难确定到底有没有匹配到相关的文档,不然把所有并不相关片段都扔给GPT也不合理。

Hi @mosama and @lldxhm hope the below code helps

import torch
probabilities = torch.softmax(scores, dim=0)

I'm using

import torch
probabilities = torch.tanh(torch.tensor(scores))

and check if its greater than zero

Sign up or log in to comment