Instructions to use nightdessert/WeCheck with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nightdessert/WeCheck with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nightdessert/WeCheck")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("nightdessert/WeCheck") model = AutoModelForSequenceClassification.from_pretrained("nightdessert/WeCheck", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nightdessert/WeCheck with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nightdessert/WeCheck" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nightdessert/WeCheck", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nightdessert/WeCheck
- SGLang
How to use nightdessert/WeCheck with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nightdessert/WeCheck" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nightdessert/WeCheck", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nightdessert/WeCheck" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nightdessert/WeCheck", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nightdessert/WeCheck with Docker Model Runner:
docker model run hf.co/nightdessert/WeCheck
Commit ·
e817f0f
1
Parent(s): d15d6ed
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,12 +1,41 @@
|
|
| 1 |
-
#Factual Consistency Evaluator/Metric in ACL 2023 paper
|
| 2 |
|
| 3 |
*[WeCheck: Strong Factual Consistency Checker via Weakly Supervised Learning
|
| 4 |
](https://arxiv.org/abs/2212.10057)*
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
WeCheck
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
license: openrail
|
| 11 |
pipeline_tag: text-classification
|
| 12 |
tags:
|
|
|
|
| 1 |
+
# Factual Consistency Evaluator/Metric in ACL 2023 paper
|
| 2 |
|
| 3 |
*[WeCheck: Strong Factual Consistency Checker via Weakly Supervised Learning
|
| 4 |
](https://arxiv.org/abs/2212.10057)*
|
| 5 |
|
| 6 |
+
## Model description
|
| 7 |
+
WeCheck is a factual consistency metric trained from weakly annotated samples.
|
| 8 |
|
| 9 |
+
This WeCheck checkpoint can be used to check the following three generation tasks:
|
| 10 |
+
|
| 11 |
+
**Text Summarization/Knowlege grounded dialogue Generation/Paraphrase**
|
| 12 |
+
|
| 13 |
+
This WeCheck checkpoint is trained based on the following three weak labler:
|
| 14 |
+
|
| 15 |
+
*[QAFactEval
|
| 16 |
+
](https://github.com/salesforce/QAFactEval)* / *[Summarc](https://github.com/tingofurro/summac)* / *[NLI warmup](https://huggingface.co/MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli)*
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
### How to use the model
|
| 20 |
+
```python
|
| 21 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 22 |
+
import torch
|
| 23 |
+
|
| 24 |
+
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 25 |
+
model_name = "nightdessert
|
| 26 |
+
/
|
| 27 |
+
WeCheck "
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 29 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 30 |
+
premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing."
|
| 31 |
+
hypothesis = "The movie was not good."
|
| 32 |
+
input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt")
|
| 33 |
+
output = model(input["input_ids"].to(device)) # device = "cuda:0" or "cpu"
|
| 34 |
+
prediction = torch.softmax(output["logits"][0], -1).tolist()
|
| 35 |
+
label_names = ["entailment", "neutral", "contradiction"]
|
| 36 |
+
prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)}
|
| 37 |
+
print(prediction)
|
| 38 |
+
|
| 39 |
license: openrail
|
| 40 |
pipeline_tag: text-classification
|
| 41 |
tags:
|