Instructions to use superuser77/llm-course-hw2-dpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use superuser77/llm-course-hw2-dpo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="superuser77/llm-course-hw2-dpo") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("superuser77/llm-course-hw2-dpo") model = AutoModelForCausalLM.from_pretrained("superuser77/llm-course-hw2-dpo", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use superuser77/llm-course-hw2-dpo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "superuser77/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": "superuser77/llm-course-hw2-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/superuser77/llm-course-hw2-dpo
- SGLang
How to use superuser77/llm-course-hw2-dpo 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 "superuser77/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": "superuser77/llm-course-hw2-dpo", "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 "superuser77/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": "superuser77/llm-course-hw2-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use superuser77/llm-course-hw2-dpo with Docker Model Runner:
docker model run hf.co/superuser77/llm-course-hw2-dpo
домашка 2, дпо
дообучил HuggingFaceTB/SmolLM-135M-Instruct на HumanLLMs/Human-Like-DPO-Dataset, цель была сделать ответы ближе к выбранным человеческим ответам из датасета
обучение
10884 пары, одна эпоха, размер батча 2, шаг обучения 5e-5, коэффициент бета 1.0, максимальная длина 1024 токена, запрос обрезался до 256 токенов, обучение на т4 со смешанной точностью
результат
на вопрос про утренний распорядок ответ стал более разговорным, но появились повторы, после передачи маски внимания и повторной генерации они остались, по этому примеру улучшения качества не вижу
средний логпроб на токен ответа: -2.417 на 100 примерах из обучающего датасета и -3.938 на 100 примерах из databricks/databricks-dolly-15k, запрос в оценку не входил, запрос и ответ ограничены 256 токенами каждый, это сравнение двух выборок, а не доказательство запоминания или качества генерации
пример
запрос: What's your morning routine like?
ниже фрагменты сохраненного вывода ноутбука, генерация со случайным выбором токенов, до 256 новых токенов
до обучения:
I'm excited to start my morning routine! As a digital AI assistant, I don't have personal preferences or habits, but I can provide you with a general morning routine that you can follow based on your comfort level and what works best for you.
после обучения:
The "Morning Slump" routine is all about getting your head in the right place, but it's not all about getting your head in the right place. It's all about getting your head in a relaxed, comfortable position that won't distract you from your goals.
дальше модель повторяет советы про дыхание, музыку и сон, это учебная модель, проверка проведена на небольшом числе примеров
остальные модели
- Downloads last month
- 251
Model tree for superuser77/llm-course-hw2-dpo
Base model
HuggingFaceTB/SmolLM-135M