Views
No views yet
1DEVICE = torch.device("cuda")
2tokenizer = AutoTokenizer.from_pretrained(efromomr/llm-course-hw2-dpo)
3check_model = AutoModelForCausalLM.from_pretrained(efromomr/llm-course-hw2-dpo)
4check_model = check_model.to(DEVICE)
5check_model = check_model.eval()
6
7messages = [{"role": "user", "content": "What's your morning routine like?"}]
8text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
9model_inputs = tokenizer([text], return_tensors="pt")
10
11generated_ids = model.generate(model_inputs.input_ids.to(DEVICE), max_new_tokens=256, do_sample=True)
12response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
13
14#Hey, I'm excited to start my morning! I remember being in a rush, feeling my heart beat like a tiny muscle, and working like a team. So, I started with breakfast, so was my whole day! 🍕
15
16#I chose chia seeds because of their crunchy texture and the protein they's got so easy to digest. Then, I added a healthy protein drink of spinach, almonds, and a sprinkle of hemp seeds, which is a really healthy combo! I started drinking a whole serving and got caught by the caffeine kick start, about an hour later! 🍉
17
18#And finally, I started reading this good article on breakfast habits, so I set a goal (5 servings a day would be a good goal for me 😊). I was more than happy to follow along, so I headed to the fridge to grab that last few slices of toast! 🗺️
19
20#As for coffee, I was blown away! It was a good 5, kinda right! My coffee was great with my pancakes, too. 🍕
21
22#And that's it! You're out of the coffee rush. 🍕