Instructions to use danielangelo1/llama-climate-change-stance-ptbr-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use danielangelo1/llama-climate-change-stance-ptbr-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForSequenceClassification base_model = AutoModelForSequenceClassification.from_pretrained("meta-llama/Meta-Llama-3.1-8B") model = PeftModel.from_pretrained(base_model, "danielangelo1/llama-climate-change-stance-ptbr-lora") - Notebooks
- Google Colab
- Kaggle
Climate Change Stance Classifier — Portuguese (LoRA · Llama 3.1 8B)
Fine-tuned LoRA adapter for stance detection in Brazilian Portuguese climate change discourse
Overview · Label Mapping · Quick Start · Dataset · Training · Limitations · Citation · Contact
Overview
This repository provides a LoRA (PEFT) adapter fine-tuned on top of meta-llama/Llama-3.1-8B for three-class stance classification in Portuguese climate change social media comments.
Note: This repository contains only the LoRA adapter weights. The base model must be loaded separately from meta-llama/Llama-3.1-8B.
Label Mapping
| Label | Class | Description |
|---|---|---|
| 0 | Denier | Explicitly expresses skepticism toward climate change; denies its occurrence; downplays its impacts; rejects anthropogenic responsibility; claims global warming is a "hoax," a "lie," a natural cycle, or a conspiracy; or articulates generalized denial of climate science. |
| 1 | Believer | Explicitly acknowledges climate change; agrees with the scientific consensus; expresses environmental concern; defends scientific evidence; or criticizes harmful practices such as deforestation or wildfires. |
| 2 | Inconclusive | Does not clearly belong to either of the above categories; contains ambiguous statements; expresses generic agreement or disagreement without clear stance; lacks sufficient information to infer position; or is irrelevant to the climate change debate. |
Quick Start
Installation
pip install torch transformers peft accelerate
Inference
🔑 Access Token Required
The base model meta-llama/Llama-3.1-8B is a gated model. You must:
- Request access at meta-llama/Llama-3.1-8B
- Accept Meta's license agreement on Hugging Face
- Generate a token at huggingface.co/settings/tokens and pass it via
token=or runhuggingface-cli loginbefore loading the model
Training Details
| Hyperparameter | Value |
|---|---|
| Method | QLoRA (Quantized LoRA — PEFT) |
| Base Model | meta-llama/Llama-3.1-8B |
| Quantization | 4-bit NF4 with bfloat16 computation |
| LoRA rank (r) | 64 |
| LoRA alpha | 16 |
| LoRA dropout | — (not applied) |
| Target modules | q_proj, k_proj, v_proj |
| Max sequence length | 192 tokens |
| Epochs | Up to 20 (early stopping, patience = 3) |
| Batch size | 128 |
| Learning rate | 2 × 10⁻⁴ |
| Loss function | Weighted cross-entropy (inverse class frequency) |
| Validation metric | Macro F1 |
| Cross-validation | Stratified 5-fold |
| Precision | Mixed (FP16) |
| Hardware | 1× NVIDIA A40 48GB · Intel Xeon Gold 6442Y 2.6GHz · 512GB RAM |
Contact
Daniel Ângelo Rosa Morais
Universidade Federal de Ouro Preto (UFOP), Brazil
📧 daniel.morais@aluno.ufop.edu.br
📧 danielangelo1234@gmail.com
- Downloads last month
- -
Model tree for danielangelo1/llama-climate-change-stance-ptbr-lora
Base model
meta-llama/Llama-3.1-8BEvaluation results
- Precision on denierself-reported0.780
- Recall on denierself-reported0.840
- F1 on denierself-reported0.810
- Precision on believerself-reported0.760
- Recall on believerself-reported0.700
- F1 on believerself-reported0.730
- Precision on inconclusiveself-reported0.840
- Recall on inconclusiveself-reported0.820