xuanyuzhou98 / ctrl-detector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CTRL-detector

This directory contains the code for working with the CTRL output detector model, obtained by fine-tuning a RoBERTa model with the outputs of the CTRL model and GPT-2 model. Please see the model card for additional details.

Downloading a pre-trained detector model

Download the weights for the fine-tuned roberta-large detector model (1.5 GB) as shown below. This model performs optimally for longer text inputs (> 32 tokens minimum), e.g., a news article.

wget https://storage.googleapis.com/sfr-ctrl-detector/combine_256.pt

Running the detector model

You can launch a web UI in which you can enter a text and see the detector model's prediction on whether or not it was generated by a CTRL/GPT-2 model or written by human.

# (on the top-level directory of this repository)
pip install -r requirements.txt
python -m server

After the script says "Ready to serve", nagivate to http://localhost:8080 to view the UI.

Example script

Please see example.py for minimal code to run the detector model.

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 56.7%Language:HTML 43.3%