介绍
LLM-Detector是一个检测AI/LLMs生成文本内容的检测工具,此仓库模型为Small版本的中文检测模型
快速使用
from modelscope import (
HubApi, snapshot_download, AutoModelForCausalLM, AutoTokenizer, GenerationConfig
)
model_dir = snapshot_download("QiYuan-tech/LLM-Detector-Small-zh",revision = "v1.0.0")
# Note: The default behavior now has injection attack prevention off.
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True).eval()
#model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True).cuda()
response, history = model.chat(tokenizer, "你好", history=None)
print(response)
评论