character slop classifier
kubernetes-badCharacter Slop Classifier
Introduction
The Character Slop Classifier is a model designed to detect AI-generated roleplaying characters, specifically those that utilize overused narrative clichés, often referred to as "slop." This model is part of the CharGen project, which aims to filter out low-effort characters created with language models like GPT-3.5 and GPT-4.
Architecture
The Character Slop Classifier is based on the microsoft/deberta-v3-base
model, which has been fine-tuned for sequence classification tasks. It leverages a tokenizer and a neural network model to analyze text inputs and classify them as AI-generated "slop" or not.
Training
The model was trained using synthetic characters generated by GPT-3.5 and GPT-4, along with a subset of the CharGen dataset. This training process helps the model recognize specific patterns and phrases characteristic of low-effort AI-generated content.
Guide: Running Locally
-
Environment Setup: Ensure you have Python and the necessary libraries installed, including
transformers
,torch
, andlitserve
. -
Load the Model:
from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch from litserve import LitAPI, LitServer MODEL_NAME = "kubernetes-bad/character-slop-classifier"
-
Create the API:
class CHARLitAPI(LitAPI): def setup(self, device): self.tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) self.model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME) self.model.to(device) self.model.eval() # Other methods as provided in the usage example
-
Run the Server:
if __name__ == "__main__": api = CHARLitAPI() server = LitServer(api, accelerator='cuda') server.run(port=9000)
-
Make Predictions: Use
curl
or another HTTP client to send a POST request with the text to be classified.Example
curl
request:curl --location 'http://localhost:9000/predict' \ --header 'Content-Type: application/json' \ --data '{ "text": "Your text here" }'
Cloud GPUs: For optimal performance, especially for large-scale analysis, consider using cloud services that provide GPU support, such as AWS, Google Cloud, or Azure.
License
The Character Slop Classifier is licensed under the Apache-2.0 License.