开发者

Huggingface model inference issue

开发者 https://www.devze.com 2022-12-07 20:21 出处:网络
I\'m trying to use my pre-trained huggingface model to predict. outputs = model( ids, mask, token_type_ids

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!!!

0

精彩评论

暂无评论...
验证码 换一张
取 消