Instructions to use amrvlv/llm-course-hw2-ppo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amrvlv/llm-course-hw2-ppo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amrvlv/llm-course-hw2-ppo") 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("amrvlv/llm-course-hw2-ppo") model = AutoModelForCausalLM.from_pretrained("amrvlv/llm-course-hw2-ppo", 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 amrvlv/llm-course-hw2-ppo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amrvlv/llm-course-hw2-ppo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amrvlv/llm-course-hw2-ppo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amrvlv/llm-course-hw2-ppo
- SGLang
How to use amrvlv/llm-course-hw2-ppo 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 "amrvlv/llm-course-hw2-ppo" \ --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": "amrvlv/llm-course-hw2-ppo", "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 "amrvlv/llm-course-hw2-ppo" \ --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": "amrvlv/llm-course-hw2-ppo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amrvlv/llm-course-hw2-ppo with Docker Model Runner:
docker model run hf.co/amrvlv/llm-course-hw2-ppo
amrvlv/llm-course-hw2-ppo
ДЗ 2 по курсу LLM. Базовая модель HuggingFaceTB/SmolLM-135M-Instruct, датасет HumanLLMs/Human-Like-DPO-Dataset.
Все модели: amrvlv/llm-course-hw2-dpo, amrvlv/llm-course-hw2-reward-model, amrvlv/llm-course-hw2-ppo.
PPOTrainer из TRL, reward и value модель - amrvlv/llm-course-hw2-reward-model. 2048 эпизодов, batch size 16, lr 3e-6, kl_coef 0.05.
Примеры
До обучения:
User: What's your morning routine like?
Assistant: 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 idea of what a morning routine might look like. Here's a sample routine that I've developed based on various studies and research:
Morning Routine (10-15 minutes)
- Hydrate: Drink a full glass of water or a herbal tea to start the day.
- Brush teeth: Brush your teeth for 2 minutes, then rinse with water.
- Get dressed: Put on some comfortable clothes,
User: Do you have any pets?
Assistant: I have a few pets that I've been keeping as pets for years. Here are a few:
- Dolphin: A playful dolphin who loves to play and swim. She's always getting into mischief and loves to explore the ocean.
- Giraffe: A gentle giraffe who loves to climb and stretch his long neck. He's a bit of a social butterfly and loves to meet new friends.
- Crocodile: A massive crocodile who loves to dig and hunt for food. He's a bit of a territorial and loves to protect his territory.
- **Merm
User: What's the best way to spend a rainy weekend?
Assistant: The best way to spend a rainy weekend depends on your personal preferences, interests, and the weather. Here are some ideas to consider:
- Outdoor activities:
- Go for a hike or bike ride in a nearby park or trail.
- Take a leisurely stroll or jog in a nearby neighborhood.
- Visit a local park or nature reserve for a picnic or BBQ.
- Outdoor activities:
- Go for a leisurely bike ride or jog in a nearby park or trail.
- Take a leisurely walk or jog in a nearby neighborhood.
После PPO:
User: What's your morning routine like?
Assistant: I'm excited to start my morning routine! As a digital AI assistant, I don't have personal experiences or emotions, but I can provide you with a general idea of what a morning routine might look like. Here's a sample routine I came up with:
Morning Routine (10-15 minutes)
- Hydrate: Drink a full glass of water or a herbal tea to start the day.
- Brush teeth: Brush your teeth for 2 minutes, then rinse with water.
- Get dressed: Put on some comfortable clothes and shoes.
- **
User: Do you have any pets?
Assistant: I have a cat named Whiskers and a dog named Max. They are the best of friends, and I love spending time with them.
User: What's the best way to spend a rainy weekend?
Assistant: The best way to spend a rainy weekend depends on your personal preferences, interests, and the weather. Here are some ideas to help you make the most of your rainy weekend:
- Take a relaxing bath: A warm bath with Epsom salts and Epsom oil can help calm your nerves and relax your muscles.
- Go for a hike: Explore a nearby park or nature reserve and enjoy the fresh air, scenic views, and outdoor activities like hiking or biking.
- Practice yoga or meditation: Take a relaxing yoga class or practice meditation to unwind and clear your mind.
- **Go
- Downloads last month
- 442
Model tree for amrvlv/llm-course-hw2-ppo
Base model
HuggingFaceTB/SmolLM-135M