'}]}"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"dataset[5]"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
@@ -139,9 +292,17 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "num_proc must be <= 20. Reducing num_proc to 20 for dataset of size 20.\n"
+ ]
+ }
+ ],
"source": [
"trainer = SFTTrainer(\n",
" model=model,\n",
@@ -155,23 +316,106 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "==((====))== Unsloth - 2x faster free finetuning | Num GPUs used = 1\n",
+ " \\\\ /| Num examples = 20 | Num Epochs = 3 | Total steps = 3\n",
+ "O^O/ \\_/ \\ Batch size per device = 1 | Gradient accumulation steps = 16\n",
+ "\\ / Data Parallel GPUs = 1 | Total batch size (1 x 16 x 1) = 16\n",
+ " \"-____-\" Trainable parameters = 536,870,912/32,000,000,000 (1.68% trained)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Unsloth: Will smartly offload gradients to save VRAM!\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ " \n",
+ "
\n",
+ " [3/3 01:45, Epoch 1/3]\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | Step | \n",
+ " Training Loss | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "TrainOutput(global_step=3, training_loss=1.7514243125915527, metrics={'train_runtime': 187.9691, 'train_samples_per_second': 0.319, 'train_steps_per_second': 0.016, 'total_flos': 7927521441988608.0, 'train_loss': 1.7514243125915527})"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"trainer.train()"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 15,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Unsloth: Merging 4bit and LoRA weights to 16bit...\n",
+ "Unsloth: Will use up to 312.94 out of 503.54 RAM for saving.\n",
+ "Unsloth: Saving model... This might take 5 minutes ...\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ " 12%|█▎ | 8/64 [00:00<00:02, 22.74it/s]\n",
+ "We will save to Disk and not RAM now.\n",
+ "100%|██████████| 64/64 [00:43<00:00, 1.48it/s]\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Unsloth: Saving tokenizer... Done.\n",
+ "Done.\n"
+ ]
+ }
+ ],
"source": [
"model.save_pretrained_merged(\n",
" str(args.output_dir), \n",
" tokenizer=tokenizer,\n",
- " save_method=\"merged_16bit\"\n",
+ " #save_method=\"merged_4bit_forced\"\n",
")"
]
}