File size: 2,582 Bytes
da33aa7 e389082 da33aa7 |
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 65 66 67 68 69 70 71 72 73 |
---
base_model: unsloth/gemma-2-2b-it
library_name: peft
---
## Model Summary
This model is fine-tuned from gemma-2-2b-it using a thinking dataset meticulously crafted by our team, aiming to enhance the model's ability to solve complex, sequential problems through step-by-step logical thinking.
## Motivation
Reasoning is a cornerstone of effective problem-solving, yet many of the models trained for this task are quite large and too heavy for everyday usage, particularly when their extra long responses considered. To address this, we developed a reasoning-focused compact language model (LLM) capable of structured thinking, self-reflection, and iterative problem-solving. Our goal is to create a model that not only excels in reasoning tasks but also operates efficiently for broader accessibility.
## Usage
```python
from unsloth import FastLanguageModel
import torch
from transformers import TextStreamer
max_seq_length = 3072
dtype = None
load_in_4bit = False
lora_path = "/altaidevorg/gemma-altai-2-2b-reasoning"
use_streamer = False
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=lora_path,
max_seq_length=max_seq_length,
dtype=dtype,
load_in_4bit=load_in_4bit,
)
FastLanguageModel.for_inference(model)
text_streamer = TextStreamer(tokenizer, skip_prompt = True)
)
messages = [
{"role": "user", "content": user_prompt},
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize = True,
add_generation_prompt = True,
return_tensors = "pt",
).cuda()
terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<end_of_turn>")]
outputs = model.generate(input_ids = input_ids,
streamer = text_streamer if use_streamer else None,
max_new_tokens = 1024,
eos_token_id=terminators,
use_cache=True, do_sample=True, temperature=0.6, top_p=0.9)
if not use_streamer:
out = outputs[0][input_ids.shape[-1]:]
generated_text = tokenizer.decode(out, skip_special_tokens=True)
print(generated_text)
```
## Dataset
The dataset was prepared through a comprehensive process based on our open-source reasoning and thinking dataset collection method. We curated and refined existing open-source datasets focusing on logical reasoning, critical thinking, and problem-solving. These datasets were preprocessed and structured for fine-tuning large language models to ensure high-quality outputs.
The dataset will be made publicly available through its dedicated repository [altaidevorg/thinking-dataset-en](https://huggingface.co/datasets/altaidevorg/thinking-dataset-en).
|