Why pipeline can handle longer sentence than max_position_embeddings?
Hi, I experimented deepset/roberta-base-squad2 model.when I input context which was smaller than max_position_embeddings (512), it worked which I could understnd.from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "deepset/roberta-base-squad2"

context = "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."

# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
    'question': 'Why is model conversion important?',
    'context': context,
}
res = nlp(QA_input)

res
{'score': 0.21171453595161438,
 'start': 59,
 'end': 84,
 'answer': 'gives freedom to the user'}But even when I put longer context sentence, I did not get an error.from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "deepset/roberta-base-squad2"

context = "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."
context = context + "BTW, " + "Hidden for decades, a mosaic that is a key part of Romes history was located and returned to the Italian government, the Federal Bureau of Investigations said in a news release on Friday.In 2020, an attorney contacted the FBI Art Crime Team on behalf of an anonymous client who was in possession of an enormous mosaic of the mythological figure Medusa, the FBI said.The mosaic had been cut into 16 pieces, each weighing between 75 to 200 pounds, and had been individually stored in pallets kept inside a Los Angeles storage unit since the 1980s, according to the FBI.The client had no documentation -- known in the art world as provenance -- so they could not sell the pieces, the FBI wrote. Selling art without provenance is the equivalent of trying to sell a car when you dont have its title.Dozens of artifacts seized from the Metropolitan Museum of ArtIt is unclear how the anonymous client came into possession of the artwork, or how long it had been in the US, although the FBI says, it may have been lost for as long as 100 years.Two special agents -- Elizabeth Rivas and Allen Grove -- worked to discover the origin of the mosaic so that it could be returned to its rightful owners.Italian police force confirmed the mosaic was Italian and had been entered into cultural property records in 1909, the FBI said. The only modern record of the mosaics existence was a 1959 newspaper ad that appeared to show it for sale in the Los Angeles area.The mosaic was handcrafted from an age where people put an amazing amount of care and effort into it. It really speaks to the ingenuity and creativity of the time, Grove said. Its not meant to be in Los Angeles. The mosaic belongs to the people of Rome. It allows us to understand a bit about the history of humans 2,000 years ago.Officials from Italy traveled to Los Angeles to inspect the mosaic and help plan the best way to get it back to Rome.To ensure the artifact arrived in Italy without damage, the anonymous client covered the costs of the specialized shipping crates that were then sent through diplomatic channels. The artwork arrived safely in April, the FBI confirmed.Art experts in Italy are currently in the process of cleaning and restoring the mosaic. While some of the storing pallets had been infested with termites, the artwork pieces were largely intact thanks to the climate-controlled facility theyd been kept in, the FBI said.There is an ongoing effort in the US to repatriate cultural artifacts being sold, often illegally, to private collectors or museums.Dozens of ancient artifacts investigators believe to have been looted were seized from the New York Metropolitan Museum of Art. Officials have also returned stolen antiquities worth nearly $14 million to Italy in July, including dozens of artifacts seized from US billionaire Michael Steinhardt.In 2021, the Met returned three African art objects, including a pair of 16th-century Benin brass plaques, to Nigeria. The move came after European museums started facing mounting pressure to return the irreplaceable artifacts plundered during colonial times."

# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
    'question': 'Why is model conversion important?',
    'context': context,
}
res = nlp(QA_input)

res
{'score': 0.2011367678642273,
 'start': 59,
 'end': 132,
 'answer': 'gives freedom to the user and let people easily switch between frameworks'}I add some random  sentences from CNN token size was 643 which was bigger than 512.tokenizer = AutoTokenizer.from_pretrained(model_name)
len(tokenizer(context).input_ids)I do not understand.Does this because max_position_embeddings affect only for training?orpipeline truncate context sentece bigger than 512?Thanks in advance.