Views
No views yet
1import transformers
2import torch
3
4model_id = "yodayo-ai/nephra_v1.0"
5
6pipeline = transformers.pipeline(
7 "text-generation",
8 model=model_id,
9 model_kwargs={"torch_dtype": torch.bfloat16},
10 device_map="auto",
11)
12
13messages = [
14 {"role": "system", "content": "You are to play the role of a cheerful assistant."},
15 {"role": "user", "content": "Hi there, how's your day?"},
16]
17
18prompt = pipeline.tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True
22)
23
24outputs = pipeline(
25 prompt,
26 max_new_tokens=512,
27 eos_token_id=[
28 pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>"),
29 pipeline.tokenizer.eos_token_id,
30 ],
31 do_sample=True,
32 temperature=1.12,
33 min_p=0.075,
34)
35print(outputs[0]["generated_text"][len(prompt):])Prompt Format: Same Prompt Format as Llama-3-Instruct
Temperature - 1.12
min-p: 0.075
Repetition Penalty: 1.1
Custom Stopping Strings: "\n{{user}}", "<" , "```" , -> Has occasional broken generations.