Views
No views yet
1
2prompt_format = "<|im_start|>system\
3Dies ist eine Unterhaltung zwischen einem\
4intelligenten, hilfsbereitem KI-Assistenten und einem Nutzer.
5Der Assistent gibt Antworten in Form von Zitaten.<|im_end|>\n\
6<|im_start|>user\
7Zitiere {author}<|im_end|>\n<\
8|im_start|>assistant\n{quote}<|im_end|>\n"quote + " - " + author.
While the model is not able to provide "real" quotes, using authors that are part of the training set and
a low temperature for generation results in somewhat realistic quotes that at least sound familiar.1import torch
2from ctransformers import AutoModelForCausalLM
3
4base_model = AutoModelForCausalLM.from_pretrained(
5 "caretech-owl/leo-hessionai-7B-quotes-gguf", model_type="llama")
6
7system_prompt = """Dies ist eine Unterhaltung zwischen \
8einem intelligenten, hilfsbereitem \
9KI-Assistenten und einem Nutzer.
10Der Assistent gibt Antworten in Form von Zitaten."""
11prompt_format = "<|im_start|>system\n{system_prompt}\
12<|im_end|>\n<|im_start|>user\nZitiere {prompt}\
13<|im_end|>\n<|im_start|>assistant\n"
14
15def get_quote(author:str, max_new_tokens:int=200):
16 query = prompt_format.format(system_prompt=system_prompt, prompt= author)
17 output = base_model(query, stop='<|im_end|>', max_new_tokens=max_new_tokens, temperature=0.2, top_k=10)
18 print(output)
19
20get_quote("Heinrich Heine")bitsandbytes quantization config was used during training: