|
--- |
|
language: |
|
- en |
|
license: apache-2.0 |
|
tags: |
|
- text-generation-inference |
|
- transformers |
|
- unsloth |
|
- gemma |
|
- trl |
|
base_model: unsloth/gemma-7b-bnb-4bit |
|
--- |
|
|
|
|
|
```python |
|
from unsloth import FastLanguageModel |
|
import torch |
|
|
|
|
|
model, tokenizer = FastLanguageModel.from_pretrained( |
|
model_name = "Ashishkr/Gemma-7B-COT-LoRA-1024R", |
|
max_seq_length = max_seq_length, |
|
dtype = dtype, |
|
load_in_4bit = load_in_4bit, |
|
) |
|
|
|
|
|
|
|
FastLanguageModel.for_inference(model) |
|
inputs = tokenizer( |
|
[ |
|
alpaca_prompt.format( |
|
"given a number identify if it is an even number, if its even, square it and add 5 to it. if its odd , get me the square root of the number", # instruction |
|
"12", # input |
|
"", # output - leave this blank for generation! |
|
) |
|
], return_tensors = "pt").to("cuda") |
|
|
|
outputs = model.generate(**inputs, max_new_tokens = 2048, use_cache = True) |
|
tokenizer.batch_decode(outputs) |
|
|
|
|
|
``` |
|
|