aleynahukmet commited on
Commit
da33aa7
1 Parent(s): 1b81313

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/gemma-2-2b-it
3
+ library_name: peft
4
+ ---
5
+
6
+ ## Model Summary
7
+
8
+ 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.
9
+
10
+ ## Motivation
11
+
12
+ Reasoning is a cornerstone of effective problem-solving, yet many language models struggle with tasks that require linear thought processes or adaptive strategies. 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.
13
+
14
+ ## Usage
15
+
16
+ ```python
17
+
18
+ from unsloth import FastLanguageModel
19
+ import torch
20
+ from transformers import TextStreamer
21
+
22
+
23
+ max_seq_length = 3072
24
+ dtype = None
25
+ load_in_4bit = False
26
+ lora_path = "/altaidevorg/gemma-altai-2-2b-reasoning"
27
+ use_streamer = False
28
+
29
+ model, tokenizer = FastLanguageModel.from_pretrained(
30
+ model_name=lora_path,
31
+ max_seq_length=max_seq_length,
32
+ dtype=dtype,
33
+ load_in_4bit=load_in_4bit,
34
+ )
35
+ FastLanguageModel.for_inference(model)
36
+
37
+ text_streamer = TextStreamer(tokenizer, skip_prompt = True)
38
+ )
39
+
40
+ messages = [
41
+ {"role": "user", "content": user_prompt},
42
+ ]
43
+
44
+
45
+ input_ids = tokenizer.apply_chat_template(
46
+ messages,
47
+ tokenize = True,
48
+ add_generation_prompt = True,
49
+ return_tensors = "pt",
50
+ ).cuda()
51
+
52
+ terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<end_of_turn>")]
53
+
54
+ outputs = model.generate(input_ids = input_ids,
55
+ streamer = text_streamer if use_streamer else None,
56
+ max_new_tokens = 1024,
57
+ eos_token_id=terminators,
58
+ use_cache=True, do_sample=True, temperature=0.6, top_p=0.9)
59
+ if not use_streamer:
60
+ out = outputs[0][input_ids.shape[-1]:]
61
+ generated_text = tokenizer.decode(out, skip_special_tokens=True)
62
+ print(generated_text)
63
+
64
+
65
+ ```
66
+
67
+
68
+ ## Dataset
69
+
70
+ 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.
71
+ The dataset will be made publicly available through its dedicated repository [altaidevorg/thinking-dataset-en](https://huggingface.co/datasets/altaidevorg/thinking-dataset-en).
72
+