HAID-109M / README.md
qingy2024's picture
Update README.md
23ead33 verified
metadata
license: apache-2.0
datasets:
  - qingy2024/human-gpt-bert-80k
language:
  - en
base_model:
  - google-bert/bert-base-uncased
pipeline_tag: text-classification
model-index:
  - name: HAID-109M
    results:
      - task:
          type: text-classification
        dataset:
          name: human-gpt-bert-80k
          type: human-gpt-bert-80k
        metrics:
          - name: Human-GPT Detection Validation Loss
            type: Human-GPT Detection Validation Loss
            value: 0.0082
        source:
          name: Open LLM Leaderboard
          url: >-
            https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard

HAID 109M (fine tuned from bert-base-uncased)

This is a 109M parameter model fine-tuned to detect human vs. gpt-written texts. It outputs a score ranging from 0 (GPT-written) to 1 (Human-written). However, occasionally it can output a value slightly outside of that range, such as 1.01 or -0.013

Example Inference Code

from transformers import AutoModelForSequenceClassification, AutoTokenizer

# Load the model and tokenizer from the Hugging Face Hub
model_name = "qingy2024/HAID-109M"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Example text to classify
text = "Quantum mechanics is a fundamental branch of physics that describes the behavior of particles on very small scales, such as atoms and subatomic particles. It differs significantly from classical mechanics, which governs macroscopic objects, because it introduces concepts like wave-particle duality, uncertainty, and probabilistic outcomes."

# Tokenize the text
inputs = tokenizer(text, truncation=True, max_length=512, padding=True, return_tensors="pt")

import torch
# Perform inference
with torch.no_grad():  # Disable gradient computation for inference
    outputs = model(**inputs)
    prediction = outputs.logits.item()  # Extract the single float value

# Interpret the result
print(f"Prediction score: {prediction:.3f}")
if prediction >= 0.5:
    print("Text is likely human-written.")
else:
    print("Text is likely GPT-written.")

Output

Prediction score: 0.145
Text is likely GPT-written.