Ubuntu commited on
Commit
9af0669
·
1 Parent(s): 7e137e8

fixced the training

Browse files
Files changed (3) hide show
  1. fine_tune_llama32_1b.py +4 -5
  2. pyproject.toml +1 -0
  3. uv.lock +26 -0
fine_tune_llama32_1b.py CHANGED
@@ -104,7 +104,7 @@ batch_size = 4 # reduce to 2 or 1 if OOM
104
  gradient_accumulation_steps = 4
105
  num_train_epochs = 1 # set to 2 or 3 if you want better quality (longer training)
106
  learning_rate = 2e-4
107
- max_steps = None # set a number (e.g. 2000) if you want to train only part of the dataset
108
 
109
  output_dir = "./llama32-1b-finetuned-finetome"
110
 
@@ -198,18 +198,17 @@ training_args = SFTConfig(
198
  fp16=False, # bfloat16 is used via compute_dtype
199
  bf16=torch.cuda.is_bf16_supported(),
200
  optim="paged_adamw_8bit",
201
- max_seq_length=max_seq_length,
202
  packing=True, # packs multiple examples into one sequence (faster)
203
  dataset_text_field="text",
204
  report_to="none", # change to "tensorboard" if you want logs
 
205
  )
206
 
207
  trainer = SFTTrainer(
208
  model=model,
209
- tokenizer=tokenizer,
210
- train_dataset=dataset,
211
  args=training_args,
212
- # peft_config is NOT needed because we already did get_peft_model
 
213
  )
214
 
215
  print("Starting training...")
 
104
  gradient_accumulation_steps = 4
105
  num_train_epochs = 1 # set to 2 or 3 if you want better quality (longer training)
106
  learning_rate = 2e-4
107
+ max_steps = -1 # set to -1 to use num_train_epochs (trl expects -1 for "use epochs")
108
 
109
  output_dir = "./llama32-1b-finetuned-finetome"
110
 
 
198
  fp16=False, # bfloat16 is used via compute_dtype
199
  bf16=torch.cuda.is_bf16_supported(),
200
  optim="paged_adamw_8bit",
 
201
  packing=True, # packs multiple examples into one sequence (faster)
202
  dataset_text_field="text",
203
  report_to="none", # change to "tensorboard" if you want logs
204
+ max_length=max_seq_length,
205
  )
206
 
207
  trainer = SFTTrainer(
208
  model=model,
 
 
209
  args=training_args,
210
+ train_dataset=dataset,
211
+ processing_class=tokenizer,
212
  )
213
 
214
  print("Starting training...")
pyproject.toml CHANGED
@@ -18,6 +18,7 @@ dependencies = [
18
  "trl>=0.29.1",
19
  "uvicorn>=0.42.0",
20
  "torchvision>=0.20.0",
 
21
  ]
22
 
23
  [tool.uv]
 
18
  "trl>=0.29.1",
19
  "uvicorn>=0.42.0",
20
  "torchvision>=0.20.0",
21
+ "wrapt>=2.1.2",
22
  ]
23
 
24
  [tool.uv]
