Downloads · 30 days
0
Johndfm/ECoh-7B
ECoh-7B is a machine learning model from Johndfm. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-4.0.
ECoh is a family of transformer-based decoder-only language model finetuned to assess the coherence of responses in dialogue systems.
Downloads · 30 days
0
Access
Public
Updated Jul 18, 2024
Repo size
80 MB
Likes
0
Public
Click a slice to open those files.
.safetensors80 MB · 100%
From the Hugging Face model README
ECoh is a family of transformer-based decoder-only language model finetuned to assess the coherence of responses in dialogue systems.
Use the code below to get started with the model.
from transformers import AutoModelForCausalLM, AutoTokenizer
# load model
model_path="Johndfm/ECoh-7B"
tokenizer = AutoTokenizer.from_pretrained(model_path,padding_side="left")
base_model = AutoModelForCausalLM.from_pretrained(model_path).to("cuda")
# prepare example
example = "Context:\nA: Dahua's Market . How can I help you ? \nB: Where is your store located ? \n\nResponse:\nA: Our store is located on 123 Main Street, in the city center."
messages = [
{"role": "system", "content": "You are a Coherence evaluator."}
{"role": "user", "content": f"{example}\n\nGiven the context, is the response Coherent (Yes/No)? Explain your reasoning."}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to("cuda")
generated_ids = base_model.generate(
model_inputs.input_ids,
max_new_tokens=64
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Please refer to the original paper.
BibTeX:
@misc{mendonça2024ecoh,
title={ECoh: Turn-level Coherence Evaluation for Multilingual Dialogues},
author={John Mendonça and Isabel Trancoso and Alon Lavie},
year={2024},
eprint={2407.11660},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2407.11660},
}