Views
No views yet
1from unsloth import FastLanguageModel
2
3# Load model
4model, tokenizer = FastLanguageModel.from_pretrained(
5 model_name="NotIshaan/ernie-arduino-qa-unsloth-v2",
6 max_seq_length=1024,
7 dtype=None,
8 load_in_4bit=True,
9)
10FastLanguageModel.for_inference(model)
11
12# Generate response
13instruction = "What is Arduino?"
14prompt = f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
15
16### Instruction:
17{instruction}
18
19### Response:
20'''
21
22inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
23outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
24response = tokenizer.batch_decode(outputs)[0]
25print(response)1@misc{ernie-arduino-qa,
2 author = {Ishaan Pandey},
3 title = {ERNIE Arduino Q&A Model},
4 year = {2024},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/NotIshaan/ernie-arduino-qa-unsloth-v2}
7}