File size: 1,382 Bytes
0cb6483 47fde36 65ed89d 602426d 65ed89d 90a5fd1 65ed89d 90a5fd1 f38de09 90a5fd1 5616c62 90a5fd1 f38de09 90a5fd1 f38de09 90a5fd1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
---
language:
- en
library_name: transformers
license: apache-2.0
pipeline_tag: text-generation
tags:
- unsloth
- LoRA
datasets:
- TIGER-Lab/MathInstruct
base_model:
- Qwen/Qwen2.5-7B-Instruct
---
These are the LoRA adapters for model Komodo-7B-Instruct.
https://huggingface.co/suayptalha/Komodo-7B-Instruct
Suggested Usage:
```py
model_name = "Qwen/Qwen2.5-7b-Instruct"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16
)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.float16,
quantization_config=bnb_config
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
adapter_path = "suayptalha/Komodo-LoRA"
model = PeftModel.from_pretrained(model, adapter_path)
example_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.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
inputs = tokenizer(
[
example_prompt.format(
"", #Your question here
"", #Given input here
"", #Output (for training)
)
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True)
tokenizer.batch_decode(outputs)
``` |