forked from unslothai/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_all_notebooks.py
More file actions
1988 lines (1678 loc) · 83.4 KB
/
update_all_notebooks.py
File metadata and controls
1988 lines (1678 loc) · 83.4 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import argparse
import json
import os
import re
import shutil
import subprocess
from datetime import datetime
from glob import glob
from nbconvert import PythonExporter
import nbformat
def update_old_unsloth(filename):
with open(filename, "r", encoding = "utf-8") as f: f = f.read()
# Convert versions like X.X.X to 2025.12.8
f = re.sub(r"[\d]{4}\.[\d]{1,2}\.[\d]{1,2}([^\d])", r"2025.12.8\1", f)
# Fix all A=A to A = A
# " id2label=id2label,\n",
f = re.sub(
r'(\"[ ]{4,}[^\= ]{2,})\=([^\= ]{2,}\,\\n\"\,)',
r"\1 = \2",
f,
)
# Change gguf-quantization-options link
f = f.replace(
"https://github.com/unslothai/unsloth/wiki#gguf-quantization-options",
"https://docs.unsloth.ai/basics/inference-and-deployment/saving-to-gguf#locally"
)
# Fix dangling newlines like
"""
if False:
model.push_to_hub("hf/model", token = "")
tokenizer.push_to_hub("hf/model", token = "")
"""
f = re.sub(r"\)\\n([\"\']\n[ ]{2,}\])", r")\1", f)
# Redirect Alpaca dataset
f = f.replace(
"https://huggingface.co/datasets/yahma/alpaca-cleaned",
"https://huggingface.co/datasets/unsloth/alpaca-cleaned",
)
f = f.replace(
"Alpaca dataset from [yahma]",
"[Alpaca dataset]",
)
# Train on completions
f = f.replace(
"TRL's docs [here](https://huggingface.co/docs/trl/sft_trainer#train-on-completions-only).",
"our docs [here](https://docs.unsloth.ai/get-started/fine-tuning-llms-guide/lora-hyperparameters-guide#training-on-completions-only-masking-out-inputs)",
)
# Conversational notebook
f = f.replace(
"conversational [notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3_(8B)-Alpaca.ipynb)",
"conversational [notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(1B_and_3B)-Conversational.ipynb)",
)
# Fix Meta-Llama
f = f.replace(
"unsloth/Meta-Llama",
"unsloth/Llama",
)
# Move dtype into calling
if '"dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+\n",\n ' in f and \
'" dtype = dtype,\n",' in f:
f = f.replace(
'"dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+\n",\n ',
'',
)
f = f.replace(
'" dtype = dtype,\n",',
'" dtype = dtype, # None for auto detection. Float16 for T4, Bfloat16 for Ampere, H100+\n",',
)
# TRL's `DPOTrainer`
f = f.replace("TRL's `DPOTrainer`", "`DPOTrainer` and `GRPOTrainer` for reinforcement learning!")
# Move packing = ...
packing = '''" packing = False, # Can make training 5x faster for short sequences.\n",
" args = SFTConfig(\n",'''
if packing in f:
f = f.replace(packing, "")
f = f.replace(
'''" max_steps = 60,\n",
''',
'''"" max_steps = 60,\n",
" packing = False, # Makes training 2-5x faster for short sequences,\n",
''')
# VLLM to vLLM
f = f.replace("VLLM", "vLLM")
f = f.replace(
"You can go to https://huggingface.co/settings/tokens for your personal tokens.",
"You can go to https://huggingface.co/settings/tokens for your personal tokens. See [our docs](https://docs.unsloth.ai/basics/inference-and-deployment) for more deployment options."
)
# Fix saving for LoRA adapters only
f = f.replace('model.save_pretrained(\"model\")', 'model.save_pretrained(\"lora_model\")')
f = f.replace('tokenizer.save_pretrained(\"model\")', 'tokenizer.save_pretrained(\"lora_model\")')
f = f.replace('model.push_to_hub(\"hf/model\", token = \"\")', 'model.push_to_hub(\"hf/lora_model\", token = \"\")')
f = f.replace('tokenizer.push_to_hub(\"hf/model\", token = \"\")', 'tokenizer.push_to_hub(\"hf/lora_model\", token = \"\")')
# Fix 16bit
f = f.replace('model.save_pretrained_merged(\"model\", tokenizer, save_method = \"merged_16bit\",)', 'model.save_pretrained_merged(\"model_16bit\", tokenizer, save_method = \"merged_16bit\",)')
f = f.replace('model.push_to_hub_merged(\"hf/model\", tokenizer, save_method = \"merged_16bit\", token = \"\")', 'model.push_to_hub_merged(\"hf/model_16bit\", tokenizer, save_method = \"merged_16bit\", token = \"\")')
# Fix 4bit
f = f.replace('model.save_pretrained_merged(\"model\", tokenizer, save_method = \"merged_4bit\",)', 'model.save_pretrained_merged(\"model_4bit\", tokenizer, save_method = \"merged_4bit\",)')
f = f.replace('model.push_to_hub_merged(\"hf/model\", tokenizer, save_method = \"merged_4bit\", token = \"\")', 'model.push_to_hub_merged(\"hf/model_4bit\", tokenizer, save_method = \"merged_4bit\", token = \"\")')
with open(filename, "w", encoding = "utf-8") as w: w.write(f)
pass
DONT_UPDATE_EXCEPTIONS = [
"Falcon_H1-Alpaca.ipynb",
"Liquid_LFM2-Conversational.ipynb",
"Advanced_Llama3_1_(3B)_GRPO_LoRA.ipynb", # Daniel's?
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb",
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game_DGX_Spark.ipynb",
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb",
"Qwen3_VL_(8B)-Vision-GRPO.ipynb",
"OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb",
"OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb",
"Synthetic_Data_Hackathon.ipynb",
"Ministral_3_(3B)_Reinforcement_Learning_Sudoku_Game.ipynb"
]
FIRST_MAPPING_NAME = {
"gpt-oss-(20B)-Fine-tuning.ipynb" : "gpt_oss_(20B)-Fine-tuning.ipynb",
"Qwen2_5_7B_VL_GRPO.ipynb" : "Qwen2.5_VL_(7B)-Vision-GRPO.ipynb",
"Qwen3_(4B)-Instruct.ipynb" : "Qwen3_(4B)-Conversational.ipynb",
"Qwen3_(4B)_Instruct-QAT.ipynb" : "Qwen3_(4B)-QAT.ipynb",
# GPT OSS
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game_DGX_Spark.ipynb" : "(DGX Spark)-gpt-oss-(20B)-GRPO-2048.ipynb",
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb" : "gpt-oss-(20B)-GRPO-2048.ipynb",
"Deepseek_OCR_(3B).ipynb" : "Deepseek_OCR_(3B)-Fine-Tuning.ipynb",
"OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb" : "(OpenEnv)-gpt-oss-BF16-(20B)-GRPO-2048.ipynb",
"gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb" : "gpt-oss-BF16-(20B)-GRPO-2048.ipynb",
"OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb" : "(OpenEnv)-gpt-oss-(20B)-GRPO-2048.ipynb",
"GPT_OSS_BNB_(20B)-Inference.ipynb" : "gpt-oss-BNB-(20B)-Inference.ipynb",
"GPT_OSS_MXFP4_(20B)-Inference.ipynb" : "gpt-oss-MXFP4-(20B)-Inference.ipynb",
"gpt_oss_(20B)_500K_Context_Fine_tuning" : "gpt_oss_(20B)-500K-Context.ipynb",
# Gemma
"Gemma3_(4B).ipynb" : "Gemma3_(4B)-Conversational.ipynb",
"Gemma3_(270M).ipynb" : "Gemma3_(270M)-Conversational.ipynb",
# Granite
"Granite4.0_350M.ipynb" : "Granite4.0_(350M)-Conversational.ipynb",
"Granite4.0.ipynb" : "Granite4.0_(3B)-Conversational.ipynb",
# Bert
"bert_classification.ipynb" : "ModernBERT_(Large)-Classification.ipynb",
# Whisper
"Whisper.ipynb" : "Whisper_(Large)-Fine-Tuning.ipynb",
# Spark
"Spark_TTS_(0_5B).ipynb" : "Spark_TTS_(0.5B)-TTS.ipynb",
# FP8
"Qwen3_8B_FP8_GRPO.ipynb" : "Qwen3_(8B)-FP8-GRPO.ipynb",
"Llama_FP8_GRPO.ipynb" : "Llama3.2_(1B)-FP8-GRPO.ipynb",
# Ministral
"Ministral_3_VL_(3B)_Vision.ipynb" : "Ministral3_VL_(3B)-Vision.ipynb",
"Ministral_3_(3B)_Reinforcement_Learning_Sudoku_Game.ipynb" : "Ministral3_(3B)-GRPO-Sudoku.ipynb"
}
def get_current_git_branch():
try:
# Run the git command to get the current branch name
# '--abbrev-ref HEAD' gives the branch name (e.g., 'main', 'feature/new-feature')
# 'STDOUT' captures standard output, 'STDERR' redirects error output
branch_name = subprocess.check_output(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
stderr=subprocess.STDOUT
).strip().decode('utf-8')
return branch_name
except subprocess.CalledProcessError as e:
print(f"Error getting Git branch: {e}")
print(f"Command output: {e.output.decode('utf-8')}")
return None
except FileNotFoundError:
print("Error: 'git' command not found. Make sure Git is installed and in your PATH.")
return None
def update_or_append_pip_install(base_content, package_name, new_install_line):
pattern = re.compile(rf"^!(uv )?pip install .*?{package_name}.*$", re.MULTILINE)
updated_content, substitutions_count = pattern.subn(new_install_line, base_content)
if substitutions_count == 0:
output = base_content.strip() + "\n" + new_install_line
else:
output = updated_content
# Convert pip install transformers==4.56.2\npip install --no-deps trl==0.22.2 to &&
finder = r"!pip install transformers==([\d\.]{3,})\n!pip install --no-deps trl==([\d\.]{3,})"
found = re.findall(finder, output)
if len(found) != 0:
transformers, trl = found[0]
new = f"!pip install transformers=={transformers} && pip install --no-deps trl=={trl}"
output = re.sub(finder, new, output)
return output
current_branch = get_current_git_branch()
# =======================================================
# GENERAL ANNOUNCEMENTS (THE VERY TOP)
# =======================================================
general_announcement_content = """To run this, press "*Runtime*" and press "*Run all*" on a **free** Tesla T4 Google Colab instance!
<div class="align-center">
<a href="https://unsloth.ai/"><img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="115"></a>
<a href="https://discord.gg/unsloth"><img src="https://github.com/unslothai/unsloth/raw/main/images/Discord button.png" width="145"></a>
<a href="https://docs.unsloth.ai/"><img src="https://github.com/unslothai/unsloth/blob/main/images/documentation%20green%20button.png?raw=true" width="125"></a></a> Join Discord if you need help + ⭐ <i>Star us on <a href="https://github.com/unslothai/unsloth">Github</a> </i> ⭐
</div>
To install Unsloth your local device, follow [our guide](https://docs.unsloth.ai/get-started/install-and-update). This notebook is licensed [LGPL-3.0](https://github.com/unslothai/notebooks?tab=LGPL-3.0-1-ov-file#readme).
You will learn how to do [data prep](#Data), how to [train](#Train), how to [run the model](#Inference), & [how to save it](#Save)"""
general_announcement_content_a100 = general_announcement_content.replace("on a **free** Tesla T4 Google Colab instance!", "on your A100 Google Colab Pro instance!")
general_announcement_content_fp8 = general_announcement_content.replace("on a **free** Tesla T4 Google Colab instance!", "on your L4 Google Colab Pro instance!")
announcement_separation = '<div class="align-center">'
general_announcement_content_hf_course = general_announcement_content.split(announcement_separation)
general_announcement_content_hf_course = general_announcement_content_hf_course[0] + announcement_separation + '<a href="https://huggingface.co/learn/nlp-course/en/chapter12/6?fw=pt"><img src="https://github.com/unslothai/notebooks/raw/main/assets/hf%20course.png" width="165"></a>' + general_announcement_content_hf_course[1]
general_announcement_content_hf_course = general_announcement_content_hf_course.split("To install Unsloth")
hf_additional_string_announcement = "In this [Hugging Face](https://huggingface.co/learn/nlp-course/en/chapter12/6?fw=pt) and Unsloth notebook, you will learn to transform {full_model_name} into a Reasoning model using GRPO."
general_announcement_content_hf_course = (
general_announcement_content_hf_course[0] +
hf_additional_string_announcement +
"\n\n" +
"To install Unsloth" + general_announcement_content_hf_course[1]
)
general_announcement_content_meta = general_announcement_content.split(announcement_separation)
general_announcement_content_meta = general_announcement_content_meta[0] + "\n\n" + '<a href="https://github.com/meta-llama/synthetic-data-kit"><img src="https://raw.githubusercontent.com/unslothai/notebooks/refs/heads/main/assets/meta%20round%20logo.png" width="137"></a>' + general_announcement_content_meta[1]
# CONSTANT
PIN_TRANSFORMERS = "!pip install transformers==4.56.2"
UV_PIN_TRANSFORMERS = PIN_TRANSFORMERS.replace("pip", "uv pip")
PIN_TRL = "!pip install --no-deps trl==0.22.2"
UV_PIN_TRL = PIN_TRL.replace("pip", "uv pip")
SPACES = " " * 4
# =======================================================
# INSTALLATION (MANY OF THIS IS SPECIFIC TO ONE OF THE NOTEBOOKS)
# =======================================================
XFORMERS_INSTALL = """xformers = 'xformers==' + {'2.9':'0.0.33.post1','2.8':'0.0.32.post2'}.get(v, "0.0.33.post1")"""
installation_content = """%%capture
import os, re
if "COLAB_" not in "".join(os.environ.keys()):
!pip install unsloth # Do this in local & cloud setups
else:
import torch; v = re.match(r'[\d]{1,}\.[\d]{1,}', str(torch.__version__)).group(0)
__XFORMERS_INSTALL__
!pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer
!pip install --no-deps unsloth_zoo bitsandbytes accelerate {xformers} peft trl triton unsloth
""".replace("__XFORMERS_INSTALL__", XFORMERS_INSTALL)
installation_content = update_or_append_pip_install(
installation_content,
"transformers",
PIN_TRANSFORMERS,
)
installation_content = update_or_append_pip_install(
installation_content,
"trl",
PIN_TRL,
)
installation_kaggle_content = """%%capture
import os
!pip install pip3-autoremove
!pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu128
!pip install unsloth
!pip install --upgrade transformers "huggingface_hub>=0.34.0" "datasets==4.3.0"
"""
installation_kaggle_content = update_or_append_pip_install(
installation_kaggle_content,
"transformers",
PIN_TRANSFORMERS,
)
installation_kaggle_content = update_or_append_pip_install(
installation_kaggle_content,
"trl",
PIN_TRL,
)
# =======================================================
# GRPO Notebook
# =======================================================
installation_grpo_content = """%%capture
import os
os.environ["UNSLOTH_VLLM_STANDBY"] = "1" # [NEW] Extra 30% context lengths!
if "COLAB_" not in "".join(os.environ.keys()):
# If you're not in Colab, just use pip install or uv pip install
!pip install unsloth vllm
else:
pass # For Colab / Kaggle, we need extra instructions hidden below \\/"""
installation_extra_grpo_content = r"""#@title Colab Extra Install { display-mode: "form" }
%%capture
import os
!pip install --upgrade -qqq uv
if "COLAB_" not in "".join(os.environ.keys()):
# If you're not in Colab, just use pip install!
!pip install unsloth vllm
else:
try: import numpy, PIL; _numpy = f'numpy=={numpy.__version__}'; _pil = f'pillow=={PIL.__version__}'
except: _numpy = "numpy"; _pil = "pillow"
try: import subprocess; is_t4 = "Tesla T4" in str(subprocess.check_output(["nvidia-smi"]))
except: is_t4 = False
_vllm, _triton = ('vllm==0.9.2', 'triton==3.2.0') if is_t4 else ('vllm==0.10.2', 'triton')
!uv pip install -qqq --upgrade {_vllm} {_numpy} {_pil} torchvision bitsandbytes xformers unsloth
!uv pip install -qqq {_triton}"""
installation_extra_grpo_content = update_or_append_pip_install(
installation_extra_grpo_content,
"transformers",
UV_PIN_TRANSFORMERS,
)
installation_extra_grpo_content = update_or_append_pip_install(
installation_extra_grpo_content,
"trl",
UV_PIN_TRL,
)
installation_grpo_kaggle_content = """%%capture
import os
os.environ["UNSLOTH_VLLM_STANDBY"] = "1" # [NEW] Extra 30% context lengths!
!pip install --upgrade -qqq uv
try: import numpy, PIL; _numpy = f'numpy=={numpy.__version__}'; _pil = f'pillow=={PIL.__version__}'
except: _numpy = "numpy"; _pil = "pillow"
try: import subprocess; is_t4 = "Tesla T4" in str(subprocess.check_output(["nvidia-smi"]))
except: is_t4 = False
_vllm, _triton = ('vllm==0.9.2', 'triton==3.2.0') if is_t4 else ('vllm==0.10.2', 'triton')
!uv pip install -qqq --upgrade {_vllm} {_numpy} {_pil} torchvision bitsandbytes xformers unsloth
!uv pip install -qqq {_triton} "huggingface_hub>=0.34.0" "datasets==4.3.0"""
installation_grpo_kaggle_content = update_or_append_pip_install(
installation_grpo_kaggle_content,
"transformers",
UV_PIN_TRANSFORMERS,
)
installation_grpo_kaggle_content = update_or_append_pip_install(
installation_grpo_kaggle_content,
"trl",
UV_PIN_TRL,
)
# =======================================================
# Meta Synthetic Data Kit Notebook
# =======================================================
installation_synthetic_data_content = """%%capture
import os
!pip install --upgrade -qqq uv
if "COLAB_" not in "".join(os.environ.keys()):
# If you're not in Colab, just use pip install!
!pip install unsloth vllm synthetic-data-kit==0.0.3
else:
try: import numpy, PIL; _numpy = f'numpy=={numpy.__version__}'; _pil = f'pillow=={PIL.__version__}'
except: _numpy = "numpy"; _pil = "pillow"
try: import subprocess; is_t4 = "Tesla T4" in str(subprocess.check_output(["nvidia-smi"]))
except: is_t4 = False
_vllm, _triton = ('vllm==0.9.2', 'triton==3.2.0') if is_t4 else ('vllm==0.10.2', 'triton')
!uv pip install -qqq --upgrade {_vllm} {_numpy} {_pil} torchvision bitsandbytes xformers unsloth
!uv pip install -qqq {_triton}
!uv pip install synthetic-data-kit==0.0.3"""
installation_synthetic_data_content = update_or_append_pip_install(
installation_synthetic_data_content,
"transformers",
UV_PIN_TRANSFORMERS,
)
installation_synthetic_data_content = update_or_append_pip_install(
installation_synthetic_data_content,
"trl",
UV_PIN_TRL,
)
installation_grpo_synthetic_data_content = """%%capture
!pip install --upgrade -qqq uv
try: import numpy, PIL; _numpy = f"numpy=={numpy.__version__}"; _pil = f"pillow=={PIL.__version__}"
except: _numpy = "numpy"; _pil = "pillow"
try: import subprocess; is_t4 = "Tesla T4" in str(subprocess.check_output(["nvidia-smi"]))
except: is_t4 = False
_vllm, _triton = ('vllm==0.9.2', 'triton==3.2.0') if is_t4 else ('vllm==0.10.2', 'triton')
!uv pip install -qqq --upgrade unsloth {_vllm} {_numpy} {_pil} torchvision bitsandbytes xformers
!uv pip install -qqq {_triton}
!uv pip install "huggingface_hub>=0.34.0" "datasets==4.3.0"
!uv pip install synthetic-data-kit==0.0.3"""
installation_grpo_synthetic_data_content = update_or_append_pip_install(
installation_grpo_synthetic_data_content,
"transformers",
UV_PIN_TRANSFORMERS,
)
installation_grpo_synthetic_data_content = update_or_append_pip_install(
installation_grpo_synthetic_data_content,
"trl",
UV_PIN_TRL,
)
# =======================================================
# Orpheus Notebook
# =======================================================
# Add install snac under install unsloth
installation_orpheus_content = installation_content + """\n!pip install snac torchcodec \"datasets>=3.4.1,<4.0.0\""""
installation_orpheus_kaggle_content = installation_kaggle_content + """\n!pip install snac torchcodec \"datasets>=3.4.1,<4.0.0\""""
# =======================================================
# Whisper Notebook
# =======================================================
installation_whisper_content = installation_content + """\n!pip install librosa soundfile evaluate jiwer torchcodec \"datasets>=3.4.1,<4.0.0\""""
installation_whisper_kaggle_content = installation_kaggle_content + """\n!pip install librosa soundfile evaluate jiwer torchcodec \"datasets>=3.4.1,<4.0.0\""""
# =======================================================
# Spark Notebook
# =======================================================
installation_spark_content = installation_content + """\n!git clone https://github.com/SparkAudio/Spark-TTS
!pip install omegaconf einx torchcodec \"datasets>=3.4.1,<4.0.0\""""
installation_spark_kaggle_content = installation_kaggle_content + """\n!git clone https://github.com/SparkAudio/Spark-TTS
!pip install omegaconf einx torchcodec \"datasets>=3.4.1,<4.0.0\""""
# =======================================================
# GPT OSS Notebook
# =======================================================
installation_gpt_oss_content = r"""%%capture
import os, importlib.util
!pip install --upgrade -qqq uv
if importlib.util.find_spec("torch") is None or "COLAB_" in "".join(os.environ.keys()):
try: import numpy, PIL; _numpy = f"numpy=={numpy.__version__}"; _pil = f"pillow=={PIL.__version__}"
except: _numpy = "numpy"; _pil = "pillow"
!uv pip install -qqq \
"torch>=2.8.0" "triton>=3.4.0" {_numpy} {_pil} torchvision bitsandbytes "transformers==4.56.2" \
"unsloth_zoo[base] @ git+https://github.com/unslothai/unsloth-zoo" \
"unsloth[base] @ git+https://github.com/unslothai/unsloth" \
git+https://github.com/triton-lang/triton.git@0add68262ab0a2e33b84524346cb27cbb2787356#subdirectory=python/triton_kernels
elif importlib.util.find_spec("unsloth") is None:
!uv pip install -qqq unsloth
!uv pip install --upgrade --no-deps transformers==4.56.2 tokenizers trl==0.22.2 unsloth unsloth_zoo"""
# installation_gpt_oss_content = update_or_append_pip_install(
# installation_gpt_oss_content,
# "transformers",
# "!uv pip install transformers==4.56.2",
# )
# installation_gpt_oss_content = update_or_append_pip_install(
# installation_gpt_oss_content,
# "trl",
# UV_PIN_TRL,
# )
installation_gpt_oss_kaggle_content = installation_gpt_oss_content
# =======================================================
# Oute Notebook
# =======================================================
installation_oute_content = installation_content + """\n!pip install omegaconf einx
!rm -rf OuteTTS && git clone https://github.com/edwko/OuteTTS
import os
os.remove("/content/OuteTTS/outetts/models/gguf_model.py")
os.remove("/content/OuteTTS/outetts/interface.py")
os.remove("/content/OuteTTS/outetts/__init__.py")
!pip install pyloudnorm openai-whisper uroman MeCab loguru flatten_dict ffmpy randomname argbind tiktoken ftfy torchcodec \"datasets>=3.4.1,<4.0.0\"
!pip install descript-audio-codec descript-audiotools julius openai-whisper --no-deps
%env UNSLOTH_DISABLE_FAST_GENERATION = 1"""
installation_oute_kaggle_content = installation_kaggle_content + """\n!pip install omegaconf einx
!rm -rf OuteTTS && git clone https://github.com/edwko/OuteTTS
import os
os.remove("/content/OuteTTS/outetts/models/gguf_model.py")
os.remove("/content/OuteTTS/outetts/interface.py")
os.remove("/content/OuteTTS/outetts/__init__.py")
!pip install pyloudnorm openai-whisper uroman MeCab loguru flatten_dict ffmpy randomname argbind tiktoken ftfy torchcodec \"datasets>=3.4.1,<4.0.0\"
!pip install descript-audio-codec descript-audiotools julius openai-whisper --no-deps
%env UNSLOTH_DISABLE_FAST_GENERATION = 1"""
# =======================================================
# Llasa Notebook
# =======================================================
# Llasa Need Unsloth==2025.4.1, Transformers==4.48 to running stable, and trl ==0.15.2
# installation_llasa_content = re.sub(r'\bunsloth\b(==[\d\.]*)?', 'unsloth==2025.4.1', installation_content)
installation_llasa_content = installation_content
installation_llasa_content = re.sub(r'\btrl\b(==[\d\.]*)?', 'trl==0.15.2', installation_llasa_content)
installation_llasa_content += """\
!pip install torchtune torchao vector_quantize_pytorch einx tiktoken xcodec2==0.1.5 --no-deps
!pip install omegaconf torchcodec \"datasets>=3.4.1,<4.0.0\"
%env UNSLOTH_DISABLE_FAST_GENERATION = 1"""
installation_llasa_content = update_or_append_pip_install(
installation_llasa_content,
"transformers",
"!pip install transformers==4.56.1",
)
installation_llasa_kaggle_content = installation_kaggle_content + """\n!pip install torchtune torchao vector_quantize_pytorch einx tiktoken xcodec2==0.1.5 --no-deps
!pip install omegaconf torchcodec \"datasets>=3.4.1,<4.0.0\"
%env UNSLOTH_DISABLE_FAST_GENERATION = 1"""
installation_llasa_kaggle_content = update_or_append_pip_install(
installation_llasa_kaggle_content,
"transformers",
"!pip install transformers==4.48",
)
installation_llasa_kaggle_content = update_or_append_pip_install(
installation_llasa_kaggle_content,
"trl",
PIN_TRL,
)
# =======================================================
# Tool Calling Notebook
# =======================================================
installation_tool_calling_content = installation_content + """\n!pip install protobuf==3.20.3 # required
!pip install --no-deps transformers-cfg"""
installation_tool_calling_kaggle_content = installation_kaggle_content + """\n!pip install protobuf==3.20.3 # required
!pip install --no-deps transformers-cfg"""
# =======================================================
# Sesame CSM Notebook
# =======================================================
installation_sesame_csm_content = installation_content + """\n!pip install torchcodec \"datasets>=3.4.1,<4.0.0\""""
installation_sesame_csm_content = update_or_append_pip_install(
installation_sesame_csm_content,
"transformers",
"!pip install transformers==4.52.3",
)
installation_sesame_csm_content = update_or_append_pip_install(
installation_sesame_csm_content,
"trl",
PIN_TRL
)
installation_sesame_csm_kaggle_content = installation_kaggle_content + """\n!pip install torchcodec \"datasets>=3.4.1,<4.0.0\""""
installation_sesame_csm_kaggle_content = update_or_append_pip_install(
installation_sesame_csm_kaggle_content,
"transformers",
"!pip install transformers==4.52.3 torchcodec",
)
installation_sesame_csm_kaggle_content = update_or_append_pip_install(
installation_sesame_csm_kaggle_content,
"trl",
PIN_TRL
)
# =======================================================
# Llama Vision Notebook
# =======================================================
installation_llama_vision_content = installation_content
installation_llama_vision_content = update_or_append_pip_install(
installation_llama_vision_content,
"transformers",
PIN_TRANSFORMERS,
)
installation_llama_vision_content = update_or_append_pip_install(
installation_llama_vision_content,
"trl",
PIN_TRL
)
installation_llama_vision_kaggle_content = installation_kaggle_content
installation_llama_vision_kaggle_content = update_or_append_pip_install(
installation_llama_vision_kaggle_content,
"transformers",
PIN_TRANSFORMERS,
)
installation_llama_vision_kaggle_content = update_or_append_pip_install(
installation_llama_vision_kaggle_content,
"trl",
PIN_TRL
)
# =======================================================
# Gemma3N Notebook
# =======================================================
gemma3n_extra_content = """\
!pip install torchcodec
import torch; torch._dynamo.config.recompile_limit = 64;"""
installation_gemma3n_content = installation_content
installation_gemma3n_content += gemma3n_extra_content
installation_gemma3n_kaggle_content = installation_kaggle_content
installation_gemma3n_kaggle_content += gemma3n_extra_content
# =======================================================
# Qwen3VL Notebook
# =======================================================
gemma3n_extra_content = """\
!pip install torchcodec
import torch; torch._dynamo.config.recompile_limit = 64;"""
installation_qwen3_vl_content = installation_content
installation_qwen3_vl_content = update_or_append_pip_install(
installation_qwen3_vl_content,
"transformers",
"!pip install transformers==4.57.1",
)
installation_qwen3_vl_kaggle_content = installation_kaggle_content
installation_qwen3_vl_kaggle_content = update_or_append_pip_install(
installation_qwen3_vl_kaggle_content,
"transformers",
"!pip install transformers==4.57.1",
)
# =======================================================
# SGLang Notebook
# =======================================================
installation_sglang_content = """%%capture
import sys
import os
!git clone https://github.com/sgl-project/sglang.git && cd sglang && pip install -e "python[all]"
!pip install -U transformers==4.53.0
sys.path.append(f'{os.getcwd()}/sglang/')
sys.path.append(f'{os.getcwd()}/sglang/python')"""
installation_sglang_kaggle_content = installation_sglang_content
# =======================================================
# Deepseek OCR Notebook
# =======================================================
installation_deepseek_ocr_content = installation_content
installation_deepseek_ocr_content += """\n!pip install jiwer
!pip install einops addict easydict"""
installation_deepseek_ocr_kaggle_content = installation_kaggle_content
installation_deepseek_ocr_kaggle_content += """\n!pip install jiwer
!pip install einops addict easydict"""
# =======================================================
# ERNIE_4_5_VL Notebook
# =======================================================
installation_ernie_4_5_vl_content = installation_content
installation_ernie_4_5_vl_content += """\n!pip install decord"""
installation_ernie_4_5_vl_kaggle_content = installation_kaggle_content
installation_ernie_4_5_vl_kaggle_content += """\n!pip install decord"""
# =======================================================
# Nemotron 3 Nano Notebook
# =======================================================
installation_nemotron_nano_content = """%%capture
import os, importlib.util
!pip install --upgrade -qqq uv
if importlib.util.find_spec("torch") is None or "COLAB_" in "".join(os.environ.keys()):
try: import numpy, PIL; _numpy = f"numpy=={numpy.__version__}"; _pil = f"pillow=={PIL.__version__}"
except: _numpy = "numpy"; _pil = "pillow"
!uv pip install -qqq \\
"torch==2.7.1" "triton>=3.3.0" {_numpy} {_pil} torchvision bitsandbytes "transformers==4.56.2" \\
"unsloth_zoo[base] @ git+https://github.com/unslothai/unsloth-zoo" \\
"unsloth[base] @ git+https://github.com/unslothai/unsloth"
elif importlib.util.find_spec("unsloth") is None:
!uv pip install -qqq unsloth
!uv pip install --upgrade --no-deps transformers==4.56.2 tokenizers trl==0.22.2 unsloth unsloth_zoo
# Mamba is supported only on torch==2.7.1. If you have newer torch versions, please wait 30 minutes!
!uv pip install --no-build-isolation mamba_ssm==2.2.5 causal_conv1d==1.5.2"""
installation_nemotron_nano_kaggle_content = installation_nemotron_nano_content
# =======================================================
# QAT Notebook
# =======================================================
installation_qat_content = """%%capture
import os, re
if "COLAB_" not in "".join(os.environ.keys()):
!pip install unsloth
else:
# Do this only in Colab notebooks! Otherwise use pip install unsloth
import torch; v = re.match(r"[0-9]{1,}\.[0-9]{1,}", str(torch.__version__)).group(0)
__XFORMERS_INSTALL__
!pip install --no-deps unsloth_zoo bitsandbytes accelerate {xformers} peft trl triton unsloth
!pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer
!pip install torchao==0.14.0 fbgemm-gpu-genai==1.4.2
!pip install transformers==4.55.4 && pip install --no-deps trl==0.22.2""".replace("__XFORMERS_INSTALL__", XFORMERS_INSTALL)
installation_qat_kaggle_content = installation_qat_content
# =======================================================
# Ministral Notebook
# =======================================================
installation_ministral_content = installation_content
installation_ministral_content = update_or_append_pip_install(
installation_ministral_content,
"transformers",
"!pip install git+https://github.com/huggingface/transformers.git@bf3f0ae70d0e902efab4b8517fce88f6697636ce"
)
installation_ministral_kaggle_content = installation_kaggle_content
installation_ministral_kaggle_content = update_or_append_pip_install(
installation_ministral_kaggle_content,
"transformers",
"!pip install git+https://github.com/huggingface/transformers.git@bf3f0ae70d0e902efab4b8517fce88f6697636ce"
)
# =======================================================
# NEWS (WILL KEEP CHANGING THIS)
# =======================================================
new_announcement = """
New 3x faster training & 30% less VRAM. New kernels, padding-free & packing. [Blog](https://docs.unsloth.ai/new/3x-faster-training-packing)
You can now train with 500K context windows on a single 80GB GPU. [Blog](https://docs.unsloth.ai/new/500k-context-length-fine-tuning)
Unsloth's [Docker image](https://hub.docker.com/r/unsloth/unsloth) is here! Start training with no setup & environment issues. [Read our Guide](https://docs.unsloth.ai/new/how-to-train-llms-with-unsloth-and-docker).
New in Reinforcement Learning: [FP8 RL](https://docs.unsloth.ai/new/fp8-reinforcement-learning) • [Vision RL](https://docs.unsloth.ai/new/vision-reinforcement-learning-vlm-rl) • [Standby](https://docs.unsloth.ai/basics/memory-efficient-rl) (faster, less VRAM RL) • [gpt-oss RL](https://docs.unsloth.ai/new/gpt-oss-reinforcement-learning)
Visit our docs for all our [model uploads](https://docs.unsloth.ai/get-started/all-our-models) and [notebooks](https://docs.unsloth.ai/get-started/unsloth-notebooks)."""
# =======================================================
# LAST BLOCK CLOSE STATEMENT
# =======================================================
OTHER_RESOURCES = """Some other resources:
1. Looking to use Unsloth locally? Read our [Installation Guide](https://docs.unsloth.ai/get-started/install-and-update) for details on installing Unsloth on Windows, Docker, AMD, Intel GPUs.
2. Learn how to do Reinforcement Learning with our [RL Guide and notebooks](https://docs.unsloth.ai/get-started/reinforcement-learning-rl-guide).
3. Read our guides and notebooks for [Text-to-speech (TTS)](https://docs.unsloth.ai/basics/text-to-speech-tts-fine-tuning) and [vision](https://docs.unsloth.ai/basics/vision-fine-tuning) model support.
4. Explore our [LLM Tutorials Directory](https://docs.unsloth.ai/models/tutorials-how-to-fine-tune-and-run-llms) to find dedicated guides for each model.
5. Need help with Inference? Read our [Inference & Deployment page](https://docs.unsloth.ai/basics/inference-and-deployment) for details on using vLLM, llama.cpp, Ollama etc.
"""
text_for_last_cell_gguf = """And we're done! If you have any questions on Unsloth, we have a [Discord](https://discord.gg/unsloth) channel! If you find any bugs or want to keep updated with the latest LLM stuff, or need help, join projects etc, feel free to join our Discord!
__OTHER_RESOURCES__
<div class="align-center">
<a href="https://unsloth.ai"><img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="115"></a>
<a href="https://discord.gg/unsloth"><img src="https://github.com/unslothai/unsloth/raw/main/images/Discord.png" width="145"></a>
<a href="https://docs.unsloth.ai/"><img src="https://github.com/unslothai/unsloth/blob/main/images/documentation%20green%20button.png?raw=true" width="125"></a>
Join Discord if you need help + ⭐️ <i>Star us on <a href="https://github.com/unslothai/unsloth">Github</a> </i> ⭐️
<b>This notebook and all Unsloth notebooks are licensed [LGPL-3.0](https://github.com/unslothai/notebooks?tab=LGPL-3.0-1-ov-file#readme)</b>
</div>""".replace("__OTHER_RESOURCES__", OTHER_RESOURCES)
text_for_last_cell_ollama = text_for_last_cell_gguf.replace("Now, ", "You can also ", 1)
text_for_last_cell_gemma3 = text_for_last_cell_gguf.replace("model-unsloth", "gemma-3-finetune")
text_for_last_cell_non_gguf = """And we're done! If you have any questions on Unsloth, we have a [Discord](https://discord.gg/unsloth) channel! If you find any bugs or want to keep updated with the latest LLM stuff, or need help, join projects etc, feel free to join our Discord!
__OTHER_RESOURCES__
<div class="align-center">
<a href="https://unsloth.ai"><img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="115"></a>
<a href="https://discord.gg/unsloth"><img src="https://github.com/unslothai/unsloth/raw/main/images/Discord.png" width="145"></a>
<a href="https://docs.unsloth.ai/"><img src="https://github.com/unslothai/unsloth/blob/main/images/documentation%20green%20button.png?raw=true" width="125"></a>
Join Discord if you need help + ⭐️ <i>Star us on <a href="https://github.com/unslothai/unsloth">Github</a> </i> ⭐️
This notebook and all Unsloth notebooks are licensed [LGPL-3.0](https://github.com/unslothai/notebooks?tab=LGPL-3.0-1-ov-file#readme)
</div>""".replace("__OTHER_RESOURCES__", OTHER_RESOURCES)
hf_course_name = "HuggingFace Course"
ARCHITECTURE_MAPPING = {
# Gemma Family
"gemma": "Gemma",
"codegemma": "Gemma", # Explicitly map specific models if needed
# Llama Family
"llama": "Llama",
"tinylama": "Llama",
# Qwen Family
"qwen": "Qwen",
# Phi Family
"phi": "Phi",
# Mistral Family
"mistral": "Mistral",
"pixtral": "Mistral",
"zephyr": "Mistral",
"Magistral" : "Mistral",
"Ministral" : "Mistral",
# Whisper
"whisper": "Whisper",
# Text-to-Speech Models (Group or keep separate?)
"oute": "TTS",
"llasa": "TTS",
"spark": "TTS",
"orpheus": "TTS",
"sesame": "TTS",
# gpt oss
"gpt oss": "GPT-OSS",
# Linear Attention
"falcon": "Linear Attention",
"liquid": "Linear Attention",
# Deepseek
"deepseek": "Deepseek",
# Granite
"granite": "Granite",
# Bert
"bert": "BERT",
"modernbert": "BERT",
# Other Models (Assign architecture or keep specific)
# 'codeforces': 'CodeForces Model', # Example
# 'unsloth': 'Unsloth Model', # Example
"meta synthetic data": "Llama",
}
TYPE_MAPPING = {
"Gemma3N" : {
"Conversational" : "Multimodal"
},
"Meta Synthetic Data" : {
"Synthetic Data" : "GRPO",
"GRPO LoRA" : "GRPO"
},
}
KNOWN_TYPES_ORDERED = [
"Tool Calling",
"Text Completion",
"Synthetic Data",
"Reasoning Conversational",
"Vision GRPO",
"Fine Tuning",
"500K Context",
"QAT",
"Conversational",
"Alpaca",
"Vision",
"Reasoning",
"Completion",
"Finetune",
"Studio",
"Coder",
"Inference",
"Ollama",
"Audio",
"Thinking",
# FP8 GRPO
"FP8 GRPO",
# GPT OSS
"GRPO 2048",
"GRPO Sudoku",
"ORPO",
"GRPO",
"DPO",
"CPT",
"TTS",
"LoRA",
"VL",
"RAFT",
# Deepseek OCR
"Evaluation",
"Eval",
# BERT, ModernBERT,
"Classification",
]
def extract_model_info_refined(filename, architecture_mapping, known_types_ordered):
if not filename.endswith(".ipynb"):
return {'name': filename, 'size': None, 'type': None, 'architecture': None}
stem = filename[:-len(".ipynb")]
requires_a100 = False
if 'A100' in stem:
requires_a100 = True
stem = stem.replace('_A100', '')
original_stem_parts = stem.replace('+', '_').split('_')
type_ = None
stem_searchable = stem.lower().replace('_', ' ').replace('+', ' ')
found_type_indices = []
for type_keyword in known_types_ordered:
kw_lower = type_keyword.lower()
pattern = r'\b' + re.escape(kw_lower) + r'\b'
match = re.search(pattern, stem_searchable)
if match:
type_ = type_keyword
try:
kw_parts = type_keyword.split(' ')
for i in range(len(original_stem_parts) - len(kw_parts) + 1):
match_parts = True
for j in range(len(kw_parts)):
if original_stem_parts[i+j].lower() != kw_parts[j].lower():
match_parts = False
break
if match_parts:
found_type_indices = list(range(i, i + len(kw_parts)))
break
except Exception:
pass
break
size = None
size_match = re.search(r'_\((.*?)\)', stem)
size_start_index = -1
if size_match:
size = size_match.group(1)
size_start_index = size_match.start()
name = None
if size_start_index != -1:
name_part = stem[:size_start_index]
name = name_part.replace('_', ' ').strip()
if not name:
post_size_part = stem[size_match.end():]
if post_size_part.startswith('_'): post_size_part = post_size_part[1:]
if post_size_part.startswith('+'): post_size_part = post_size_part[1:]
name = post_size_part.replace('_', ' ').replace('+', ' ').strip()
else:
name = stem.replace('_', ' ').strip()
if type_ and name.lower().endswith(type_.lower()):
name = name[:-len(type_)].strip()
if not name:
name_parts_filtered = [p for i, p in enumerate(original_stem_parts) if i not in found_type_indices]
name = ' '.join(name_parts_filtered).strip()
if not name:
name = stem.replace('_',' ').strip()
architecture = None
if name:
name_lower_for_mapping = name.lower()
sorted_keys = sorted(architecture_mapping.keys(), key=len, reverse=True)
for key in sorted_keys:
pattern = r'\b' + re.escape(key.lower()) + r'\b'
if re.search(pattern, name_lower_for_mapping):
architecture = architecture_mapping[key]
break
elif key.lower() in name_lower_for_mapping and architecture is None:
architecture = architecture_mapping[key]
for key in TYPE_MAPPING:
if key.lower() in name.lower():
type_ = TYPE_MAPPING[key].get(type_, type_)
break
for key in TYPE_MAPPING:
kaggle_key = f"Kaggle {key}"
if kaggle_key.lower() in name.lower():
type_ = TYPE_MAPPING.get(kaggle_key, {}).get(type_, type_)
break
if "kaggle" in name.lower():
# Remove "kaggle" from the name
name = name.replace("Kaggle", "").strip()
return {'name': name,
'size': size,
'type': type_,
'architecture': architecture,
'requires_a100': requires_a100}
extracted_info_refined = {}
original_template_path = os.path.abspath("original_template")
list_files = [f for f in os.listdir(original_template_path) if f.endswith(".ipynb")]
standardized_name = [f.replace("-", "_") for f in list_files]
standard_to_original_name = {
k : v for k, v in zip(standardized_name, list_files)