Hate-speech-CNERG/hatexplain
Updated • 2.65k • 22
How to use muditbaid/llama3.1-8b-Instruct-qlora-hatexplain with PEFT:
Task type is invalid.
QLoRA adapter trained on the HateXplain dataset using Meta-Llama-3.1-8B-Instruct as the base model. The adapter is provided together with the training recipe and a lightweight inference script.
adapter/ – QLoRA checkpoint folder exported from LLaMA-Factory (adapter_model.safetensors, tokenizer files, training metrics).config/llama31_hatexplain_qlora_sft.yaml – Training configuration used for supervised fine-tuning.scripts/qlora_inference.py – Minimal inference helper that loads the base model, merges the adapter weights, and runs generation.transformers>=4.42, peft, bitsandbytes, accelerate).from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = "meta-llama/Meta-Llama-3.1-8B-Instruct"
adapter_path = "muditbaid/llama3.1-8b-Instruct-qlora-hatexplain"
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_path)
tokenizer = AutoTokenizer.from_pretrained(adapter_path)
python scripts/qlora_inference.py \
--adapter-path muditbaid/llama3.1-8b-Instruct-qlora-hatexplain \
--system-prompt "Classify the text as hate or not." \
--user-input "Example post here."
Refer to config/llama31_hatexplain_qlora_sft.yaml for the full set of hyperparameters.
Base model
meta-llama/Llama-3.1-8B