uv.lock CHANGED
@@ -887,6 +887,7 @@ dependencies = [
887
  { name = "transformers", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
888
  { name = "trl", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
889
  { name = "uvicorn", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
 
890
  ]
891
 
892
  [package.metadata]
@@ -907,6 +908,7 @@ requires-dist = [
907
  { name = "transformers", specifier = ">=5.4.0" },
908
  { name = "trl", specifier = ">=0.29.1" },
909
  { name = "uvicorn", specifier = ">=0.42.0" },
 
910
  ]
911
 
912
  [[package]]
@@ -1516,6 +1518,30 @@ wheels = [
1516
  { url = "https://files.pythonhosted.org/packages/0a/89/f8827ccff89c1586027a105e5630ff6139a64da2515e24dafe860bd9ae4d/uvicorn-0.42.0-py3-none-any.whl", hash = "sha256:96c30f5c7abe6f74ae8900a70e92b85ad6613b745d4879eb9b16ccad15645359", size = 68830, upload-time = "2026-03-16T06:19:48.325Z" },
1517
  ]
1518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1519
  [[package]]
1520
  name = "xxhash"
1521
  version = "3.6.0"
 
887
  { name = "transformers", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
888
  { name = "trl", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
889
  { name = "uvicorn", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
890
+ { name = "wrapt", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
891
  ]
892
 
893
  [package.metadata]
 
908
  { name = "transformers", specifier = ">=5.4.0" },
909
  { name = "trl", specifier = ">=0.29.1" },
910
  { name = "uvicorn", specifier = ">=0.42.0" },
911
+ { name = "wrapt", specifier = ">=2.1.2" },
912
  ]
913
 
914
  [[package]]
 
1518
  { url = "https://files.pythonhosted.org/packages/0a/89/f8827ccff89c1586027a105e5630ff6139a64da2515e24dafe860bd9ae4d/uvicorn-0.42.0-py3-none-any.whl", hash = "sha256:96c30f5c7abe6f74ae8900a70e92b85ad6613b745d4879eb9b16ccad15645359", size = 68830, upload-time = "2026-03-16T06:19:48.325Z" },
1519
  ]
1520
 
1521
+ [[package]]
1522
+ name = "wrapt"
1523
+ version = "2.1.2"
1524
+ source = { registry = "https://pypi.org/simple" }
1525
+ sdist = { url = "https://files.pythonhosted.org/packages/2e/64/925f213fdcbb9baeb1530449ac71a4d57fc361c053d06bf78d0c5c7cd80c/wrapt-2.1.2.tar.gz", hash = "sha256:3996a67eecc2c68fd47b4e3c564405a5777367adfd9b8abb58387b63ee83b21e", size = 81678, upload-time = "2026-03-06T02:53:25.134Z" }
1526
+ wheels = [
1527
+ { url = "https://files.pythonhosted.org/packages/a2/16/9b02a6b99c09227c93cd4b73acc3678114154ec38da53043c0ddc1fba0dc/wrapt-2.1.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6433ea84e1cfacf32021d2a4ee909554ade7fd392caa6f7c13f1f4bf7b8e8748", size = 61848, upload-time = "2026-03-06T02:53:48.728Z" },
1528
+ { url = "https://files.pythonhosted.org/packages/af/aa/ead46a88f9ec3a432a4832dfedb84092fc35af2d0ba40cd04aea3889f247/wrapt-2.1.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c20b757c268d30d6215916a5fa8461048d023865d888e437fab451139cad6c8e", size = 121433, upload-time = "2026-03-06T02:54:40.328Z" },
1529
+ { url = "https://files.pythonhosted.org/packages/88/dd/27fc67914e68d740bce512f11734aec08696e6b17641fef8867c00c949fc/wrapt-2.1.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7dfa9f2cf65d027b951d05c662cc99ee3bd01f6e4691ed39848a7a5fffc902b2", size = 120563, upload-time = "2026-03-06T02:53:20.412Z" },
1530
+ { url = "https://files.pythonhosted.org/packages/5e/88/9a9b9a90ac8ca11c2fdb6a286cb3a1fc7dd774c00ed70929a6434f6bc634/wrapt-2.1.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4bdf26e03e6d0da3f0e9422fd36bcebf7bc0eeb55fdf9c727a09abc6b9fe472e", size = 61851, upload-time = "2026-03-06T02:52:48.672Z" },
1531
+ { url = "https://files.pythonhosted.org/packages/03/a9/5b7d6a16fd6533fed2756900fc8fc923f678179aea62ada6d65c92718c00/wrapt-2.1.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bbac24d879aa22998e87f6b3f481a5216311e7d53c7db87f189a7a0266dafffb", size = 121446, upload-time = "2026-03-06T02:54:14.013Z" },
1532
+ { url = "https://files.pythonhosted.org/packages/98/fd/e5ff7ded41b76d802cf1191288473e850d24ba2e39a6ec540f21ae3b57cb/wrapt-2.1.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6f8dbdd3719e534860d6a78526aafc220e0241f981367018c2875178cf83a413", size = 120573, upload-time = "2026-03-06T02:52:50.163Z" },
1533
+ { url = "https://files.pythonhosted.org/packages/09/a8/ce7b4006f7218248dd71b7b2b732d0710845a0e49213b18faef64811ffef/wrapt-2.1.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a9b9d50c9af998875a1482a038eb05755dfd6fe303a313f6a940bb53a83c3f18", size = 63719, upload-time = "2026-03-06T02:54:33.452Z" },
1534
+ { url = "https://files.pythonhosted.org/packages/e4/e5/2ca472e80b9e2b7a17f106bb8f9df1db11e62101652ce210f66935c6af67/wrapt-2.1.2-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2d3ff4f0024dd224290c0eabf0240f1bfc1f26363431505fb1b0283d3b08f11d", size = 152643, upload-time = "2026-03-06T02:52:42.721Z" },
1535
+ { url = "https://files.pythonhosted.org/packages/0e/b6/ec7b4a254abbe4cde9fa15c5d2cca4518f6b07d0f1b77d4ee9655e30280e/wrapt-2.1.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c0be8b5a74c5824e9359b53e7e58bef71a729bacc82e16587db1c4ebc91f7c5a", size = 150269, upload-time = "2026-03-06T02:53:31.268Z" },
1536
+ { url = "https://files.pythonhosted.org/packages/ec/0f/fa539e2f6a770249907757eaeb9a5ff4deb41c026f8466c1c6d799088a9b/wrapt-2.1.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6de1a3851c27e0bd6a04ca993ea6f80fc53e6c742ee1601f486c08e9f9b900a9", size = 61914, upload-time = "2026-03-06T02:52:53.37Z" },
1537
+ { url = "https://files.pythonhosted.org/packages/53/37/02af1867f5b1441aaeda9c82deed061b7cd1372572ddcd717f6df90b5e93/wrapt-2.1.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:de9f1a2bbc5ac7f6012ec24525bdd444765a2ff64b5985ac6e0692144838542e", size = 120417, upload-time = "2026-03-06T02:54:30.74Z" },
1538
+ { url = "https://files.pythonhosted.org/packages/f7/2d/f84939a7c9b5e6cdd8a8d0f6a26cabf36a0f7e468b967720e8b0cd2bdf69/wrapt-2.1.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:fab036efe5464ec3291411fabb80a7a39e2dd80bae9bcbeeca5087fdfa891e19", size = 119593, upload-time = "2026-03-06T02:54:16.697Z" },
1539
+ { url = "https://files.pythonhosted.org/packages/c6/8c/05d277d182bf36b0a13d6bd393ed1dec3468a25b59d01fba2dd70fe4d6ae/wrapt-2.1.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c7e6cd120ef837d5b6f860a6ea3745f8763805c418bb2f12eeb1fa6e25f22d22", size = 63723, upload-time = "2026-03-06T02:52:56.374Z" },
1540
+ { url = "https://files.pythonhosted.org/packages/f4/27/6c51ec1eff4413c57e72d6106bb8dec6f0c7cdba6503d78f0fa98767bcc9/wrapt-2.1.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3769a77df8e756d65fbc050333f423c01ae012b4f6731aaf70cf2bef61b34596", size = 152652, upload-time = "2026-03-06T02:53:23.79Z" },
1541
+ { url = "https://files.pythonhosted.org/packages/40/51/1dfc783a6c57971614c48e361a82ca3b6da9055879952587bc99fe1a7171/wrapt-2.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3144b027ff30cbd2fca07c0a87e67011adb717eb5f5bd8496325c17e454257a3", size = 150296, upload-time = "2026-03-06T02:54:07.848Z" },
1542
+ { url = "https://files.pythonhosted.org/packages/1a/c7/8528ac2dfa2c1e6708f647df7ae144ead13f0a31146f43c7264b4942bf12/wrapt-2.1.2-py3-none-any.whl", hash = "sha256:b8fd6fa2b2c4e7621808f8c62e8317f4aae56e59721ad933bac5239d913cf0e8", size = 43993, upload-time = "2026-03-06T02:53:12.905Z" },
1543
+ ]
1544
+
1545
  [[package]]
1546
  name = "xxhash"
1547
  version = "3.6.0"