This is a [task type, e.g., text-generation, question-answering, etc.] model fine-tuned for [specific task or domain, e.g., answering questions about university admission offices]. It has been trained on [brief description of training data], and it can generate answers to questions based on the provided context or prompt.
This model is based on [base model name, e.g., GPT-3, T5, BERT] architecture, and has been fine-tuned using [describe fine-tuning method, e.g., LoRA, QLoRA, etc.].
1from transformers import AutoModelForQuestionAnswering, AutoTokenizer
2
3# Load model and tokenizer from local directory
4model_path = "./path_to_your_model_directory"
5model = AutoModelForQuestionAnswering.from_pretrained(model_path)
6tokenizer = AutoTokenizer.from_pretrained(model_path)
7
8# Example Question and Context
9question = "What are the contact details for the JAC-2024 Admission Office?"
10context = "The contact details for the JAC-2024 Admission Office at University Institute of Engineering & Technology (UIET) are as follows: Address: South Campus, Panjab University, Sector-25, Chandigarh-160014 Phone: 0172-2541242, 2534995."
11
12# Tokenize input
13inputs = tokenizer(question, context, return_tensors="pt")
14
15# Get the model's answer
16outputs = model(**inputs)
17
18# Get start and end positions for answer
19answer_start = outputs.start_logits.argmax()
20answer_end = outputs.end_logits.argmax()
21
22# Decode the answer
23answer = tokenizer.convert_tokens_to_string(tokenizer.convert_ids_to_tokens(inputs.input_ids[0][answer_start:answer_end+1]))
24print("Answer:", answer) # Output: The contact details for the JAC-2024 Admission Office at University Institute of Engineering & Technology (UIET) are as follows: Address: South Campus, Panjab University, Sector-25, Chandigarh-160014 Phone: 0172-2541242, 2534995.