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ture\n",
|
17 |
+
"%pip install -U transformers\n",
|
18 |
+
"%pip install -U datasets \n",
|
19 |
+
"%pip install -U accelerate \n",
|
20 |
+
"%pip install -U peft \n",
|
21 |
+
"%pip install -U trl \n",
|
22 |
+
"%pip install -U bitsandbytes\n",
|
23 |
+
"%pip install huggingface_hub[hf_xet]"
|
24 |
+
]
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"cell_type": "code",
|
28 |
+
"execution_count": 2,
|
29 |
+
"metadata": {},
|
30 |
+
"outputs": [
|
31 |
+
{
|
32 |
+
"name": "stderr",
|
33 |
+
"output_type": "stream",
|
34 |
+
"text": [
|
35 |
+
"Note: Environment variable`HF_TOKEN` is set and is the current active token independently from the token you've just configured.\n"
|
36 |
+
]
|
37 |
+
}
|
38 |
+
],
|
39 |
+
"source": [
|
40 |
+
"from huggingface_hub import login\n",
|
41 |
+
"import os\n",
|
42 |
+
"\n",
|
43 |
+
"hf_token = os.environ.get(\"HF_TOKEN\")\n",
|
44 |
+
"login(hf_token)"
|
45 |
+
]
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"cell_type": "markdown",
|
49 |
+
"metadata": {},
|
50 |
+
"source": [
|
51 |
+
"## Loading the model and tokenizer"
|
52 |
+
]
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"cell_type": "code",
|
56 |
+
"execution_count": 3,
|
57 |
+
"metadata": {},
|
58 |
+
"outputs": [
|
59 |
+
{
|
60 |
+
"data": {
|
61 |
+
"application/vnd.jupyter.widget-view+json": {
|
62 |
+
"model_id": "72f4f1bf4d4b4a6f8c4f7ec258efe012",
|
63 |
+
"version_major": 2,
|
64 |
+
"version_minor": 0
|
65 |
+
},
|
66 |
+
"text/plain": [
|
67 |
+
"Loading checkpoint shards: 0%| | 0/6 [00:00<?, ?it/s]"
|
68 |
+
]
|
69 |
+
},
|
70 |
+
"metadata": {},
|
71 |
+
"output_type": "display_data"
|
72 |
+
}
|
73 |
+
],
|
74 |
+
"source": [
|
75 |
+
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
|
76 |
+
"import torch\n",
|
77 |
+
"\n",
|
78 |
+
"# Load tokenizer & model\n",
|
79 |
+
"model_dir = \"microsoft/Phi-4-reasoning-plus\"\n",
|
80 |
+
"\n",
|
81 |
+
"tokenizer = AutoTokenizer.from_pretrained(model_dir, use_fast=True)\n",
|
82 |
+
"\n",
|
83 |
+
"model = AutoModelForCausalLM.from_pretrained(\n",
|
84 |
+
" model_dir, \n",
|
85 |
+
" device_map=\"auto\", \n",
|
86 |
+
" torch_dtype=torch.bfloat16,\n",
|
87 |
+
" trust_remote_code=True \n",
|
88 |
+
")\n",
|
89 |
+
"\n",
|
90 |
+
"model.config.use_cache = False\n",
|
91 |
+
"model.config.pretraining_tp = 1"
|
92 |
+
]
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"cell_type": "code",
|
96 |
+
"execution_count": 4,
|
97 |
+
"metadata": {},
|
98 |
+
"outputs": [
|
99 |
+
{
|
100 |
+
"name": "stdout",
|
101 |
+
"output_type": "stream",
|
102 |
+
"text": [
|
103 |
+
"Tue May 13 18:05:17 2025 \n",
|
104 |
+
"+-----------------------------------------------------------------------------------------+\n",
|
105 |
+
"| NVIDIA-SMI 565.57.01 Driver Version: 565.57.01 CUDA Version: 12.7 |\n",
|
106 |
+
"|-----------------------------------------+------------------------+----------------------+\n",
|
107 |
+
"| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
108 |
+
"| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n",
|
109 |
+
"| | | MIG M. |\n",
|
110 |
+
"|=========================================+========================+======================|\n",
|
111 |
+
"| 0 NVIDIA A100-SXM4-80GB On | 00000000:4E:00.0 Off | 0 |\n",
|
112 |
+
"| N/A 25C P0 65W / 400W | 28387MiB / 81920MiB | 0% Default |\n",
|
113 |
+
"| | | Disabled |\n",
|
114 |
+
"+-----------------------------------------+------------------------+----------------------+\n",
|
115 |
+
" \n",
|
116 |
+
"+-----------------------------------------------------------------------------------------+\n",
|
117 |
+
"| Processes: |\n",
|
118 |
+
"| GPU GI CI PID Type Process name GPU Memory |\n",
|
119 |
+
"| ID ID Usage |\n",
|
120 |
+
"|=========================================================================================|\n",
|
121 |
+
"+-----------------------------------------------------------------------------------------+\n"
|
122 |
+
]
|
123 |
+
}
|
124 |
+
],
|
125 |
+
"source": [
|
126 |
+
"!nvidia-smi"
|
127 |
+
]
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"cell_type": "markdown",
|
131 |
+
"metadata": {},
|
132 |
+
"source": [
|
133 |
+
"## Loading and processing the dataset"
|
134 |
+
]
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"cell_type": "code",
|
138 |
+
"execution_count": 12,
|
139 |
+
"metadata": {},
|
140 |
+
"outputs": [],
|
141 |
+
"source": [
|
142 |
+
"train_prompt_style=\"\"\"\n",
|
143 |
+
"<|im_start|>system<|im_sep|>\n",
|
144 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. \n",
|
145 |
+
"Write a response that appropriately completes the request. \n",
|
146 |
+
"Before answering, think carefully about the question and create a step-by-step chain of thoughts to ensure a logical and accurate response.\n",
|
147 |
+
"<|im_end|>\n",
|
148 |
+
"<|im_start|>user<|im_sep|>\n",
|
149 |
+
"{}<|im_end|>\n",
|
150 |
+
"<|im_start|>assistant<|im_sep|>\n",
|
151 |
+
"<think>\n",
|
152 |
+
"{}\n",
|
153 |
+
"</think>\n",
|
154 |
+
"{}\n",
|
155 |
+
"\"\"\""
|
156 |
+
]
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"cell_type": "code",
|
160 |
+
"execution_count": 13,
|
161 |
+
"metadata": {},
|
162 |
+
"outputs": [],
|
163 |
+
"source": [
|
164 |
+
"EOS_TOKEN = tokenizer.eos_token # Must add EOS_TOKEN\n",
|
165 |
+
"\n",
|
166 |
+
"def formatting_prompts_func(examples):\n",
|
167 |
+
" inputs = examples[\"Open-ended Verifiable Question\"]\n",
|
168 |
+
" complex_cots = examples[\"Complex_CoT\"]\n",
|
169 |
+
" outputs = examples[\"Response\"]\n",
|
170 |
+
" texts = []\n",
|
171 |
+
" for input, cot, output in zip(inputs,complex_cots,outputs):\n",
|
172 |
+
" text = train_prompt_style.format(input,cot,output) + EOS_TOKEN\n",
|
173 |
+
" texts.append(text)\n",
|
174 |
+
" return {\n",
|
175 |
+
" \"text\": texts,\n",
|
176 |
+
" }"
|
177 |
+
]
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"cell_type": "code",
|
181 |
+
"execution_count": 14,
|
182 |
+
"metadata": {},
|
183 |
+
"outputs": [
|
184 |
+
{
|
185 |
+
"data": {
|
186 |
+
"application/vnd.jupyter.widget-view+json": {
|
187 |
+
"model_id": "4b7732d8b4e343adaff55dcdb610a8a4",
|
188 |
+
"version_major": 2,
|
189 |
+
"version_minor": 0
|
190 |
+
},
|
191 |
+
"text/plain": [
|
192 |
+
"Map: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
"metadata": {},
|
196 |
+
"output_type": "display_data"
|
197 |
+
},
|
198 |
+
{
|
199 |
+
"data": {
|
200 |
+
"text/plain": [
|
201 |
+
"\"\\n<|im_start|>system<|im_sep|>\\nBelow is an instruction that describes a task, paired with an input that provides further context. \\nWrite a response that appropriately completes the request. \\nBefore answering, think carefully about the question and create a step-by-step chain of thoughts to ensure a logical and accurate response.\\n<|im_end|>\\n<|im_start|>user<|im_sep|>\\nPlease answer the given financial question based on the context.\\nContext: american tower corporation and subsidiaries notes to consolidated financial statements 2014 ( continued ) stock-based compensation 2014the company complies with the provisions of sfas no . 148 , 201caccounting for stock-based compensation 2014transition and disclosure 2014an amendment of sfas no . 123 , 201d which provides optional transition guidance for those companies electing to voluntarily adopt the accounting provisions of sfas no . 123 . the company continues to use accounting principles board opinion no . 25 ( apb no . 25 ) , 201caccounting for stock issued to employees , 201d to account for equity grants and awards to employees , officers and directors and has adopted the disclosure-only provisions of sfas no . 148 . in accordance with apb no . 25 , the company recognizes compensation expense based on the excess , if any , of the quoted stock price at the grant date of the award or other measurement date over the amount an employee must pay to acquire the stock . the company 2019s stock option plans are more fully described in note 13 . in december 2004 , the fasb issued sfas no . 123r , 201cshare-based payment 201d ( sfas no . 123r ) , described below . the following table illustrates the effect on net loss and net loss per share if the company had applied the fair value recognition provisions of sfas no . 123 ( as amended ) to stock-based compensation . the estimated fair value of each option is calculated using the black-scholes option-pricing model ( in thousands , except per share amounts ) : .\\n||2004|2003|2002|\\n|net loss as reported|$ -247587 ( 247587 )|$ -325321 ( 325321 )|$ -1163540 ( 1163540 )|\\n|add : stock-based employee compensation expense associated with modifications net of related tax effect included in net loss asreported|2297|2077||\\n|less : total stock-based employee compensation expense determined under fair value based method for all awards net of related taxeffect|-23906 ( 23906 )|-31156 ( 31156 )|-38126 ( 38126 )|\\n|pro-forma net loss|$ -269196 ( 269196 )|$ -354400 ( 354400 )|$ -1201666 ( 1201666 )|\\n|basic and diluted net loss per share 2014as reported|$ -1.10 ( 1.10 )|$ -1.56 ( 1.56 )|$ -5.95 ( 5.95 )|\\n|basic and diluted net loss per share pro-forma|$ -1.20 ( 1.20 )|$ -1.70 ( 1.70 )|$ -6.15 ( 6.15 )|\\nduring the year ended december 31 , 2004 and 2003 , the company modified certain option awards to accelerate vesting and recorded charges of $ 3.0 million and $ 2.3 million , respectively , and corresponding increases to additional paid in capital in the accompanying consolidated financial statements . fair value of financial instruments 2014the carrying values of the company 2019s financial instruments , with the exception of long-term obligations , including current portion , reasonably approximate the related fair values as of december 31 , 2004 and 2003 . as of december 31 , 2004 , the carrying amount and fair value of long-term obligations , including current portion , were $ 3.3 billion and $ 3.6 billion , respectively . as of december 31 , 2003 , the carrying amount and fair value of long-term obligations , including current portion , were $ 3.4 billion and $ 3.6 billion , respectively . fair values are based primarily on quoted market prices for those or similar instruments . retirement plan 2014the company has a 401 ( k ) plan covering substantially all employees who meet certain age and employment requirements . under the plan , the company matching contribution for periods prior to june 30 , 2004 was 35% ( 35 % ) up to a maximum 5% ( 5 % ) of a participant 2019s contributions . effective july 1 , 2004 , the plan was amended to increase the company match to 50% ( 50 % ) up to a maximum 6% ( 6 % ) of a participant 2019s contributions . the company contributed approximately $ 533000 , $ 825000 and $ 979000 to the plan for the years ended december 31 , 2004 , 2003 and 2002 , respectively . recent accounting pronouncements 2014in december 2004 , the fasb issued sfas no . 123r , which is a revision of sfas no . 123 , 201caccounting for stock-based compensation , 201d and supersedes apb no . 25 , accounting for .\\nQuestion: what was the percentage increase in the employee contribution from 2002 to 2003\\nAnswer:<|im_end|>\\n<|im_start|>assistant<|im_sep|>\\n<think>\\nOkay, let's break this down. I need to figure out the percentage increase in employee contributions between 2002 and 2003 for the 401(k) plan. \\n\\nFirst off, the company's matching rates were consistent during this period. They matched 35% of employee contributions up to 5% of what the employees contributed in both 2002 and 2003. \\n\\nWhat I have is the company's contributions. In 2002, the company contributed $979,000, and in 2003, it was $825,000. \\n\\nSince the match rate was the same both years, I can say that $979,000 in 2002 and $825,000 in 2003 represented 35% of the employee contributions. But how do I get the total employee contributions from this?\\n\\nOh, right! To find the total employee contributions, I just need to reverse the percentage. So, for 2002, I divide $979,000 by 0.35. Hmm, doing the math, that gives $2,797,143 for total employee contributions in 2002.\\n\\nNow, for 2003, I do the same thing: divide $825,000 by 0.35. Alright, that works out to $2,357,143 for 2003.\\n\\nNext, I need to find out how the contributions changed from 2002 to 2003. This means calculating the percentage change. I take the difference between the contributions in 2003 and 2002, which is $2,357,143 minus $2,797,143.\\n\\nWait, the result looks like a decrease because it's negative. The difference is -$440,000, so there's actually a decrease. \\n\\nNow for the percentage: I divide this difference by the 2002 amount ($2,797,143) and then multiply by 100 to get the percentage. Let's see, this equals a change of about -15.725%.\\n\\nHmm, it makes sense now, the contributions actually decreased from 2002 to 2003 by roughly 15.725%.\\n</think>\\nThere was actually a percentage decrease in employee contributions from 2002 to 2003. The employee contributions decreased by approximately 15.725%.\\n<|im_end|>\""
|
202 |
+
]
|
203 |
+
},
|
204 |
+
"execution_count": 14,
|
205 |
+
"metadata": {},
|
206 |
+
"output_type": "execute_result"
|
207 |
+
}
|
208 |
+
],
|
209 |
+
"source": [
|
210 |
+
"from datasets import load_dataset\n",
|
211 |
+
"\n",
|
212 |
+
"dataset = load_dataset(\n",
|
213 |
+
" \"TheFinAI/Fino1_Reasoning_Path_FinQA\", split=\"train[0:1000]\", trust_remote_code=True\n",
|
214 |
+
")\n",
|
215 |
+
"dataset = dataset.map(\n",
|
216 |
+
" formatting_prompts_func,\n",
|
217 |
+
" batched=True,\n",
|
218 |
+
")\n",
|
219 |
+
"dataset[\"text\"][20]\n"
|
220 |
+
]
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"cell_type": "code",
|
224 |
+
"execution_count": 8,
|
225 |
+
"metadata": {},
|
226 |
+
"outputs": [],
|
227 |
+
"source": [
|
228 |
+
"from transformers import DataCollatorForLanguageModeling\n",
|
229 |
+
"\n",
|
230 |
+
"data_collator = DataCollatorForLanguageModeling(\n",
|
231 |
+
" tokenizer=tokenizer,\n",
|
232 |
+
" mlm=False\n",
|
233 |
+
")"
|
234 |
+
]
|
235 |
+
},
|
236 |
+
{
|
237 |
+
"cell_type": "markdown",
|
238 |
+
"metadata": {},
|
239 |
+
"source": [
|
240 |
+
"## Model inference before fine-tuning"
|
241 |
+
]
|
242 |
+
},
|
243 |
+
{
|
244 |
+
"cell_type": "code",
|
245 |
+
"execution_count": 15,
|
246 |
+
"metadata": {},
|
247 |
+
"outputs": [],
|
248 |
+
"source": [
|
249 |
+
"inference_prompt_style = \"\"\"\n",
|
250 |
+
"<|im_start|>system<|im_sep|>\n",
|
251 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. \n",
|
252 |
+
"Write a response that appropriately completes the request. \n",
|
253 |
+
"Before answering, think carefully about the question and create a step-by-step chain of thoughts to ensure a logical and accurate response.\n",
|
254 |
+
"<|im_end|>\n",
|
255 |
+
"<|im_start|>user<|im_sep|>\n",
|
256 |
+
"{}<|im_end|>\n",
|
257 |
+
"<|im_start|>assistant<|im_sep|>\n",
|
258 |
+
"<think>\n",
|
259 |
+
"{}\n",
|
260 |
+
"\"\"\""
|
261 |
+
]
|
262 |
+
},
|
263 |
+
{
|
264 |
+
"cell_type": "code",
|
265 |
+
"execution_count": 16,
|
266 |
+
"metadata": {},
|
267 |
+
"outputs": [
|
268 |
+
{
|
269 |
+
"name": "stdout",
|
270 |
+
"output_type": "stream",
|
271 |
+
"text": [
|
272 |
+
"<think><|im_end|>We are asked: \"what was the percentage increase in the employee contribution from 2002 to 2003?\" Let's check the provided context carefully. The context is a snippet from a financial statement notes. It says: \"retirement plan 2014the company has a 401 (k) plan covering substantially all employees who meet certain age and employment requirements . under the plan , the company matching contribution for periods prior to june 30, 2004 was 35% (35%) up to a maximum 5% (5%) of a participant's contributions. effective july 1, 2004, the plan was amended to increase the company match to 50% (50%) up to a maximum 6% (6%) of a participant's contributions. the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003 and 2002, respectively.\"\n",
|
273 |
+
"\n",
|
274 |
+
"We must compute: \"what was the percentage increase in the employee contribution from 2002 to 2003?\" Wait, caution: The question says: \"what was the percentage increase in the employee contribution from 2002 to 2003?\" However, careful reading: \"the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003, and 2002, respectively.\" The question: \"percentage increase in the employee contribution\" But these numbers are the company's contributions to the plan? Wait, not exactly, they are the company's contributions to the 401(k) plan. However, the question says \"employee contribution.\" But the text says \"the company contributed\" amounts. Actually, check: The text says \"the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003, and 2002, respectively.\" That indicates the amounts that the company contributed. But the question says \"employee contribution.\" Possibly a misprint? Wait, maybe \"employee contribution\" means the employees' contributions? But no, the amounts are clearly stated as \"company contributed\" amounts.\n",
|
275 |
+
"\n",
|
276 |
+
"Let's re-read the retirement plan note carefully:\n",
|
277 |
+
"\n",
|
278 |
+
"\"retirement plan 2014the company has a 401 (k) plan covering substantially all employees who meet certain age and employment requirements . under the plan , the company matching contribution for periods prior to june 30, 2004 was 35% (35%) up to a maximum 5% (5%) of a participant's contributions. effective july 1, 2004, the plan was amended to increase the company match to 50% (50%) up to a maximum 6% (6%) of a participant's contributions. the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003 and 2002, respectively.\"\n",
|
279 |
+
"\n",
|
280 |
+
"So the amounts are \"company contributions\" to the plan. But then the question asks: \"what was the percentage increase in the employee contribution from 2002 to 2003?\" Possibly the percentages refer to the company match percentages? Possibly the question means \"what was the percentage increase in the company match percentage from 2002 to 2003?\" But wait, the text: \"the company matching contribution for periods prior to june 30, 2004 was 35% up to a maximum 5% of a participant's contributions. effective july 1, 2004, the plan was amended to increase the company match to 50% up to a maximum 6% of a participant's contributions.\" But then the question: \"what was the percentage increase in the employee contribution from 2002 to 2003\" I see: The given numbers: For 2002: $979,000, for 2003: $825,000, for 2004: $533,000. The question asks: \"employee contribution\" but those amounts are company contributions. Possibly there is a misinterpretation: Actually the question may be asking: \"what was the percentage increase in the employee contribution\" but the text says \"the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003 and 2002, respectively.\" So which one is the employee's contribution? Alternatively, the note says \"employee\" may refer to the company's matching contribution? Actually, re-read: \"under the plan, the company matching contribution for periods prior to june 30, 2004 was 35% (35%) up to a maximum 5% (5%) of a participant's contributions.\" That is the company match. Then: \"effective july 1, 2004, the plan was amended to increase the company match to 50% (50%) up to a maximum 6% (6%) of a participant's contributions.\" So these are percentages of the employee's contributions. But then later the note says \"the company contributed approximately $533,000, $825,000 and $979,000 to the plan for the years ended December 31, 2004, 2003 and 2002, respectively.\" So maybe the question \"what was the percentage increase in the employee contribution\" actually might refer to the company's matching contribution as a percentage of the employee contributions, i.e. from 5% to 6%? But then the question \"from 2002 to 2003\" doesn't match because the plan change effective date is july 1, 2004, and that's not relevant to the\n"
|
281 |
+
]
|
282 |
+
}
|
283 |
+
],
|
284 |
+
"source": [
|
285 |
+
"question = dataset[20]['Open-ended Verifiable Question']\n",
|
286 |
+
"inputs = tokenizer(\n",
|
287 |
+
" [inference_prompt_style.format(question, \"\") + tokenizer.eos_token],\n",
|
288 |
+
" return_tensors=\"pt\"\n",
|
289 |
+
").to(\"cuda\")\n",
|
290 |
+
"\n",
|
291 |
+
"outputs = model.generate(\n",
|
292 |
+
" input_ids=inputs.input_ids,\n",
|
293 |
+
" attention_mask=inputs.attention_mask,\n",
|
294 |
+
" max_new_tokens=1200,\n",
|
295 |
+
" eos_token_id=tokenizer.eos_token_id,\n",
|
296 |
+
" use_cache=True,\n",
|
297 |
+
")\n",
|
298 |
+
"response = tokenizer.batch_decode(outputs)\n",
|
299 |
+
"print(response[0].split(\"<|im_start|>assistant<|im_sep|>\")[1])"
|
300 |
+
]
|
301 |
+
},
|
302 |
+
{
|
303 |
+
"cell_type": "markdown",
|
304 |
+
"metadata": {},
|
305 |
+
"source": [
|
306 |
+
"## Setting up the model"
|
307 |
+
]
|
308 |
+
},
|
309 |
+
{
|
310 |
+
"cell_type": "code",
|
311 |
+
"execution_count": 17,
|
312 |
+
"metadata": {},
|
313 |
+
"outputs": [],
|
314 |
+
"source": [
|
315 |
+
"from peft import LoraConfig, get_peft_model\n",
|
316 |
+
"\n",
|
317 |
+
"# LoRA config\n",
|
318 |
+
"peft_config = LoraConfig(\n",
|
319 |
+
" lora_alpha=16, # Scaling factor for LoRA\n",
|
320 |
+
" lora_dropout=0.05, # Add slight dropout for regularization\n",
|
321 |
+
" r=64, # Rank of the LoRA update matrices\n",
|
322 |
+
" bias=\"none\", # No bias reparameterization\n",
|
323 |
+
" task_type=\"CAUSAL_LM\", # Task type: Causal Language Modeling\n",
|
324 |
+
" target_modules=[\n",
|
325 |
+
" \"q_proj\",\n",
|
326 |
+
" \"k_proj\",\n",
|
327 |
+
" \"v_proj\",\n",
|
328 |
+
" \"o_proj\",\n",
|
329 |
+
" \"gate_proj\",\n",
|
330 |
+
" \"up_proj\",\n",
|
331 |
+
" \"down_proj\",\n",
|
332 |
+
" ], # Target modules for LoRA\n",
|
333 |
+
")\n",
|
334 |
+
"\n",
|
335 |
+
"model = get_peft_model(model, peft_config)"
|
336 |
+
]
|
337 |
+
},
|
338 |
+
{
|
339 |
+
"cell_type": "code",
|
340 |
+
"execution_count": 18,
|
341 |
+
"metadata": {},
|
342 |
+
"outputs": [
|
343 |
+
{
|
344 |
+
"data": {
|
345 |
+
"application/vnd.jupyter.widget-view+json": {
|
346 |
+
"model_id": "50fed52d9fce44e5a7f7586b13700d83",
|
347 |
+
"version_major": 2,
|
348 |
+
"version_minor": 0
|
349 |
+
},
|
350 |
+
"text/plain": [
|
351 |
+
"Converting train dataset to ChatML: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
352 |
+
]
|
353 |
+
},
|
354 |
+
"metadata": {},
|
355 |
+
"output_type": "display_data"
|
356 |
+
},
|
357 |
+
{
|
358 |
+
"data": {
|
359 |
+
"application/vnd.jupyter.widget-view+json": {
|
360 |
+
"model_id": "bbe465aef9164fda938c16123563e185",
|
361 |
+
"version_major": 2,
|
362 |
+
"version_minor": 0
|
363 |
+
},
|
364 |
+
"text/plain": [
|
365 |
+
"Adding EOS to train dataset: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
366 |
+
]
|
367 |
+
},
|
368 |
+
"metadata": {},
|
369 |
+
"output_type": "display_data"
|
370 |
+
},
|
371 |
+
{
|
372 |
+
"data": {
|
373 |
+
"application/vnd.jupyter.widget-view+json": {
|
374 |
+
"model_id": "a302c537fdab496aad69b7f42915cacc",
|
375 |
+
"version_major": 2,
|
376 |
+
"version_minor": 0
|
377 |
+
},
|
378 |
+
"text/plain": [
|
379 |
+
"Tokenizing train dataset: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
380 |
+
]
|
381 |
+
},
|
382 |
+
"metadata": {},
|
383 |
+
"output_type": "display_data"
|
384 |
+
},
|
385 |
+
{
|
386 |
+
"data": {
|
387 |
+
"application/vnd.jupyter.widget-view+json": {
|
388 |
+
"model_id": "3735f907a3a84669b38856d8e8e62a71",
|
389 |
+
"version_major": 2,
|
390 |
+
"version_minor": 0
|
391 |
+
},
|
392 |
+
"text/plain": [
|
393 |
+
"Truncating train dataset: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
394 |
+
]
|
395 |
+
},
|
396 |
+
"metadata": {},
|
397 |
+
"output_type": "display_data"
|
398 |
+
},
|
399 |
+
{
|
400 |
+
"name": "stderr",
|
401 |
+
"output_type": "stream",
|
402 |
+
"text": [
|
403 |
+
"No label_names provided for model class `PeftModelForCausalLM`. Since `PeftModel` hides base models input arguments, if label_names is not given, label_names can't be set automatically within `Trainer`. Note that empty label_names list will be used instead.\n"
|
404 |
+
]
|
405 |
+
}
|
406 |
+
],
|
407 |
+
"source": [
|
408 |
+
"from trl import SFTTrainer\n",
|
409 |
+
"from transformers import TrainingArguments\n",
|
410 |
+
"\n",
|
411 |
+
"\n",
|
412 |
+
"# Training Arguments\n",
|
413 |
+
"training_arguments = TrainingArguments(\n",
|
414 |
+
" output_dir=\"output\",\n",
|
415 |
+
" per_device_train_batch_size=1,\n",
|
416 |
+
" per_device_eval_batch_size=1,\n",
|
417 |
+
" gradient_accumulation_steps=2,\n",
|
418 |
+
" optim=\"paged_adamw_32bit\",\n",
|
419 |
+
" num_train_epochs=1,\n",
|
420 |
+
" logging_steps=0.2,\n",
|
421 |
+
" warmup_steps=10,\n",
|
422 |
+
" logging_strategy=\"steps\",\n",
|
423 |
+
" learning_rate=2e-4,\n",
|
424 |
+
" fp16=False,\n",
|
425 |
+
" bf16=False,\n",
|
426 |
+
" group_by_length=True,\n",
|
427 |
+
" report_to=\"none\"\n",
|
428 |
+
")\n",
|
429 |
+
"\n",
|
430 |
+
"# Initialize the Trainer\n",
|
431 |
+
"trainer = SFTTrainer(\n",
|
432 |
+
" model=model,\n",
|
433 |
+
" args=training_arguments,\n",
|
434 |
+
" train_dataset=dataset,\n",
|
435 |
+
" peft_config=peft_config,\n",
|
436 |
+
" data_collator=data_collator,\n",
|
437 |
+
")"
|
438 |
+
]
|
439 |
+
},
|
440 |
+
{
|
441 |
+
"cell_type": "markdown",
|
442 |
+
"metadata": {},
|
443 |
+
"source": [
|
444 |
+
"## Model Training"
|
445 |
+
]
|
446 |
+
},
|
447 |
+
{
|
448 |
+
"cell_type": "code",
|
449 |
+
"execution_count": 19,
|
450 |
+
"metadata": {},
|
451 |
+
"outputs": [
|
452 |
+
{
|
453 |
+
"data": {
|
454 |
+
"text/html": [
|
455 |
+
"\n",
|
456 |
+
" <div>\n",
|
457 |
+
" \n",
|
458 |
+
" <progress value='500' max='500' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
|
459 |
+
" [500/500 07:20, Epoch 1/1]\n",
|
460 |
+
" </div>\n",
|
461 |
+
" <table border=\"1\" class=\"dataframe\">\n",
|
462 |
+
" <thead>\n",
|
463 |
+
" <tr style=\"text-align: left;\">\n",
|
464 |
+
" <th>Step</th>\n",
|
465 |
+
" <th>Training Loss</th>\n",
|
466 |
+
" </tr>\n",
|
467 |
+
" </thead>\n",
|
468 |
+
" <tbody>\n",
|
469 |
+
" <tr>\n",
|
470 |
+
" <td>100</td>\n",
|
471 |
+
" <td>1.452900</td>\n",
|
472 |
+
" </tr>\n",
|
473 |
+
" <tr>\n",
|
474 |
+
" <td>200</td>\n",
|
475 |
+
" <td>1.366900</td>\n",
|
476 |
+
" </tr>\n",
|
477 |
+
" <tr>\n",
|
478 |
+
" <td>300</td>\n",
|
479 |
+
" <td>1.285200</td>\n",
|
480 |
+
" </tr>\n",
|
481 |
+
" <tr>\n",
|
482 |
+
" <td>400</td>\n",
|
483 |
+
" <td>1.324600</td>\n",
|
484 |
+
" </tr>\n",
|
485 |
+
" <tr>\n",
|
486 |
+
" <td>500</td>\n",
|
487 |
+
" <td>1.345900</td>\n",
|
488 |
+
" </tr>\n",
|
489 |
+
" </tbody>\n",
|
490 |
+
"</table><p>"
|
491 |
+
],
|
492 |
+
"text/plain": [
|
493 |
+
"<IPython.core.display.HTML object>"
|
494 |
+
]
|
495 |
+
},
|
496 |
+
"metadata": {},
|
497 |
+
"output_type": "display_data"
|
498 |
+
},
|
499 |
+
{
|
500 |
+
"data": {
|
501 |
+
"text/plain": [
|
502 |
+
"TrainOutput(global_step=500, training_loss=1.3550911560058594, metrics={'train_runtime': 442.2688, 'train_samples_per_second': 2.261, 'train_steps_per_second': 1.131, 'total_flos': 8.592683944836096e+16, 'train_loss': 1.3550911560058594})"
|
503 |
+
]
|
504 |
+
},
|
505 |
+
"execution_count": 19,
|
506 |
+
"metadata": {},
|
507 |
+
"output_type": "execute_result"
|
508 |
+
}
|
509 |
+
],
|
510 |
+
"source": [
|
511 |
+
"import gc, torch\n",
|
512 |
+
"gc.collect()\n",
|
513 |
+
"torch.cuda.empty_cache()\n",
|
514 |
+
"model.config.use_cache = False\n",
|
515 |
+
"trainer.train()"
|
516 |
+
]
|
517 |
+
},
|
518 |
+
{
|
519 |
+
"cell_type": "markdown",
|
520 |
+
"metadata": {},
|
521 |
+
"source": [
|
522 |
+
"## Model inference after fine-tuning"
|
523 |
+
]
|
524 |
+
},
|
525 |
+
{
|
526 |
+
"cell_type": "code",
|
527 |
+
"execution_count": 21,
|
528 |
+
"metadata": {},
|
529 |
+
"outputs": [
|
530 |
+
{
|
531 |
+
"name": "stdout",
|
532 |
+
"output_type": "stream",
|
533 |
+
"text": [
|
534 |
+
"<think><|im_end|>First, I need to figure out what the employee contributions were for the years 2002 and 2003. Okay, looking at the numbers, I see that the company contributed $979,000 in 2002 and $825,000 in 2003. So, those are my two key figures. \n",
|
535 |
+
"\n",
|
536 |
+
"Next, I'll calculate the change in the contribution amount. To find this, I subtract the 2003 contribution from the 2002 contribution. Let me do that: $979,000 minus $825,000 equals $154,000. So, there's a decrease of $154,000 from 2002 to 2003.\n",
|
537 |
+
"\n",
|
538 |
+
"Now, I need to understand what this decrease means in terms of percentage. Percentage change is usually calculated by taking the change, dividing it by the original number, and then multiplying by 100. So, I'll take that $154,000 change and divide it by the 2002 amount, $979,000. \n",
|
539 |
+
"\n",
|
540 |
+
"Let me do that math: $154,000 divided by $979,000... Hmm, this gives me a value of approximately 0.1573. \n",
|
541 |
+
"\n",
|
542 |
+
"Finally, I multiply that by 100 to convert it to a percentage. That gives me about 15.73%. \n",
|
543 |
+
"\n",
|
544 |
+
"Oh, wait, let me make sure everything makes sense. I calculated the change in contributions correctly by subtracting the 2003 amount from the 2002 amount. Then I used the original amount from 2002 as the base for the percentage calculation. \n",
|
545 |
+
"\n",
|
546 |
+
"Yes, that all seems right. So, the employee contribution decreased by approximately 15.73% from 2002 to 2003.</think>The percentage decrease in the employee contribution from 2002 to 2003 was approximately 15.73%.<|im_end|>\n"
|
547 |
+
]
|
548 |
+
}
|
549 |
+
],
|
550 |
+
"source": [
|
551 |
+
"question = dataset[20]['Open-ended Verifiable Question']\n",
|
552 |
+
"inputs = tokenizer(\n",
|
553 |
+
" [inference_prompt_style.format(question, \"\") + tokenizer.eos_token],\n",
|
554 |
+
" return_tensors=\"pt\"\n",
|
555 |
+
").to(\"cuda\")\n",
|
556 |
+
"\n",
|
557 |
+
"outputs = model.generate(\n",
|
558 |
+
" input_ids=inputs.input_ids,\n",
|
559 |
+
" attention_mask=inputs.attention_mask,\n",
|
560 |
+
" max_new_tokens=1200,\n",
|
561 |
+
" eos_token_id=tokenizer.eos_token_id,\n",
|
562 |
+
" use_cache=True,\n",
|
563 |
+
")\n",
|
564 |
+
"response = tokenizer.batch_decode(outputs)\n",
|
565 |
+
"print(response[0].split(\"<|im_start|>assistant<|im_sep|>\")[1])"
|
566 |
+
]
|
567 |
+
},
|
568 |
+
{
|
569 |
+
"cell_type": "code",
|
570 |
+
"execution_count": 22,
|
571 |
+
"metadata": {},
|
572 |
+
"outputs": [
|
573 |
+
{
|
574 |
+
"name": "stdout",
|
575 |
+
"output_type": "stream",
|
576 |
+
"text": [
|
577 |
+
"<think><|im_end|>Okay, let's figure out how much of the long-term debt should be considered current liabilities. So, the total long-term debt at the end of 2011 was $1859 million. Now, I remember that there's some information about the timing of cash payments related to this debt. In particular, there's a chunk of $29 million that is due in 2012. Hmm, that's the part that's likely to become a current liability. \n",
|
578 |
+
"\n",
|
579 |
+
"Let’s check the table again to make sure. It says total long-term debt is $1859 million, and the breakdown of estimated cash payments includes $29 million for 2012. Yep, that seems to align. So, this $29 million should be classified as a current liability because it's due within the next year. \n",
|
580 |
+
"\n",
|
581 |
+
"But wait, let me double-check. The table is pretty straightforward: long-term debt is $1859 million and the breakdown clearly shows $29 million due in 2012. So, that $29 million is the part that should be on the current liabilities section of the balance sheet. \n",
|
582 |
+
"\n",
|
583 |
+
"Alright, so I'm confident that the portion of the long-term debt that's included in current liabilities as of December 31, 2011, is $29 million. That's it!</think>The portion of the long-term debt included in the current liabilities on the balance sheet as of December 31, 2011, is $29 million. This $29 million represents the amount of debt due within the next year, making it a current liability.<|im_end|>\n"
|
584 |
+
]
|
585 |
+
}
|
586 |
+
],
|
587 |
+
"source": [
|
588 |
+
"question = dataset[200]['Open-ended Verifiable Question']\n",
|
589 |
+
"inputs = tokenizer(\n",
|
590 |
+
" [inference_prompt_style.format(question, \"\") + tokenizer.eos_token],\n",
|
591 |
+
" return_tensors=\"pt\"\n",
|
592 |
+
").to(\"cuda\")\n",
|
593 |
+
"\n",
|
594 |
+
"outputs = model.generate(\n",
|
595 |
+
" input_ids=inputs.input_ids,\n",
|
596 |
+
" attention_mask=inputs.attention_mask,\n",
|
597 |
+
" max_new_tokens=1200,\n",
|
598 |
+
" eos_token_id=tokenizer.eos_token_id,\n",
|
599 |
+
" use_cache=True,\n",
|
600 |
+
")\n",
|
601 |
+
"response = tokenizer.batch_decode(outputs)\n",
|
602 |
+
"print(response[0].split(\"<|im_start|>assistant<|im_sep|>\")[1])"
|
603 |
+
]
|
604 |
+
},
|
605 |
+
{
|
606 |
+
"cell_type": "markdown",
|
607 |
+
"metadata": {},
|
608 |
+
"source": [
|
609 |
+
"## Saving the model"
|
610 |
+
]
|
611 |
+
},
|
612 |
+
{
|
613 |
+
"cell_type": "code",
|
614 |
+
"execution_count": 23,
|
615 |
+
"metadata": {},
|
616 |
+
"outputs": [
|
617 |
+
{
|
618 |
+
"data": {
|
619 |
+
"application/vnd.jupyter.widget-view+json": {
|
620 |
+
"model_id": "353b85ce8ef84ff1980867ff5547abc0",
|
621 |
+
"version_major": 2,
|
622 |
+
"version_minor": 0
|
623 |
+
},
|
624 |
+
"text/plain": [
|
625 |
+
"Uploading...: 0%| | 0.00/341M [00:00<?, ?B/s]"
|
626 |
+
]
|
627 |
+
},
|
628 |
+
"metadata": {},
|
629 |
+
"output_type": "display_data"
|
630 |
+
},
|
631 |
+
{
|
632 |
+
"name": "stderr",
|
633 |
+
"output_type": "stream",
|
634 |
+
"text": [
|
635 |
+
"No files have been modified since last commit. Skipping to prevent empty commit.\n"
|
636 |
+
]
|
637 |
+
},
|
638 |
+
{
|
639 |
+
"data": {
|
640 |
+
"text/plain": [
|
641 |
+
"CommitInfo(commit_url='https://huggingface.co/kingabzpro/Phi-4-Reasoning-Plus-FinQA-COT/commit/a18b837a05dc0a83729c7f0bab1a8e39a91b7774', commit_message='Upload tokenizer', commit_description='', oid='a18b837a05dc0a83729c7f0bab1a8e39a91b7774', pr_url=None, repo_url=RepoUrl('https://huggingface.co/kingabzpro/Phi-4-Reasoning-Plus-FinQA-COT', endpoint='https://huggingface.co', repo_type='model', repo_id='kingabzpro/Phi-4-Reasoning-Plus-FinQA-COT'), pr_revision=None, pr_num=None)"
|
642 |
+
]
|
643 |
+
},
|
644 |
+
"execution_count": 23,
|
645 |
+
"metadata": {},
|
646 |
+
"output_type": "execute_result"
|
647 |
+
}
|
648 |
+
],
|
649 |
+
"source": [
|
650 |
+
"new_model_name = \"Phi-4-Reasoning-Plus-FinQA-COT\"\n",
|
651 |
+
"model.push_to_hub(new_model_name)\n",
|
652 |
+
"tokenizer.push_to_hub(new_model_name)"
|
653 |
+
]
|
654 |
+
}
|
655 |
+
],
|
656 |
+
"metadata": {
|
657 |
+
"kaggle": {
|
658 |
+
"accelerator": "nvidiaTeslaT4",
|
659 |
+
"dataSources": [
|
660 |
+
{
|
661 |
+
"modelId": 322000,
|
662 |
+
"modelInstanceId": 301517,
|
663 |
+
"sourceId": 363139,
|
664 |
+
"sourceType": "modelInstanceVersion"
|
665 |
+
}
|
666 |
+
],
|
667 |
+
"dockerImageVersionId": 31011,
|
668 |
+
"isGpuEnabled": true,
|
669 |
+
"isInternetEnabled": true,
|
670 |
+
"language": "python",
|
671 |
+
"sourceType": "notebook"
|
672 |
+
},
|
673 |
+
"kernelspec": {
|
674 |
+
"display_name": "Python 3 (ipykernel)",
|
675 |
+
"language": "python",
|
676 |
+
"name": "python3"
|
677 |
+
},
|
678 |
+
"language_info": {
|
679 |
+
"codemirror_mode": {
|
680 |
+
"name": "ipython",
|
681 |
+
"version": 3
|
682 |
+
},
|
683 |
+
"file_extension": ".py",
|
684 |
+
"mimetype": "text/x-python",
|
685 |
+
"name": "python",
|
686 |
+
"nbconvert_exporter": "python",
|
687 |
+
"pygments_lexer": "ipython3",
|
688 |
+
"version": "3.11.11"
|
689 |
+
}
|
690 |
+
},
|
691 |
+
"nbformat": 4,
|
692 |
+
"nbformat_minor": 4
|
693 |
+
}
|