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
How to use "Trust_remote_code" using InferenceClient
#11
by shubhangikat - opened
This the function in which I'm trying to access hugging face through Inference Client and how do I send "Trust_remote_code" so that I don't get the issue.
def hallucination(llm_response, ground_truth):
output_from_client = client.post(model = 'vectara/hallucination_evaluation_model',
json = {"text": llm_response, "text_pair": ground_truth})
raw_score = json.loads(output_from_client.decode('utf-8'))
hallucination_score = raw_score[0]['score']
return hallucination_score