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
support GPU inference
Browse files- modeling_hhem_v2.py +1 -1
modeling_hhem_v2.py
CHANGED
|
@@ -59,7 +59,7 @@ class HHEMv2ForSequenceClassification(PreTrainedModel):
|
|
| 59 |
tokenizer = self.tokenzier
|
| 60 |
pair_dict = [{'text1': pair[0], 'text2': pair[1]} for pair in text_pairs]
|
| 61 |
inputs = tokenizer(
|
| 62 |
-
[self.prompt.format(**pair) for pair in pair_dict], return_tensors='pt', padding=True)
|
| 63 |
self.t5.eval()
|
| 64 |
with torch.no_grad():
|
| 65 |
outputs = self.t5(**inputs)
|
|
|
|
| 59 |
tokenizer = self.tokenzier
|
| 60 |
pair_dict = [{'text1': pair[0], 'text2': pair[1]} for pair in text_pairs]
|
| 61 |
inputs = tokenizer(
|
| 62 |
+
[self.prompt.format(**pair) for pair in pair_dict], return_tensors='pt', padding=True).to(self.t5.device)
|
| 63 |
self.t5.eval()
|
| 64 |
with torch.no_grad():
|
| 65 |
outputs = self.t5(**inputs)
|