YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Vicuna-7B Scam Detector
A fine-tuned version of Vicuna-7B for detecting scams in Thai text.
Model Details
- Base Model: lmsys/vicuna-7b-v1.5
- Fine-tuned Model: ShinyaJ/vicuna-7b-scam-detector
- Task: Binary Classification (Scam / General)
- Language: Thai
Installation
Install required packages:
pip install transformers peft torch bitsandbytes
Usage
To use the model for scam detection:
- Import necessary libraries:
import torch
from transformers import LlamaTokenizer, LlamaForSequenceClassification
from peft import PeftModel, PeftConfig
- Load the model and tokenizer:
model_name = "lmsys/vicuna-7b-v1.5"
peft_model_id = "ShinyaJ/vicuna-7b-scam-detector"
tokenizer = LlamaTokenizer.from_pretrained(model_name)
base_model = LlamaForSequenceClassification.from_pretrained(model_name, num_labels=2, load_in_8bit=True, device_map="auto")
peft_config = PeftConfig.from_pretrained(peft_model_id)
model_scam = PeftModel.from_pretrained(base_model, peft_model_id)
- Define the prediction function:
def predict_scam(texts, model, tokenizer):
.
.
.
return ["scam" if pred == 1 else "general" for pred in predicted_classes]
- Use the model to predict:
text = "Your text here"
prediction = predict_scam(text, model_scam, tokenizer)
print(prediction)
License
Please refer to the license of the base Vicuna-7B model.