Views
No views yet
1if False:
2 from unsloth import FastLanguageModel
3 model, tokenizer = FastLanguageModel.from_pretrained(
4 model_name = "Andyrasika/lora_gemma",
5 max_seq_length = max_seq_length,
6 dtype = dtype,
7 load_in_4bit = load_in_4bit,
8 )
9 FastLanguageModel.for_inference(model) # Enable native 2x faster inference
10
11alpaca_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.
12
13### Instruction:
14{}
15
16### Input:
17{}
18
19### Response:
20{}"""
21
22inputs = tokenizer(
23[
24 alpaca_prompt.format(
25 "What is a famous tall tower in Paris?", # instruction
26 "", # input
27 "", # output - leave this blank for generation!
28 )
29], return_tensors = "pt").to("cuda")
30
31outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
32tokenizer.batch_decode(outputs)['<bos>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the
request.\n\n### Instruction:\nWhat is a famous tall tower in Paris?\n\n### Input:\n\n\n### Response:\nOne of the most famous tall towers in Paris is the Eiffel Tower.
It is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It is named after the engineer Gustave Eiffel, whose company designed and built the tower.
The tower is 324 meters (1,063 feet']