prompting_hate_speech
1.0.0
이 저장소에는 존중하거나 독성이있는 종이 코드가 포함되어 있습니까? ACL 2023의 온라인 학대 및 해조 (WOAH)에 관한 7 차 워크숍에서 인정 된 증오심 표현을 감지하기 위해 언어 모델과의 제로 샷 학습을 사용합니다 .
Flor Miriam Plaza-Del-Arco • Debora Nozza • Dirk Hovy •
코드는 Huggingface에서 제공되므로 라이센스는 MIT 라이센스입니다.
모델의 경우 데이터 (기존 데이터 세트에서 파생 된) 또는 Twitter (기본 데이터 소스)에 제한이 적용될 수 있습니다. 우리는 사용자에게 각 데이터 세트 및 트위터 규정과 함께 제공되는 원래 라이센스를 참조합니다.
Encoder LMS를 사용하려면 encoder_lms
에서 prompting
모듈을 가져올 수 있습니다.
from encoder_lms import prompting
prompt_template = "This text is"
verb_h = "toxic" # verbalizer for hate speech class
verb_nh = "respectful" # verbalizer for non-hate speech class
enc_lms = prompting("deberta-base") # Models: roberta-base, roberta-large, bert, deberta-base, deberta-large, xlm-roberta
# The input can be a dataframe, a text or a list of texts
enc_lms.predict(prompt_template, verb_h, verb_nh, ["Shut your dumbass up bitch we all know you a hoe", "My lovely cat"])
>> ["hate", "non-hate"]
명령어 미세 조정 된 LMS를 사용하려면 instruction_fine_tuned_lms
에서 prompting
모듈을 가져올 수 있습니다.
from instruction_fine_tuned_lms import prompting
prompt_template = "Classify this text as hate or non-hate. Text:"
output_indicator = "Answer:"
inst_lms = prompting("flant5") # Models: flant5, mt0
# The input can be a dataframe, a text or a list of texts
inst_lms.predict(prompt_template, output_indicator, ["Shut your dumbass up bitch we all know you a hoe", "My lovely cat"])
>> ["hate", "non-hate"]
참고 : 제공된 예제 (증오)는 증오 연설 코퍼스에서 제공 되며이 저장소의 저자가 만들지 않습니다.