检测由大语言模型(例如GPT-2)生成的文本。
网页:http://gltr.io
在线demo:http://gltr.io/dist/index.html
论文:https://arxiv.org/abs/1906.04043
亨德里克·斯特罗贝尔特(Hendrik Strobelt)的一个项目,塞巴斯蒂安·盖尔曼(Sebastian Gehrmann),亚历山大·R·拉什(Alexander M. Rush)。
MIT-IBM Watson AI实验室和HarvardNLP的合作
安装python> 3.6的依赖项:
pip install -r requirements.txt
为gpt-2-small
运行服务器:
python server.py
演示实例现在在http:// localhost:5001/client/index.html上运行
启动BERT
的服务器:
python server.py --model BERT
实例现在在http:// localhost:5001/client/index.html?nodemo运行。提示:我们仅为gpt2-small
提供演示文本。
usage: server.py [-h] [--model MODEL] [--nodebug NODEBUG] [--address ADDRESS]
[--port PORT] [--nocache NOCACHE] [--dir DIR] [--no_cors]
optional arguments:
-h, --help show this help message and exit
--model MODEL choose either 'gpt-2-small' (default) or 'BERT' or your own
--nodebug NODEBUG server in non-debugging mode
--port PORT port to launch UI and API (default:5001)
--no_cors launch API without CORS support (default: False)
后端定义了许多模型API,通过使用参数--model NAME
启动服务器可以调用它。要添加自定义模型,您需要在backend/api.py
中编写自己的API,然后添加Decorator @register_api(name=NAME)
。
每个API都需要是一个从AbstractLanguageChecker
继承的类,该类定义了两个函数check_probabilities
and postprocess
。实现类和功能时,请按照api.py
中的文档进行操作。
前端的源代码在client/src
中。
要修改,必须安装节点依赖项:
cd client/src ; npm install ; cd ../..
重新编译前端:
> rm -rf client/dist ; cd client/src/ ; npm run build ; cd ../..
Apache 2
(C)2019年Hendrik Strobelt,Sebastian Gehrmann,Alexander M. Rush