Instructions to use rishanthrajendhran/VeriFastScore with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rishanthrajendhran/VeriFastScore with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rishanthrajendhran/VeriFastScore") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rishanthrajendhran/VeriFastScore") model = AutoModelForCausalLM.from_pretrained("rishanthrajendhran/VeriFastScore") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use rishanthrajendhran/VeriFastScore with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rishanthrajendhran/VeriFastScore" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rishanthrajendhran/VeriFastScore", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rishanthrajendhran/VeriFastScore
- SGLang
How to use rishanthrajendhran/VeriFastScore 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 "rishanthrajendhran/VeriFastScore" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rishanthrajendhran/VeriFastScore", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "rishanthrajendhran/VeriFastScore" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rishanthrajendhran/VeriFastScore", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rishanthrajendhran/VeriFastScore with Docker Model Runner:
docker model run hf.co/rishanthrajendhran/VeriFastScore
Updated example code in README.md
Browse files
README.md
CHANGED
|
@@ -72,10 +72,51 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
| 72 |
tokenizer = AutoTokenizer.from_pretrained("rishanthrajendhran/VeriFastScore")
|
| 73 |
model = AutoModelForCausalLM.from_pretrained("rishanthrajendhran/VeriFastScore")
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
```
|
| 80 |
|
| 81 |
## Training Details
|
|
|
|
| 72 |
tokenizer = AutoTokenizer.from_pretrained("rishanthrajendhran/VeriFastScore")
|
| 73 |
model = AutoModelForCausalLM.from_pretrained("rishanthrajendhran/VeriFastScore")
|
| 74 |
|
| 75 |
+
system_prompt = '''You are trying to verify how factual a response is by extracting fine-grained, verifiable claims. Each claim must describe one single event or one single state (for example, “Nvidia was founded in 1993 in Sunnyvale, California, U.S.”) in one sentence with at most one embedded clause. Each fact should be understandable on its own and require no additional context. This means that all entities must be referred to by name but not by pronoun. Use the name of entities rather than definite noun phrases (e.g., “the teacher”) whenever possible. If a definite noun phrase is used, be sure to add modifiers (e.g., an embedded clause or a prepositional phrase). Each fact must be situated within relevant temporal and location details whenever needed.
|
| 76 |
+
|
| 77 |
+
All necessary specific details—including entities, dates, and locations—must be explicitly named, and verify here means that every detail of a claim is directly confirmed by the provided evidence. The verification process involves cross-checking each detail against the evidence; a detail is considered verified if it is clearly confirmed by the evidence.
|
| 78 |
+
|
| 79 |
+
Avoid extracting stories, personal experiences, hypotheticals (e.g., those using “would be” or the subjunctive mood), subjective opinions, suggestions, advice, instructions, or similarly non-factual content; however, biographical, historical, scientific, and similar texts are acceptable. Also, ignore any listed references.
|
| 80 |
+
|
| 81 |
+
For each extracted claim, classify it as follows:
|
| 82 |
+
|
| 83 |
+
Supported: Every detail of the claim (including entities, dates, and locations) is directly confirmed by the provided evidence with no contradictions.
|
| 84 |
+
Unsupported: One or more details of the claim are either missing from or contradicted by the provided evidence, even though the claim remains verifiable using external sources.
|
| 85 |
+
|
| 86 |
+
You do not need to justify what you extract.
|
| 87 |
+
|
| 88 |
+
Output format:
|
| 89 |
+
<fact 1>: <your judgment of fact 1>
|
| 90 |
+
<fact 2>: <your judgment of fact 2>
|
| 91 |
+
…
|
| 92 |
+
<fact n>: <your judgment of fact n>
|
| 93 |
+
|
| 94 |
+
If no verifiable claim can be extracted, simply output "No verifiable claim."'''
|
| 95 |
+
|
| 96 |
+
prompt = "### Response\n{response}\n### Evidence\n{evidence}".format(
|
| 97 |
+
response=response,
|
| 98 |
+
evidence=evidence
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
conversation_history = [
|
| 102 |
+
{
|
| 103 |
+
"role": "system",
|
| 104 |
+
"content": system_prompt,
|
| 105 |
+
}, {
|
| 106 |
+
"role": "user",
|
| 107 |
+
"content": prompt
|
| 108 |
+
}
|
| 109 |
+
]
|
| 110 |
+
inputs = self.tokenizer.apply_chat_template(
|
| 111 |
+
conversation=conversation_history,
|
| 112 |
+
add_generation_prompt=True,
|
| 113 |
+
tokenize=True,
|
| 114 |
+
truncation=False,
|
| 115 |
+
padding="do_not_pad"
|
| 116 |
+
).to(model.device)
|
| 117 |
+
|
| 118 |
+
outputs = model.generate(**inputs, max_new_tokens=2048)
|
| 119 |
+
print(tokenizer.decode(outputs, skip_special_tokens=True))
|
| 120 |
```
|
| 121 |
|
| 122 |
## Training Details
|