Views
No views yet
1<s>[INST] <<SYS>>
2{{ You are a helpful, respectful and honest conversational assistant. Have a conversation with the user in a natural way. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. }}
3<</SYS>>
4
5{{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST] {{ model_answer_1 }} </s>1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2base_model = AutoModelForCausalLM.from_pretrained(
3 "garrachonr/llamaDos",
4 low_cpu_mem_usage=True,
5 return_dict=True,
6 torch_dtype=torch.float16,
7 device_map=device_map,
8)
9tokenizer = AutoTokenizer.from_pretrained("garrachonr/llamaDos", trust_remote_code=True)
10tokenizer.pad_token = tokenizer.eos_token
11tokenizer.padding_side = "right"
12
13# Run text generation pipeline with llamaDos
14system_prompt = "You are a helpful, respectful and honest conversational assistant. Have a conversation with the user in a natural way. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature."
15prompt1 = "Acabo de adoptar un perro"
16prompt2 = "Muy buena decisión, te gustan los perros?"
17prompt3 = "Si, cuando era pequeño tenía uno y ahora he podido adoptar otro"
18text = "<s>[INST] <<SYS>> {} <</SYS>> {} [/INST] {} </s><s>[INST] {} [/INST]".format(system_prompt, prompt1, prompt2, prompt3)
19pipe = pipeline(task="text-generation", model=base_model, tokenizer=tokenizer, max_length=200)
20result = pipe(text)
21print(result[0]['generated_text'])