yuh-zha / AlignScore

ACL2023 - AlignScore, a metric for factual consistency evaluation.
https://arxiv.org/pdf/2305.16739.pdf
MIT License
104 stars 17 forks source link

Warning when load model to CPU #5

Closed liugz18 closed 1 year ago

liugz18 commented 1 year ago

Hii Dear authors, I'd like to thank you all for this super awesome work! AlignScore has helped a lot as an efficient and economic hallucination detector in my internship work, in which I tested it on our internal datasets and it does a great job!!!

Though I did want to ask why I'm getting this warning every time when I load the model to CPU, is this normal?

Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.dense.weight', 'lm_head.layer_norm.bias', 'lm_head.dense.bias', 'lm_head.bias', 'lm_head.layer_norm.weight']
- This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of RobertaModel were not initialized from the model checkpoint at roberta-base and are newly initialized: ['roberta.pooler.dense.weight', 'roberta.pooler.dense.bias']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

FYI, I'm using the below code for model init:

    ckpt_path = 'https://huggingface.co/yzha/AlignScore/resolve/main/AlignScore-base.ckpt'

    scorer = AlignScore(model='roberta-base', batch_size=1, chunk_size=chunk_size,
                        device='cpu', ckpt_path=ckpt_path, evaluation_mode='nli_sp')

Though I'm getting this warning each time, the inference itself seems to work very well in detection, Could you please share more information about why this is showing up?

Thanks a lot and again much appreciated for the well developed repo and this awesome contribution!

yuh-zha commented 1 year ago

Hi,

Thank you for using our metric! The above warning message came from the huggingface model loading part. We modified the original RoBERTa structure to fit into the framework. Therefore, it's normal. You can just ignore it.