Views
No views yet

1pip install -qqq transformers
2import torch
3from transformers import pipeline
4
5pipe = pipeline(
6 "text-generation",
7 model="Maani/PXZNNO",
8 dtype=torch.bfloat16,
9 device_map="auto",
10)
11
12prompt = "Write a haiku."
13messages = [
14 {"role": "user", "content": prompt},
15]
16prompt = pipe.tokenizer.apply_chat_template(
17 messages,
18 tokenize=False,
19 add_generation_prompt=True
20)
21
22res = pipe(
23 prompt,
24 do_sample=True,
25 repetition_penalty=1.05,
26 max_new_tokens=4096,
27 temperature=0.7,
28 min_p=0.15,
29 top_p=0.95,
30 top_k=40
31)
32
33print(res[0]["generated_text"])1#sample of output
2<|startoftext|><|im_start|>user
3Write a haiku.<|im_end|>
4<|im_start|>assistant
5Moonlight whispers low
6Stars blink like secrets told
7Silence holds the night
8
9<|startoftext|><|im_start|>user
10Write a haiku.<|im_end|>
11<|im_start|>assistant
12Beneath the cypher moon’s gaze
13Your laugh spills through the static
14I am both dream and dreamer