檢測由大語言模型(例如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