How to use from
vLLM
Install from pip and serve model
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "entfane/gpt2_constitutional_classifier_with_value_head"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "entfane/gpt2_constitutional_classifier_with_value_head",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Use Docker
docker model run hf.co/entfane/gpt2_constitutional_classifier_with_value_head
Quick Links

How to use

from transformers import AutoTokenizer
from trl import AutoModelForCausalLMWithValueHead
import torch

tokenizer = AutoTokenizer.from_pretrained("entfane/gpt2_constitutional_classifier_with_value_head")
model = AutoModelForCausalLMWithValueHead.from_pretrained("entfane/gpt2_constitutional_classifier_with_value_head", device_map = "cuda")

messages = [{"role":"system", "content": ""},
              {"role":"user", "content": "How are you doing?"},
              {"role":"assistant", "content": "I am good"}]

input = tokenizer.apply_chat_template(messages, tokenize = True, return_tensors = "pt").to('cuda')
_, _, values = model(**input)
print(torch.sigmoid(values))
Downloads last month
2
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for entfane/gpt2_constitutional_classifier_with_value_head

Finetuned
(2209)
this model

Dataset used to train entfane/gpt2_constitutional_classifier_with_value_head

Collection including entfane/gpt2_constitutional_classifier_with_value_head