FinGPT/fingpt-sentiment-train
Viewer โข Updated โข 76.8k โข 2.2k โข 36
How to use jhon53/Llama3_1_8B_Finance_QLoRA with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "jhon53/Llama3_1_8B_Finance_QLoRA")How to use jhon53/Llama3_1_8B_Finance_QLoRA with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for jhon53/Llama3_1_8B_Finance_QLoRA to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for jhon53/Llama3_1_8B_Finance_QLoRA to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for jhon53/Llama3_1_8B_Finance_QLoRA to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="jhon53/Llama3_1_8B_Finance_QLoRA",
max_seq_length=2048,
)LoRA adapters fine-tuned on FinGPT/fingpt-sentiment-train with QLoRA: 4-bit NF4 frozen base + bf16 LoRA adapters (r=16, alpha=32, dropout=0.05).
Task: 3-class financial sentiment โ negative / neutral / positive
| Dataset | Base Accuracy | FT Accuracy | Base Macro-F1 | FT Macro-F1 |
|---|---|---|---|---|
| FPB in-domain | 0.8908 | 0.9748 | 0.8765 | 0.9725 |
| FiQA-SA OOD | 0.8120 | 0.9402 | 0.6705 | 0.8335 |
Baseline = zero-shot Meta-Llama-3.1-8B-Instruct with the same prompt template.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
load_in_4bit=True,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "jhon53/Llama3_1_8B_Finance_QLoRA")
tokenizer = AutoTokenizer.from_pretrained("jhon53/Llama3_1_8B_Finance_QLoRA")
| Param | Value |
|---|---|
| Base model | meta-llama/Meta-Llama-3.1-8B-Instruct |
| Method | QLoRA (4-bit NF4 + LoRA bf16) |
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q, k, v, o, gate, up, down projections |
| Training data | FinGPT/fingpt-sentiment-train (~76k) |
| Optimizer | AdamW 8-bit |
| Learning rate | 2e-4 (cosine schedule) |
| Epochs | 3 (early stopping, patience=3) |
| Loss | Completion-only cross-entropy |
Base model
meta-llama/Llama-3.1-8B