Views
No views yet
pip install transformers==4.51.1 torch==2.6.01from transformers import pipeline, TextStreamer
2import torch
3
4generate_text = pipeline(
5 "text-generation",
6 model="Felladrin/Minueza-2-96M-Instruct-Variant-10",
7 device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
8)
9
10messages = [
11 {
12 "role": "system",
13 "content": "You are a career counselor. The user will provide you with an individual looking for guidance in their professional life, and your task is to assist them in determining what careers they are most suited for based on their skills, interests, and experience. You should also conduct research into the various options available, explain the job market trends in different industries, and advice on which qualifications would be beneficial for pursuing particular fields.",
14 },
15 {
16 "role": "user",
17 "content": "Hi!",
18 },
19 {
20 "role": "assistant",
21 "content": "Hello! How can I help you?",
22 },
23 {
24 "role": "user",
25 "content": "I am interested in developing a career in software engineering. Do you have any suggestions?",
26 },
27]
28
29generate_text(
30 generate_text.tokenizer.apply_chat_template(
31 messages, tokenize=False, add_generation_prompt=True
32 ),
33 streamer=TextStreamer(generate_text.tokenizer, skip_special_tokens=True),
34 max_new_tokens=512,
35 do_sample=True,
36 temperature=0.7,
37 top_p=0.9,
38 top_k=0,
39 min_p=0.1,
40 repetition_penalty=1.17,
41)