allenai/longformer-large-4096-finetuned-triviaqa

allenai
Pregunta y respuesta

El modelo Longformer large 4096 ajustado con TriviaQA de AllenAI es un modelo para responder preguntas utilizando la arquitectura Longformer. Este modelo se ha entrenado específicamente para tareas de preguntas y respuestas utilizando el conjunto de datos TriviaQA.

Como usar

Uso del modelo:

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

# Cargando el modelo y el tokenizador
model_name = 'allenai/longformer-large-4096-finetuned-triviaqa'
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Creando la tubería de preguntas y respuestas
aq_pipeline = pipeline('question-answering', model=model, tokenizer=tokenizer)

# Ejemplos de uso
questions_and_contexts = [
    {"question": "Where do I live?", "context": "My name is Wolfgang and I live in Berlin"},
    {"question": "Where do I live?", "context": "My name is Sarah and I live in London"},
    {"question": "What's my name?", "context": "My name is Clara and I live in Berkeley."},
    {"question": "Which name is also used to describe the Amazon rainforest in English?", "context": "The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species."}
]

# Obtener respuestas
for item in questions_and_contexts:
    print(aq_pipeline(question=item['question'], context=item['context']))

Funcionalidades

Transformers
PyTorch
TensorFlow
Longformer
Question Answering
Endpoints compatibles
Región: US

Casos de uso

Responder preguntas generales basadas en el contexto proporcionado.
Usar en chatbots para brindar respuestas precisas.
Aplicaciones de asistente personal virtual.