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-06",
7 device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
8)
9
10messages = [
11 {
12 "role": "user",
13 "content": "Summarize the advantages of internet marketing.",
14 },
15]
16
17generate_text(
18 generate_text.tokenizer.apply_chat_template(
19 messages, tokenize=False, add_generation_prompt=True
20 ),
21 streamer=TextStreamer(generate_text.tokenizer, skip_special_tokens=True),
22 max_new_tokens=512,
23 do_sample=True,
24 temperature=0.7,
25 top_p=0.9,
26 top_k=0,
27 min_p=0.1,
28 repetition_penalty=1.17,
29)