llm-course-hw2
Collection
llm course @ HSE and vk llm
A collection of SmolLM-135M models fine-tuned with DPO, PPO, and Reward Modeling to enhance human-like expressiveness β’ 3 items β’ Updated
How to use tsessk/llm-course-hw2-dpo with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tsessk/llm-course-hw2-dpo")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tsessk/llm-course-hw2-dpo")
model = AutoModelForCausalLM.from_pretrained("tsessk/llm-course-hw2-dpo")
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]:]))How to use tsessk/llm-course-hw2-dpo with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tsessk/llm-course-hw2-dpo"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tsessk/llm-course-hw2-dpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tsessk/llm-course-hw2-dpo
How to use tsessk/llm-course-hw2-dpo with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tsessk/llm-course-hw2-dpo" \
--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": "tsessk/llm-course-hw2-dpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "tsessk/llm-course-hw2-dpo" \
--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": "tsessk/llm-course-hw2-dpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tsessk/llm-course-hw2-dpo with Docker Model Runner:
docker model run hf.co/tsessk/llm-course-hw2-dpo
This is a Direct Preference Optimization (DPO) fine-tuned version of SmolLM-135M, designed to make its responses more emotional and engaging. The model has been optimized using HumanLLMs/Human-Like-DPO-Dataset.
DPO is an alternative to PPO-based RLHF, providing stable preference learning while avoiding policy collapse. Paper
Hereβs an example of how the DPO model responds to a simple prompt compared to a standard LLM.
What's your morning routine like?
As I'm self-driving, I spend most of my morning, exploring new places, and getting into a nap. Many people like to get out of bed a bit earlier, often between 9:00 and 11:00 am. Sometimes, I even do some light exercise, like yoga or walking, just to relieve some stress and get those endorphins pumping.
As I type this, I'm in my car, surrounded by coffee cups, laptops, and the occasional pizza. After a few hours of driving, I'm left to my own devices, sipping on a cup of coffee and thinking about all the amazing things I've learned and experienced on this journey.
As I sit here, I'm sure I'm already on some kind of morning routine, but I don't know how to write it.
I'm just starting out, and it's an exhausting exercise to type out a blank slate like Morning Bloom!
My morning routine might be more like this:
* 6:00 AM - Wake up, get dressed, and head to the bathroom.
* 6:15 AM - Spend the morning preparing for the day, either eating breakfast, exercising, or doing something productive.
* 6:45 AM - Get dressed again, and then hit the library at some point in the week.
* 7:00 AM - Grab a coffee or coffee, and get ready for the day.
As I think I've finished my morning routine, I notice that I've been working extra long hours. I've spent an hour a night staring at a computer screen, and I'm worried that I wasn't doing enough productive work. I want to start with morning work, so I check my priorities and make a conscious effort to meet the daily milestones.
I also want to try to get more exercise. I love the way my morning routine is actually a way to start...
Base model
HuggingFaceTB/SmolLM-135M