File size: 1,563 Bytes
080faed
 
 
 
 
 
 
b7bf675
 
 
97200d4
b7bf675
 
6d9c0e4
f58de22
 
6d9c0e4
97200d4
6d9c0e4
97200d4
6d9c0e4
f58de22
6d9c0e4
97200d4
6d9c0e4
b7bf675
6d9c0e4
97200d4
6d9c0e4
080faed
6d9c0e4
080faed
 
97200d4
b7bf675
080faed
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---


## How to Get Started with the Model

Use the code below to get started with the model.

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("linh5nb/Llama-2-7b-chat-finetune_covid")

tokenizer = AutoTokenizer.from_pretrained("linh5nb/Llama-2-7b-chat-finetune_covid")

user_input = '''When was the West African Ebolavirus outbreak?'''


our_system_prompt = "\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe.  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.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n" # Please do NOT change this

your_system_prompt = "Please, answer this question faithfully."

prompt = f"<s>[INST] <<SYS>>{our_system_prompt}<</SYS>>\n\n{your_system_prompt}\n{user_input} [/INST]"

inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)

outputs = model.generate(input_ids=inputs, max_length=4096)[0]

answer_start = int(inputs.shape[-1])

pred = tokenizer.decode(outputs[answer_start:], skip_special_tokens=True)

print(f'### User Input:\n{user_input}\n\n### Assistant Output:\n{pred}')

### Training Data

https://huggingface.co/datasets/hodgesz/covid_qa_llama2