Metaphor Detection X L M R

lwachowiak

Introduction
The Multilingual Metaphor Detection model leverages XLM-RoBERTa for token-level metaphor detection using Hugging Face's token-classification approach. The model is designed to identify metaphoric usage in text, with performance evaluated using F1-score and accuracy metrics.

Architecture
The model is built on XLM-RoBERTa, a robust multilingual model that performs well on zero-shot tasks across different languages. It is fine-tuned specifically for metaphor detection using the Hugging Face Transformers library.

Training
The model is trained on the VU Amsterdam Metaphor Corpus, annotated at the word level. Although training is in English, XLM-RoBERTa's architecture allows decent performance in other languages without additional training. The model undergoes 8 epochs of training, using a learning rate of 2e-5, with 10% of data reserved for validation. The best-performing model from evaluation is used for final testing, achieving an F1-score of 0.76 for XLM-RBase and 0.77 for XLM-RLarge.

Guide: Running Locally

  1. Clone the Repository: Clone the training and evaluation code from the GitHub repository.
  2. Install Dependencies: Ensure you have Python and PyTorch installed. Install necessary libraries using pip install -r requirements.txt.
  3. Download the Model and Dataset: Follow the instructions in the repository to download and prepare the VU Amsterdam Metaphor Corpus.
  4. Run Training: Execute the training script to fine-tune the model on your local machine.
  5. Inference: Use the trained model for metaphor detection in your text inputs.
    • Cloud GPUs: For faster training, consider using cloud services that offer GPU support, such as AWS, GCP, or Azure.

License
The model is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 (cc-by-nc-sa-3.0). This allows for sharing and adaptation with attribution for non-commercial purposes.

More Related APIs in Token Classification