mrm8488 / longformer-base-4096-finetuned-squadv2

huggingface.co
Total runs: 300
24-hour runs: 0
7-day runs: 67
30-day runs: -48
Model's Last Updated: December 05 2022
question-answering

Introduction of longformer-base-4096-finetuned-squadv2

Model Details of longformer-base-4096-finetuned-squadv2

Longformer-base-4096 fine-tuned on SQuAD v2

Longformer-base-4096 model fine-tuned on SQuAD v2 for Q&A downstream task.

Longformer-base-4096

Longformer is a transformer model for long documents.

longformer-base-4096 is a BERT-like model started from the RoBERTa checkpoint and pretrained for MLM on long documents. It supports sequences of length up to 4,096.

Longformer uses a combination of a sliding window (local) attention and global attention. Global attention is user-configured based on the task to allow the model to learn task-specific representations.

Details of the downstream task (Q&A) - Dataset 📚 🧐 ❓

Dataset ID: squad_v2 from HuggingFace/Datasets

Dataset Split # samples
squad_v2 train 130319
squad_v2 valid 11873

How to load it from datasets

!pip install datasets
from datasets import load_dataset
dataset = load_dataset('squad_v2')

Check out more about this dataset and others in Datasets Viewer

Model fine-tuning 🏋️‍

The training script is a slightly modified version of this one

Model in Action 🚀
import torch
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
ckpt = "mrm8488/longformer-base-4096-finetuned-squadv2"
tokenizer = AutoTokenizer.from_pretrained(ckpt)
model = AutoModelForQuestionAnswering.from_pretrained(ckpt)

text = "Huggingface has democratized NLP. Huge thanks to Huggingface for this."
question = "What has Huggingface done ?"
encoding = tokenizer(question, text, return_tensors="pt")
input_ids = encoding["input_ids"]

# default is local attention everywhere
# the forward method will automatically set global attention on question tokens
attention_mask = encoding["attention_mask"]

start_scores, end_scores = model(input_ids, attention_mask=attention_mask)
all_tokens = tokenizer.convert_ids_to_tokens(input_ids[0].tolist())

answer_tokens = all_tokens[torch.argmax(start_scores) :torch.argmax(end_scores)+1]
answer = tokenizer.decode(tokenizer.convert_tokens_to_ids(answer_tokens))

# output => democratized NLP
Usage with HF pipleine
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline

ckpt = "mrm8488/longformer-base-4096-finetuned-squadv2"
tokenizer = AutoTokenizer.from_pretrained(ckpt)
model = AutoModelForQuestionAnswering.from_pretrained(ckpt)

qa = pipeline("question-answering", model=model, tokenizer=tokenizer)

text = "Huggingface has democratized NLP. Huge thanks to Huggingface for this."
question = "What has Huggingface done?"

qa({"question": question, "context": text})

If given the same context we ask something that is not there, the output for no answer will be <s>

Created by Manuel Romero/@mrm8488 | LinkedIn

Made with ♥ in Spain

ko-fi

Runs of mrm8488 longformer-base-4096-finetuned-squadv2 on huggingface.co

300
Total runs
0
24-hour runs
0
3-day runs
67
7-day runs
-48
30-day runs

More Information About longformer-base-4096-finetuned-squadv2 huggingface.co Model

longformer-base-4096-finetuned-squadv2 huggingface.co

longformer-base-4096-finetuned-squadv2 huggingface.co is an AI model on huggingface.co that provides longformer-base-4096-finetuned-squadv2's model effect (), which can be used instantly with this mrm8488 longformer-base-4096-finetuned-squadv2 model. huggingface.co supports a free trial of the longformer-base-4096-finetuned-squadv2 model, and also provides paid use of the longformer-base-4096-finetuned-squadv2. Support call longformer-base-4096-finetuned-squadv2 model through api, including Node.js, Python, http.

longformer-base-4096-finetuned-squadv2 huggingface.co Url

https://huggingface.co/mrm8488/longformer-base-4096-finetuned-squadv2

mrm8488 longformer-base-4096-finetuned-squadv2 online free

longformer-base-4096-finetuned-squadv2 huggingface.co is an online trial and call api platform, which integrates longformer-base-4096-finetuned-squadv2's modeling effects, including api services, and provides a free online trial of longformer-base-4096-finetuned-squadv2, you can try longformer-base-4096-finetuned-squadv2 online for free by clicking the link below.

mrm8488 longformer-base-4096-finetuned-squadv2 online free url in huggingface.co:

https://huggingface.co/mrm8488/longformer-base-4096-finetuned-squadv2

longformer-base-4096-finetuned-squadv2 install

longformer-base-4096-finetuned-squadv2 is an open source model from GitHub that offers a free installation service, and any user can find longformer-base-4096-finetuned-squadv2 on GitHub to install. At the same time, huggingface.co provides the effect of longformer-base-4096-finetuned-squadv2 install, users can directly use longformer-base-4096-finetuned-squadv2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

longformer-base-4096-finetuned-squadv2 install url in huggingface.co:

https://huggingface.co/mrm8488/longformer-base-4096-finetuned-squadv2

Url of longformer-base-4096-finetuned-squadv2

longformer-base-4096-finetuned-squadv2 huggingface.co Url

Provider of longformer-base-4096-finetuned-squadv2 huggingface.co

mrm8488
ORGANIZATIONS

Other API from mrm8488

huggingface.co

Total runs: 855
Run Growth: 264
Growth Rate: 30.88%
Updated:February 23 2024
huggingface.co

Total runs: 793
Run Growth: 592
Growth Rate: 74.65%
Updated:March 19 2023
huggingface.co

Total runs: 101
Run Growth: 48
Growth Rate: 48.00%
Updated:June 20 2023
huggingface.co

Total runs: 72
Run Growth: 32
Growth Rate: 44.44%
Updated:January 24 2024
huggingface.co

Total runs: 53
Run Growth: 33
Growth Rate: 62.26%
Updated:May 21 2021