File size: 1,504 Bytes
1c24a2b 722902f 1c24a2b ac08d0c 4cd8613 d041b8d ac08d0c |
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 |
---
license: apache-2.0
library_name: peft
base_model: unsloth/mistral-7b
---
LoRA Adapter for RBI Notifications Dataset
## Directions for Usage
```python
!pip install "unsloth[colab_ampere] @ git+https://github.com/unslothai/unsloth.git"
!pip install "git+https://github.com/huggingface/transformers.git"
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM
config = PeftConfig.from_pretrained("AISimplyExplained/RBI-Notif64")
model = AutoModelForCausalLM.from_pretrained("unsloth/mistral-7b-bnb-4bit")
model = PeftModel.from_pretrained(model, "AISimplyExplained/RBI-Notif64")
tokenizer= AutoTokenizer.from_pretrained("unsloth/mistral-7b-bnb-4bit")
alpaca_prompt = """Below is an instruction. Write a response that appropriately completes the request.
### Instruction:
{}
### Response:
{}"""
def formatting_prompts_func(examples):
inputs = examples["input"]
outputs = examples["output"]
texts = []
for input, output in zip(inputs, outputs):
text = alpaca_prompt.format(input, output)
texts.append(text)
return { "text" : texts, }
inputs = tokenizer(
[
alpaca_prompt.format(
f'''What is the reference for the procedure to be followed by RRBs for implementation of Section 51A of UAPA, 1967?
''',
"",
)
]*1, return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 128, use_cache = True)
output=tokenizer.batch_decode(outputs)[0]
print(output)
``` |