Text Classification
Transformers
Safetensors
English
HHEMv2Config
hallucination-detection
factual-consistency
rag
custom_code
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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("vectara/hallucination_evaluation_model", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_hhem_v2.py from vectara/hallucination_evaluation_model: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/vectara/hallucination_evaluation_model/resolve/main/configuration_hhem_v2.py
- Command line
-
hf download hf://vectara/hallucination_evaluation_model/configuration_hhem_v2.py
-
curl -L -o configuration_hhem_v2.py https://huggingface.co/vectara/hallucination_evaluation_model/resolve/main/configuration_hhem_v2.py
760 Bytes
| from transformers import PretrainedConfig | |
| class HHEMv2Config(PretrainedConfig): | |
| model_type = "HHEMv2" | |
| foundation = "google/flan-t5-base" | |
| prompt = "<pad> Determine if the hypothesis is true given the premise?\n\nPremise: {text1}\n\nHypothesis: {text2}" | |
| def __init___(self, | |
| foundation="xyz", | |
| prompt="abc", | |
| **kwargs): | |
| super().__init__(**kwargs) | |
| self.foundation = foundation | |
| self.prompt = prompt | |
| # FIXME: The default values passed to the constructor are not used. | |
| # Instead, the values set as global before the constructor are used. | |
| # To test, run this: | |
| # config = HHEMv2Config() | |
| # print(config.foundation) | |
| # The output will not be xyz but google/flan-t5-base. |