Huggingface model inference issue
I'm trying to use my pre-trained huggingface model to predict.
outputs = model(
ids,
mask,
token_type_ids
)
outputs = torch.sigmoid(outputs).cpu().detach().numpy()
return outputs[0][0]
The error I got is
TypeError: sigmoid(): argument 'input' (position 1) must be Tensor, not BaseModelOutputWithPoolingAndCrossAttentions
What I want is
[{'label': 'POSITIVE', 'score': 0.9998743534088135},
{'label': 'NEGATIVE', 'score': 0开发者_高级运维.9996669292449951}]
Thanks ahead!!!
精彩评论