|
|
--- |
|
|
language: |
|
|
- en |
|
|
metrics: |
|
|
- accuracy |
|
|
base_model: |
|
|
- climatebert/distilroberta-base-climate-detector |
|
|
pipeline_tag: text-classification |
|
|
tags: |
|
|
- climate |
|
|
--- |
|
|
|
|
|
# Model Card for climate-filter-FB |
|
|
|
|
|
## Model Description |
|
|
This is the fine-tuned climate detection language model with a classification head for detecting climate-related Facebook Posts. |
|
|
|
|
|
The climate-filter-FB model is fine-tuned using the [climatebert/distilroberta-base-climate-detector](https://huggingface.co/climatebert/distilroberta-base-climate-detector) language model as starting point. It has been fine-tuned on a dataset containing 2000 (translated) Facebook Posts of government communication. |
|
|
|
|
|
*Note: This model is trained on full posts. It may not perform well on sentences or other data sources.* |
|
|
|
|
|
## How to Get Started With the Model |
|
|
You can use the model with a pipeline for text classification: |
|
|
```python |
|
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline |
|
|
from transformers.pipelines.pt_utils import KeyDatasetimport datasets |
|
|
from tqdm.auto import tqdm |
|
|
model_name = "frwagner/climate_filter_Fb" |
|
|
|
|
|
# If you want to use your own data, simply load them as 🤗 Datasets dataset, see https://huggingface.co/docs/datasets/loading |
|
|
dataset = datasets.load_dataset(dataset_name, split="test") |
|
|
|
|
|
model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_name, max_len=512) |
|
|
|
|
|
pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0) |
|
|
# See https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.pipeline |
|
|
|
|
|
outputs = [] |
|
|
|
|
|
for text in tqdm(dataset['text']): |
|
|
output = pipe(text, padding=True, truncation=True) |
|
|
outputs.append(output) |
|
|
|
|
|
``` |
|
|
|