I am using the SQuaD dataset for answer span selection. After using the BertTokenizer to tokenize the passages, for some samples, the start and end indices of the answer don't match the real answer span position in the passage tokens anymore. How to solve this problem? One way is to modify the answer indices (also the training targets) accordingly? But how to do it?
How to map token indices from the SQuAD data to tokens from BERT tokenizer?
4.1k views Asked by KoalaJ At
1
There are 1 answers
Related Questions in BERT-LANGUAGE-MODEL
- The training accuracy and the validation accuracy curves are almost parallel to each other. Is the model overfitting?
- Give Bert an input and ask him to predict. In this input, can Bert apply the first word prediction result to all subsequent predictions?
- how to create robust scraper for specific website without updating code after develop?
- Why are SST-2 and CoLA commonly used datasets for debiasing?
- Is BertForSequenceClassification using the CLS vector?
- How to add noise to the intermediate layer of huggingface bert model?
- Bert Istantiation TypeError: 'NoneType' object is not callable Tensorflow
- tensorflow bert 'tuple' object has no attribute problem
- Data structure in Autotrain for bert-base-uncased
- How to calculate cosine similarity with bert over 1000 random example
- the key did not present in Word2vec
- ResourceExhaustedError In Tensorflow BERT Classifier
- Enhancing BERT+CRF NER Model with keyphrase list
- Merging 6 ONNX Models into One for Unity Barracuda
- What's the exact input size in MultiHead-Attention of BERT?
Related Questions in TRANSFORMER-MODEL
- Understanding batching in pytorch models
- Using an upstream-downstream ML model, with the upstream being Wav2Vec 2.0 transformer and the downstream CNN. The model's accuracy is plateaued, why?
- How to obtain latent vectors from fine-tuned model with transformers
- What is the difference between PEFT and RAFT?
- Improving Train Punctuality Prediction Using a Transformer Model: Model Setup and Performance Issues
- How to remove layers in Huggingface's transformers GPT2 pre-trained models?
- NPL Keras transformers model not converging
- How to convert pretrained hugging face model to .pt and run it fully locally?
- LLaMA2 Workload Traces
- Inference question through LoRA in Whisper model
- is there any way to use RL for decoder only models
- What's the exact input size in MultiHead-Attention of BERT?
- How to solve this error "UnsupportedOperation: fileno"
- Transformers // Predicting next transaction based on sequence of previous transactions // Sequence2One task
- I was using colab: I want to run a .py file having argparse function to train a model
Related Questions in NLP-QUESTION-ANSWERING
- Question answering model for determine TRL(Technology Readiness Levels)
- Issue with Passing Retrieved Documents to Large Language Model in RetrievalQA Chain
- Error in retrieving document 'SentenceTransformer' object has no attribute 'default_prompt_name'
- why is langchain output not just the answer?
- What and how LLM is used for ranking organization job title?
- Facing error to evaluate spider 1.0 dataset using orca-2-7B model, hugging face transformers
- Interpreting Perplexity, U_mass coherence and Cv score trends for a Latent Dirichlet Allocation Model
- how to make my question and answer bot more detailed or accurate
- Question answering model of hugging face transformers shows errors in live server
- How to fine tune output of PrivateGPT on CSV or PDF file to get only requisite word or numbers so as to save it in a txt file
- Langchain map_reduce can't load gpt2 tokenizer error
- Map_Reduce prompt with RetrievalQA Chain
- LLM Question answer models for yes or no answers
- Retrieve page from the PDF in PDF-chatbot using Langchain
- Simple Transformer Question Answer model error showing input should be list of examples
Related Questions in HUGGINGFACE-TOKENIZERS
- Encoder-Decoder with Huggingface Models
- What should be the padding token for a Huggingface model?
- What is the difference between prepare_for_model and encode_plus?
- Can't load Tokenizer using hugging-face whisper and gradio
- Dimensions must be equal, text tokenize Tensorflow&HuggingFace
- why Tokenizer and TokenizerFast encode the same sentence get different result
- replace whisper tokenizer with BERT tokenizer
- Compare vocabulary size of WordPiece and BPE tokenizer algorithm
- Convert PyTorch Model to Hugging Face model
- What is the expected inputs to Mistral model's embedding layer?
- Building a custom tokenizer via HuggingFace Tokenizers library from scratch, some vocabularies are added, but some are not
- Why we use return_tensors = "pt" during tokenization?
- Using MBart50TokenizerFast tokenizer with multiple sentences
- IndexError when training longformer model from scratch with custom tokenizer
- Phi-2 tokenizer.batch_decode() giving error: expected string got NoneType
Related Questions in SQUAD
- What exactly is the role and responsibility of an Agilist in an Agile scrum squad?
- Formatting question/answer data for Hugging Face
- Fine Tuning a T5 Model on Squad
- Cannot reproduce the performance of deepset/roberta-base-squad2 on squad2 due to no-answer questions
- Using BERT Q&A model (SQUAD) to answer questions from a dataset
- bert-case from portugese to english
- Why do we need to write a function to "Compute Metrics" with Huggingface Question Answering Trainer when evaluating SQuAD?
- How to understand the answer_start parameter of Squad dataset for training BERT-QA model + practical implications for creating custom dataset?
- fine tuning with hugging face trainer when adding layer on eletra model
- How can I build a custom context based Question answering model SQuAD using deeppavlov
- Running BERT SQUAD model on GPU
- How to save-freeze-generate a .pb or .ckpt file for transformers and squad dataset?
- How to map token indices from the SQuAD data to tokens from BERT tokenizer?
- deeppavlov model train no module found
- Fail to run trainer.train() with huggingface transformer
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The tokenization in the original dataset is different from how BERT tokenizes the input. In BERT, less frequent words get split into subword units. You can easily find out the character offsets of the tokens in the original dataset.
In the newer versions of Transformers, the tokenizers have the option of
return_offsets_mapping. If this is set toTrue, it returns the character offset (a tuple(char_start, char_end)). If you have the character offsets in the original text, you can map them with the output of the tokenizer.The output:
The
(0, 0)spans correspond to technical tokens, in the case of BERT[CLS]and[SEP].When you have the offsets using both the original tokenization and BERT tokenization, you can find out what are the indices in the re-tokenized string.