Views
No views yet
1alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
2
3### Instruction:
4{}
5
6### Input:
7{}
8
9### Response:
10{}"""1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3tokenizer = AutoTokenizer.from_pretrained("damerajee/tinyllama-sft-small-v2")
4model = AutoModelForCausalLM.from_pretrained("damerajee/tinyllama-sft-small-v2")1inputs = tokenizer(
2[
3 alpaca_prompt.format(
4 "best places to visit in india", # instruction
5 "", # input
6 "", # output
7 )
8]*1, return_tensors = "pt")
9
10outputs = model.generate(**inputs, max_new_tokens = 128, use_cache = True)
11tokenizer.batch_decode(outputs)