Edit model card
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

Installation

Install required packages:

pip install transformers peft torch bitsandbytes

Usage

To use the model for scam detection:

  1. Import necessary libraries:
import torch
from transformers import LlamaTokenizer, LlamaForSequenceClassification
from peft import PeftModel, PeftConfig
  1. 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)
  1. Define the prediction function:
def predict_scam(texts, model, tokenizer):
    .
    .
    .

    return ["scam" if pred == 1 else "general" for pred in predicted_classes]
  1. 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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .