Views
No views yet
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained(
4 "Inkersion/llama-3.1-8b-alpaca-custom",
5 device_map="auto",
6 load_in_4bit=True
7)
8tokenizer = AutoTokenizer.from_pretrained("Inkersion/llama-3.1-8b-alpaca-custom")
9
10prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
11
12### Instruction:
13Explain what machine learning is in one sentence.
14
15### Response:
16"""
17
18inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
19outputs = model.generate(**inputs, max_length=200)
20print(tokenizer.decode(outputs[0], skip_special_tokens=True))