Instructions to use fava-uw/fava-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fava-uw/fava-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fava-uw/fava-model")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fava-uw/fava-model") model = AutoModelForCausalLM.from_pretrained("fava-uw/fava-model") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fava-uw/fava-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fava-uw/fava-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fava-uw/fava-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/fava-uw/fava-model
- SGLang
How to use fava-uw/fava-model 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 "fava-uw/fava-model" \ --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": "fava-uw/fava-model", "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 "fava-uw/fava-model" \ --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": "fava-uw/fava-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use fava-uw/fava-model with Docker Model Runner:
docker model run hf.co/fava-uw/fava-model
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,9 +2,19 @@ FAVA, a verification model.
|
|
| 2 |
|
| 3 |
```
|
| 4 |
import torch
|
|
|
|
| 5 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
```
|
|
|
|
| 2 |
|
| 3 |
```
|
| 4 |
import torch
|
| 5 |
+
import vllm
|
| 6 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 7 |
|
| 8 |
+
model = vllm.LLM(model="fava-uw/fava-model")
|
| 9 |
+
sampling_params = vllm.SamplingParams(
|
| 10 |
+
temperature=0,
|
| 11 |
+
top_p=1.0,
|
| 12 |
+
max_tokens=1024,
|
| 13 |
+
)
|
| 14 |
+
output = "" # add your passage to verify
|
| 15 |
+
evidence = "" # add a piece of evidence
|
| 16 |
+
prompts = [INPUT.format_map({"evidence": evidence, "output": output})]
|
| 17 |
+
outputs = model.generate(prompts, sampling_params)
|
| 18 |
+
outputs = [it.outputs[0].text for it in outputs]
|
| 19 |
+
print(outputs[0])
|
| 20 |
```
|