question answering generative t5 v1 base s q c
consciousAIIntroduction
The Question Answering Generative T5 V1 Base S Q C model is designed for question-answering tasks, producing answers based on a given question and context. This generative model is fine-tuned from the question-generation-auto-hints-t5-v1-base-s-q-c and demonstrates notable performance with a loss of 0.6751 and a Rougel score of 0.8022.
Architecture
This model is built upon the T5-v1-base architecture, which is a transformer-based model specifically fine-tuned for generative question-answering tasks. The model leverages PyTorch and integrates with various libraries, including Hugging Face Transformers and Tokenizers.
Training
The model was trained using the following hyperparameters:
- Learning Rate: 0.0003
- Train Batch Size: 3
- Evaluation Batch Size: 3
- Seed: 42
- Optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- Learning Rate Scheduler Type: Linear
- Number of Epochs: 5
Training results showed an improvement in performance metrics such as Rouge1, Rouge2, and Rougel across epochs, with the final epoch achieving a Rougel score of 0.8022.
Guide: Running Locally
To run the model locally, follow these basic steps:
- Setup Environment: Ensure you have Python installed along with PyTorch, Transformers, and Tokenizers.
- Install Required Libraries:
pip install torch transformers datasets tokenizers
- Load Model and Tokenizer:
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer model = AutoModelForSeq2SeqLM.from_pretrained("consciousAI/t5-v1-base-s-q-c-multi-task-qgen-v2").to(device) tokenizer = AutoTokenizer.from_pretrained("consciousAI/t5-v1-base-s-q-c-multi-task-qgen-v2")
- Run Inference:
def generate_answer(query, context): input_text = f"question: {query} </s> question_context: {context}" input_tokenized = tokenizer.encode(input_text, return_tensors='pt', truncation=True, padding='max_length', max_length=1024).to(device) summary_ids = model.generate(input_tokenized, max_length=30, min_length=5, num_beams=2, early_stopping=True) output = [tokenizer.decode(id, clean_up_tokenization_spaces=True, skip_special_tokens=True) for id in summary_ids] return output[0] device = 0 if torch.cuda.is_available() else 'cpu' answer = generate_answer("What is AI?", "AI refers to Artificial Intelligence...") print(answer)
- Use Cloud GPUs: For optimal performance, utilize cloud GPU services such as AWS EC2, Google Cloud, or Azure to handle intensive computations.
License
The model and its usage adhere to the licensing terms set forth by Hugging Face and the model creators. Users must ensure compliance with any applicable licenses when deploying or modifying the model.