stanfordnlp/sst2
Viewer β’ Updated β’ 70k β’ 26k β’ 161
How to use Saif10/sft-model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Saif10/sft-model") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Saif10/sft-model")
model = AutoModelForCausalLM.from_pretrained("Saif10/sft-model")How to use Saif10/sft-model with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Saif10/sft-model"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Saif10/sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Saif10/sft-model
How to use Saif10/sft-model with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Saif10/sft-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": "Saif10/sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Saif10/sft-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": "Saif10/sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Saif10/sft-model with Docker Model Runner:
docker model run hf.co/Saif10/sft-model
This model is the first stage in a 3-step RLHF (Reinforcement Learning from Human Feedback) pipeline using GPT-2. It has been fine-tuned on the Stanford Sentiment Treebank v2 (SST2) dataset, focusing on generating sentences with a positive sentiment tone.
This model is part of the following RLHF project structure:
You are currently viewing the SFT model.
Train GPT-2 on sentiment-labeled sentences to mimic human-like, sentiment-aware generation.
stanfordnlp/sst2from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Saif10/sft-model")
tokenizer = AutoTokenizer.from_pretrained("Saif10/sft-model")
prompt = "The movie was"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=30)
print(tokenizer.decode(outputs[0]))
Saif Rathod
Base model
openai-community/gpt2
docker model run hf.co/Saif10/sft-model