Instructions to use vectara/hallucination_evaluation_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vectara/hallucination_evaluation_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="vectara/hallucination_evaluation_model", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("vectara/hallucination_evaluation_model", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Finetune hallucination_evaluation_model checkpoint on custom data
I have a custom dataset consisting of a context, a summary, and a binary label (0 or 1) indicating whether the summary is hallucinated. I want to fine-tune this model using my data.
To do this, I loaded vectara model using AutoModelForSequenceClassification and the google/flan-t5-base tokenizer.
pair_dict = [{'text1': pair[0], 'text2': pair[1]} for pair in text_pairs]
inputs = tokenizer(
[prompt.format(**pair) for pair in pair_dict],
return_tensors='pt',
padding=True
).to(self.t5.device)
output = model(**inputs)
I compute the cross-entropy loss and run the standard backpropagation training loop. However, despite multiple epochs of training, the model weights do not seem to update, and the validation loss remains unchanged.
Has anyone tried similar approach and able to finetune this model ?
Hey, can you share the code for finetuning it. Thanks.