prabinpanta0/Rep00Zon
Preview • Updated • 33 • 1
How to use prabinpanta0/ZenGQ with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("question-answering", model="prabinpanta0/ZenGQ") # Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("prabinpanta0/ZenGQ")
model = AutoModelForQuestionAnswering.from_pretrained("prabinpanta0/ZenGQ")This is a fine-tuned BERT model for question answering tasks, trained on a custom dataset.
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
# Load the tokenizer and model from Hugging Face
tokenizer = AutoTokenizer.from_pretrained("prabinpanta0/ZenGQ")
model = AutoModelForQuestionAnswering.from_pretrained("prabinpanta0/ZenGQ")
# Create a pipeline for question answering
qa_pipeline = pipeline("question-answering", model=model, tokenizer=tokenizer)
# Define your context and questions
contexts = ["Berlin is the capital of Germany.",
"Paris is the capital of France.",
"Madrid is the capital of Spain."]
questions = [
"What is the capital of Germany?",
"Which city is the capital of France?",
"What is the capital of Spain?"
]
# Get answers
for context, question in zip(contexts, questions):
result = qa_pipeline(question=question, context=context)
print(f"Question: {question}")
print(f"Answer: {result['answer']}\n")
text = "Berlin is the capital of Germany. Paris is the capital of France. Madrid is the capital of Spain."
tokens = tokenizer.tokenize(text)
print(tokens)
Output:
['berlin', 'is', 'the', 'capital', 'of', 'germany', '.', 'paris', 'is', 'the', 'capital', 'of', 'france', '.', 'madrid', 'is', 'the', 'capital', 'of', 'spain', '.']
The model was trained on the Rep00Zon dataset.
This model is licensed under the MIT License.