File size: 1,131 Bytes
6dff36a
 
 
 
45e7094
 
a8b9616
45e7094
 
a8b9616
 
 
 
 
 
 
 
 
c5cd957
2996520
a8b9616
 
8610593
a8b9616
8610593
a8b9616
 
 
 
 
6dff36a
a8b9616
 
c5cd957
 
 
 
a8b9616
6dff36a
a8b9616
6dff36a
c5cd957
 
 
 
 
 
a8b9616
6dff36a
c5cd957
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
39
40
41
42
43
44
45
46
47
48
49
50
---
language:
- en
---
## Ars model
This model was trained on stanford alpaca dataset


## To Run:
from peft import PeftModel
from transformers import LLaMATokenizer, LLaMAForCausalLM, GenerationConfig

tokenizer = LLaMATokenizer.from_pretrained("decapoda-research/llama-7b-hf")

model = LLaMAForCausalLM.from_pretrained(
    "decapoda-research/llama-7b-hf",
    load_in_8bit=True,
    device_map="auto",
)\
model = PeftModel.from_pretrained(model, "patulya/ars")

PROMPT = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
\### Instruction:
{your_instruction}
\### Response:"""

inputs = tokenizer(
    PROMPT,
    return_tensors="pt",
)

input_ids = inputs["input_ids"].cuda()

generation_config = GenerationConfig(\
    temperature=0.6,\
    top_p=0.95,\
    repetition_penalty=1.15,\
)

print("Generating...")

generation_output = model.generate(\
    input_ids=input_ids,\
    generation_config=generation_config,\
    return_dict_in_generate=True,\
    output_scores=True,\
    max_new_tokens=128,\
)

for s in generation_output.sequences: print(tokenizer.decode(s))