poltextlab's picture
Update gated prompt
070be16 verified
metadata
model-index:
  - name: poltextlab/xlm-roberta-large-pooled-cap-v3
    results:
      - task:
          type: text-classification
        metrics:
          - name: Accuracy
            type: accuracy
            value: 82%
          - name: F1-Score
            type: f1
            value: 82%
language:
  - es
  - pt
  - pl
  - it
  - hu
  - de
  - fr
  - en
  - nl
  - da
extra_gated_prompt: >-
  Our models are intended for academic projects and academic research only. If
  you are not affiliated with an academic institution, please reach out to us at
  huggingface [at] poltextlab [dot] com for further inquiry. If we cannot
  clearly determine your academic affiliation and use case based on your form
  data, your request may be rejected. Please allow us a few business days to
  manually review subscriptions.

  If you use our models for your work or research, please cite this paper:
  Sebők, M., Máté, Á., Ring, O., Kovács, V., & Lehoczki, R. (2024). Leveraging
  Open Large Language Models for Multilingual Policy Topic Classification: The
  Babel Machine Approach. Social Science Computer Review, 0(0).
  https://doi.org/10.1177/08944393241259434
extra_gated_fields:
  Country: country
  Institution: text
  Institution Email: text
  Full Name: text
  Please specify your academic project/use case you want to use the models for: text
license: cc-by-4.0

xlm-roberta-large-pooled-cap-v3

Model description

An xlm-roberta-large benchmark model finetuned on training data containing texts labelled with major topic codes from the Comparative Agendas Project.

Classification Report

Overall Performance:

  • Accuracy: 82.1%
  • Macro Avg: Precision: 0.80, Recall: 0.80, F1-score: 0.80
  • Weighted Avg: Precision: 0.82, Recall: 0.82, F1-score: 0.82

Per-Class Metrics:

Label Precision Recall F1-score Support
(1) Macroeconomics 0.74 0.78 0.76 34,802
(2) Civil Rights 0.74 0.64 0.68 14,687
(3) Health 0.85 0.88 0.86 27,158
(4) Agriculture 0.82 0.85 0.83 15,708
(5) Labor 0.77 0.74 0.76 18,803
(6) Education 0.85 0.90 0.87 23,547
(7) Environment 0.82 0.81 0.81 14,474
(8) Energy 0.87 0.80 0.83 11,549
(9) Immigration 0.78 0.77 0.77 8,310
(10) Transportation 0.88 0.81 0.84 22,611
(12) Law and Crime 0.80 0.83 0.81 36,014
(13) Social Welfare 0.80 0.77 0.78 17,322
(14) Housing 0.77 0.76 0.77 11,784
(15) Banking, Finance, and Domestic Commerce 0.79 0.77 0.78 25,184
(16) Defense 0.83 0.80 0.81 24,929
(17) Technology 0.82 0.81 0.82 12,578
(18) Foreign Trade 0.79 0.77 0.78 10,066
(19) International Affairs 0.76 0.78 0.77 33,759
(20) Government Operations 0.79 0.79 0.79 57,340
(21) Public Lands 0.79 0.83 0.81 18,803
(23) Culture 0.72 0.81 0.76 11,569
(999) No Policy Content 0.94 0.94 0.94 87,862

Gated access

Due to the gated access, you must pass the token parameter when loading the model. In earlier versions of the Transformers package, you may need to use the use_auth_token parameter instead.

How to use the model

from transformers import AutoTokenizer, pipeline

tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-large")
pipe = pipeline(
    model="poltextlab/xlm-roberta-large-pooled-cap-v3",
    task="text-classification",
    tokenizer=tokenizer,
    use_fast=False,
    token="<your_hf_read_only_token>"
)

text = "We will place an immediate 6-month halt on the finance driven closure of beds and wards, and set up an independent audit of needs and facilities."
pipe(text)

Inference platform

This model is used by the CAP Babel Machine, an open-source and free natural language processing tool, designed to simplify and speed up projects for comparative research.

Debugging and issues

This architecture uses the sentencepiece tokenizer. In order to run the model before transformers==4.27 you need to install it manually.

If you encounter a RuntimeError when loading the model using the from_pretrained() method, adding ignore_mismatched_sizes=True should solve the issue.