bert base cased squad2

deepset

Introduction

The BERT-BASE-CASED-SQUAD2 model, developed by deepset, is a BERT base cased model fine-tuned for extractive question answering using the SQuAD v2 dataset. It is designed to perform well in English language question answering tasks.

Architecture

  • Model Type: BERT Base Cased
  • Language: English
  • Task: Extractive Question Answering
  • Training Data: SQuAD 2.0
  • Evaluation Data: SQuAD 2.0

Training

The model was trained and evaluated on the SQuAD 2.0 dataset, achieving an exact match score of 71.15 and an F1 score of 74.67. These metrics have been verified for accuracy.

Guide: Running Locally

Using Haystack

  1. Install Haystack and dependencies:
    pip install haystack-ai "transformers[torch,sentencepiece]"
    
  2. Load and run the model:
    from haystack import Document
    from haystack.components.readers import ExtractiveReader
    
    docs = [
        Document(content="Python is a popular programming language"),
    ]
    
    reader = ExtractiveReader(model="deepset/bert-base-cased-squad2")
    reader.warm_up()
    
    question = "What is a popular programming language?"
    result = reader.run(query=question, documents=docs)
    

Using Transformers

  1. Install the transformers library.
  2. Use the model with a pipeline:
    from transformers import pipeline
    
    model_name = "deepset/bert-base-cased-squad2"
    nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
    QA_input = {
        'question': 'Why is model conversion important?',
        'context': 'The option to convert models between FARM and transformers gives freedom to the user...'
    }
    res = nlp(QA_input)
    

Cloud GPUs: It is recommended to use cloud GPU services like AWS, Google Cloud, or Microsoft Azure for better performance when processing large datasets or running extensive computations.

License

The BERT-BASE-CASED-SQUAD2 model is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0).

More Related APIs in Question Answering