Downloads · 30 days
19
3% of all-time downloads
NiklasKoch/qwen-discussion-classifier
qwen-discussion-classifier is a text classification model from NiklasKoch. Use it when you need a label for a piece of text. It is set up for peft.
A fine-tuned Qwen 3 Embedding model for classifying constructive vs non-constructive conversations from online discussion platforms like Reddit.
Downloads · 30 days
19
3% of all-time downloads
All-time downloads
719
Public
Repo size
40.4 MB
Likes
0
Public
Click a slice to open those files.
.safetensors40.4 MB · 100%
From the Hugging Face model README
A fine-tuned Qwen 3 Embedding model for classifying constructive vs non-constructive conversations from online discussion platforms like Reddit.
This model is a QLoRA (Quantized LoRA) fine-tuned version of Qwen/Qwen3-Embedding-0.6B specifically trained to identify constructive conversations in online discussion threads. The model was trained using self-training techniques on Reddit discussion data.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
import torch
# Load base model and tokenizer
base_model_name = "Qwen/Qwen3-Embedding-0.6B"
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = AutoModelForSequenceClassification.from_pretrained(
base_model_name,
num_labels=2
)
# Load the fine-tuned adapters
model = PeftModel.from_pretrained(model, "NiklasKoch/qwen-discussion-classifier")
model.eval()
# Classify text
def classify_text(text):
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
padding=True,
max_length=4096
)
# Move inputs to same device as model (important for GPU usage)
inputs = {k: v.to(next(model.parameters()).device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
# 0 = non-constructive, 1 = constructive
predicted_class = torch.argmax(predictions, dim=-1).item()
confidence = predictions[0][predicted_class].item()
return {
'class': 'constructive' if predicted_class == 1 else 'non-constructive',
'confidence': confidence,
'scores': {
'non-constructive': predictions[0][0].item(),
'constructive': predictions[0][1].item()
}
}
# Example usage
text = "[author0] LEGO: What do you think you're doing?!? [author1] I don't get it did he reveal bionicle reboot or smthn? [author2] Not really, he did announce something but was super vague, seems like a sort of passion project we wants to do with the community, he even said it might not even be bionicle. [author1] So is that image fan made or is it one of his passion projects [author2] Those pictures are real and on his insta, he did a stream talking about it I\u2019m sure you can find somewhere, search up Fabre bionicle stream 2020 or something. [author1] OK thanks"
result = classify_text(text)
print(result)
r: 16lora_alpha: 32lora_dropout: 0.1q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projYNACC:
Accuracy: 0.70
Precision: 0.72
F1-Score: 0.69
IAC:
Accuracy: 0.78
Precision: 0.86
F1-Score: 0.86
Reddit:
Accuracy: 0.64
Precision: 0.76
F1-Score: 0.74
Niklas Koch, Georg August University of Göttingen