PoliBERTweet
1.0.0
변압기 기반 언어 모델은 많은 양의 정치 관련 트위터 데이터 (83m 트윗)에 미리 훈련 된 언어 모델입니다. 이 repo는 다음 논문의 공식 자원입니다.
본 백서에 제시된 평가 작업의 데이터 세트는 아래에 있습니다.
모든 모델이 내 Huggingface에 업로드되어 있습니까? 따라서 3 줄의 코드 로 모델을로드 할 수 있습니다 !!!
우리는 pytorch v1.10.2 와 transformers v4.18.0 에서 테스트했습니다.
from transformers import AutoModel , AutoTokenizer , pipeline
import torch
# Choose GPU if available
device = torch . device ( "cuda" if torch . cuda . is_available () else "cpu" )
# Select mode path here
pretrained_LM_path = "kornosk/polibertweet-mlm"
# Load model
tokenizer = AutoTokenizer . from_pretrained ( pretrained_LM_path )
model = AutoModel . from_pretrained ( pretrained_LM_path ) # Fill mask
example = "Trump is the <mask> of USA"
fill_mask = pipeline ( 'fill-mask' , model = pretrained_LM_path , tokenizer = tokenizer )
outputs = fill_mask ( example )
print ( outputs ) # See embeddings
inputs = tokenizer ( example , return_tensors = "pt" )
outputs = model ( ** inputs )
print ( outputs )
# OR you can use this model to train on your downstream task!
# please consider citing our paper if you feel this is useful :)Huggingface Doc의 세부 사항을 참조하십시오.
우리의 종이와 자원이 유용하다고 생각되면, 우리의 작업을 인용하는 것을 고려하십시오!
@inproceedings { kawintiranon2022polibertweet ,
title = { {P}oli{BERT}weet: A Pre-trained Language Model for Analyzing Political Content on {T}witter } ,
author = { Kawintiranon, Kornraphop and Singh, Lisa } ,
booktitle = { Proceedings of the Language Resources and Evaluation Conference (LREC) } ,
year = { 2022 } ,
pages = { 7360--7367 } ,
publisher = { European Language Resources Association } ,
url = { https://aclanthology.org/2022.lrec-1.801 }
}모델이나 데이터 세트로드하는 데 문제가있는 경우 여기에 문제를 만듭니다.