Downloads · 30 days
20
4% of all-time downloads
RootYuan/opt-1.3b-alpaca
opt-1.3b-alpaca is a text generation model from RootYuan. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
20
4% of all-time downloads
All-time downloads
529
Public
Repo size
10.5 GB
Likes
1
Public
Click a slice to open those files.
.bin5.3 GB · 100%
From the Hugging Face model README
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("RootYuan/opt-1.3b-alpaca")
model = AutoModelForCausalLM.from_pretrained("RootYuan/opt-1.3b-alpaca")
usage:
instruction = "Classify the following into animals, plants, and minerals"
input = "Oak tree, copper ore, elephant"
prompts_no_input = f"### Instruction:\n{instruction}\n\n### Response:"
prompts_with_input = f"### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:"
prompts = prompts_no_input if input is None else prompts_with_input
inputs = tokenizer.encode(prompts, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=64)
ans = tokenizer.decode(outputs[0]).strip('</s>')[len(prompts):]
if input is None:
print(f"Human: {instruction}")
else:
print(f"Human: {instruction}\nInput: {input}")
print(f"Assistant: {ans}")
outputs:
Human: Classify the following into animals, plants, and minerals
Input: Oak tree, copper ore, elephant
Assistant: Oak tree: Plant
Copper ore: Mineral
Elephant: Animal