"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/home/marco/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/torch/_dynamo/eval_frame.py:632: UserWarning: torch.utils.checkpoint: the use_reentrant parameter should be passed explicitly. In version 2.5 we will raise an exception if use_reentrant is not passed. use_reentrant=False is recommended, but if you need to preserve the current default behavior, you can pass use_reentrant=True. Refer to docs for more details on the differences between the two variants.\n",
+ " return fn(*args, **kwargs)\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ " \n",
+ "
\n",
+ " [300/300 09:53, Epoch 1/1]\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " Step | \n",
+ " Training Loss | \n",
+ " Validation Loss | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 60 | \n",
+ " 2.011600 | \n",
+ " 2.002830 | \n",
+ "
\n",
+ " \n",
+ " 120 | \n",
+ " 1.853900 | \n",
+ " 1.961909 | \n",
+ "
\n",
+ " \n",
+ " 180 | \n",
+ " 2.088800 | \n",
+ " 1.939240 | \n",
+ "
\n",
+ " \n",
+ " 240 | \n",
+ " 1.923100 | \n",
+ " 1.927367 | \n",
+ "
\n",
+ " \n",
+ " 300 | \n",
+ " 2.089000 | \n",
+ " 1.924164 | \n",
+ "
\n",
+ " \n",
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/home/marco/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/peft/utils/other.py:716: UserWarning: Unable to fetch remote file due to the following error (ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')), '(Request ID: ebbfa21b-df77-43ef-bddd-b95ec07a63f8)') - silently ignoring the lookup for the file config.json in meta-llama/Llama-3.2-3B-Instruct.\n",
+ " warnings.warn(\n",
+ "/home/marco/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/peft/utils/save_and_load.py:246: UserWarning: Could not find a config file in meta-llama/Llama-3.2-3B-Instruct - will assume that the vocabulary was not modified.\n",
+ " warnings.warn(\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "TrainOutput(global_step=300, training_loss=2.0926066251595814, metrics={'train_runtime': 596.9063, 'train_samples_per_second': 4.021, 'train_steps_per_second': 0.503, 'total_flos': 2216727844706304.0, 'train_loss': 2.0926066251595814, 'epoch': 1.0})"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "trainer.train()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "d50bf803-dedd-44bf-8016-6d80b5726803",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "('/home/marco/llama-3.2-3B-instruct-offensive-classification-2/tokenizer_config.json',\n",
+ " '/home/marco/llama-3.2-3B-instruct-offensive-classification-2/special_tokens_map.json',\n",
+ " '/home/marco/llama-3.2-3B-instruct-offensive-classification-2/tokenizer.json')"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "trainer.save_model(output_dir)\n",
+ "tokenizer.save_pretrained(output_dir)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "37e30c0e-dd90-4400-aaab-b3526ac4a7ab",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ " 0%| | 0/300 [00:00, ?it/s]Device set to use cuda:0\n",
+ " 0%| | 1/300 [00:00<00:32, 9.15it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 1%| | 3/300 [00:00<00:30, 9.80it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 2%|▏ | 5/300 [00:00<00:28, 10.20it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 2%|▏ | 7/300 [00:00<00:27, 10.48it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 3%|▎ | 9/300 [00:00<00:27, 10.58it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 4%|▎ | 11/300 [00:01<00:27, 10.46it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 4%|▍ | 13/300 [00:01<00:26, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 5%|▌ | 15/300 [00:01<00:26, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 6%|▌ | 17/300 [00:01<00:26, 10.83it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 6%|▋ | 19/300 [00:01<00:25, 10.93it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 7%|▋ | 21/300 [00:01<00:25, 10.78it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 8%|▊ | 23/300 [00:02<00:25, 10.87it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 8%|▊ | 25/300 [00:02<00:25, 10.92it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 9%|▉ | 27/300 [00:02<00:24, 10.98it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 10%|▉ | 29/300 [00:02<00:24, 11.04it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 10%|█ | 31/300 [00:02<00:24, 11.06it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 11%|█ | 33/300 [00:03<00:24, 10.87it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 12%|█▏ | 35/300 [00:03<00:24, 10.94it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 12%|█▏ | 37/300 [00:03<00:24, 10.68it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 13%|█▎ | 39/300 [00:03<00:24, 10.77it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 14%|█▎ | 41/300 [00:03<00:23, 10.87it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 14%|█▍ | 43/300 [00:03<00:23, 10.77it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 15%|█▌ | 45/300 [00:04<00:23, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 16%|█▌ | 47/300 [00:04<00:23, 10.71it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 16%|█▋ | 49/300 [00:04<00:23, 10.67it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 17%|█▋ | 51/300 [00:04<00:23, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 18%|█▊ | 53/300 [00:04<00:23, 10.70it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 18%|█▊ | 55/300 [00:05<00:22, 10.83it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 19%|█▉ | 57/300 [00:05<00:22, 10.70it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 20%|█▉ | 59/300 [00:05<00:22, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 20%|██ | 61/300 [00:05<00:22, 10.57it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 21%|██ | 63/300 [00:05<00:23, 10.26it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 22%|██▏ | 65/300 [00:06<00:22, 10.33it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 22%|██▏ | 67/300 [00:06<00:22, 10.39it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 23%|██▎ | 69/300 [00:06<00:21, 10.57it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 24%|██▎ | 71/300 [00:06<00:21, 10.58it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 24%|██▍ | 73/300 [00:06<00:21, 10.46it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 25%|██▌ | 75/300 [00:07<00:21, 10.63it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 26%|██▌ | 77/300 [00:07<00:20, 10.77it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 26%|██▋ | 79/300 [00:07<00:21, 10.52it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 27%|██▋ | 81/300 [00:07<00:20, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 28%|██▊ | 83/300 [00:07<00:20, 10.74it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 28%|██▊ | 85/300 [00:07<00:19, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 29%|██▉ | 87/300 [00:08<00:20, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 30%|██▉ | 89/300 [00:08<00:19, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 30%|███ | 91/300 [00:08<00:19, 10.70it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 31%|███ | 93/300 [00:08<00:19, 10.46it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 32%|███▏ | 95/300 [00:08<00:19, 10.59it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 32%|███▏ | 97/300 [00:09<00:18, 10.72it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 33%|███▎ | 99/300 [00:09<00:18, 10.78it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 34%|███▎ | 101/300 [00:09<00:18, 10.51it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 34%|███▍ | 103/300 [00:09<00:18, 10.37it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 35%|███▌ | 105/300 [00:09<00:18, 10.56it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 36%|███▌ | 107/300 [00:10<00:18, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 36%|███▋ | 109/300 [00:10<00:17, 10.70it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 37%|███▋ | 111/300 [00:10<00:17, 10.67it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 38%|███▊ | 113/300 [00:10<00:17, 10.55it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 38%|███▊ | 115/300 [00:10<00:17, 10.51it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 39%|███▉ | 117/300 [00:10<00:17, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 40%|███▉ | 119/300 [00:11<00:16, 10.74it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 40%|████ | 121/300 [00:11<00:16, 10.84it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 41%|████ | 123/300 [00:11<00:16, 10.91it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 42%|████▏ | 125/300 [00:11<00:16, 10.73it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 42%|████▏ | 127/300 [00:11<00:15, 10.85it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 43%|████▎ | 129/300 [00:12<00:15, 10.93it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 44%|████▎ | 131/300 [00:12<00:15, 11.01it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 44%|████▍ | 133/300 [00:12<00:15, 11.04it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 45%|████▌ | 135/300 [00:12<00:15, 10.86it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 46%|████▌ | 137/300 [00:12<00:14, 10.88it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 46%|████▋ | 139/300 [00:12<00:14, 10.96it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 47%|████▋ | 141/300 [00:13<00:14, 10.81it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 48%|████▊ | 143/300 [00:13<00:14, 10.87it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 48%|████▊ | 145/300 [00:13<00:14, 10.84it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 49%|████▉ | 147/300 [00:13<00:14, 10.90it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 50%|████▉ | 149/300 [00:13<00:13, 10.94it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 50%|██���██ | 151/300 [00:14<00:13, 10.96it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 51%|█████ | 153/300 [00:14<00:13, 10.79it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 52%|█████▏ | 155/300 [00:14<00:13, 10.80it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 52%|█████▏ | 157/300 [00:14<00:13, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 53%|█████▎ | 159/300 [00:14<00:13, 10.74it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 54%|█████▎ | 161/300 [00:15<00:12, 10.74it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 54%|█████▍ | 163/300 [00:15<00:12, 10.78it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 55%|█████▌ | 165/300 [00:15<00:12, 10.63it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 56%|█████▌ | 167/300 [00:15<00:12, 10.36it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 56%|█████▋ | 169/300 [00:15<00:12, 10.25it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 57%|█████▋ | 171/300 [00:16<00:12, 10.27it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 58%|█████▊ | 173/300 [00:16<00:12, 10.48it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 58%|█████▊ | 175/300 [00:16<00:11, 10.61it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 59%|█████▉ | 177/300 [00:16<00:11, 10.54it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 60%|█████▉ | 179/300 [00:16<00:11, 10.68it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 60%|██████ | 181/300 [00:16<00:11, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 61%|██████ | 183/300 [00:17<00:10, 10.82it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 62%|██████▏ | 185/300 [00:17<00:10, 10.81it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 62%|██████▏ | 187/300 [00:17<00:10, 10.71it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 63%|██████▎ | 189/300 [00:17<00:10, 10.63it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 64%|██████▎ | 191/300 [00:17<00:10, 10.54it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 64%|██████▍ | 193/300 [00:18<00:10, 10.67it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 65%|██████▌ | 195/300 [00:18<00:09, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 66%|██████▌ | 197/300 [00:18<00:09, 10.86it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 66%|██████▋ | 199/300 [00:18<00:09, 10.75it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 67%|██████▋ | 201/300 [00:18<00:09, 10.82it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 68%|██████▊ | 203/300 [00:18<00:08, 10.87it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 68%|██████▊ | 205/300 [00:19<00:08, 10.88it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 69%|██████▉ | 207/300 [00:19<00:08, 10.73it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 70%|██████▉ | 209/300 [00:19<00:08, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 70%|███████ | 211/300 [00:19<00:08, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 71%|███████ | 213/300 [00:19<00:08, 10.79it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 72%|███████▏ | 215/300 [00:20<00:07, 10.75it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 72%|███████▏ | 217/300 [00:20<00:07, 10.76it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 73%|███████▎ | 219/300 [00:20<00:07, 10.79it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 74%|███████▎ | 221/300 [00:20<00:07, 10.67it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 74%|███████▍ | 223/300 [00:20<00:07, 10.58it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 75%|███████▌ | 225/300 [00:21<00:07, 10.36it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 76%|███████▌ | 227/300 [00:21<00:06, 10.54it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 76%|███████▋ | 229/300 [00:21<00:06, 10.41it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 77%|███████▋ | 231/300 [00:21<00:06, 10.22it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 78%|███████▊ | 233/300 [00:21<00:06, 10.40it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 78%|███████▊ | 235/300 [00:21<00:06, 10.56it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 79%|███████▉ | 237/300 [00:22<00:05, 10.65it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 80%|███████▉ | 239/300 [00:22<00:05, 10.72it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 80%|████████ | 241/300 [00:22<00:05, 10.75it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 81%|████████ | 243/300 [00:22<00:05, 10.85it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 82%|████████▏ | 245/300 [00:22<00:05, 10.90it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 82%|████████▏ | 247/300 [00:23<00:04, 10.69it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 83%|████████▎ | 249/300 [00:23<00:04, 10.53it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 84%|████████▎ | 251/300 [00:23<00:04, 10.45it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 84%|████████▍ | 253/300 [00:23<00:04, 10.36it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 85%|████████▌ | 255/300 [00:23<00:04, 10.52it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 86%|████████▌ | 257/300 [00:24<00:04, 10.18it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 86%|████████▋ | 259/300 [00:24<00:04, 10.05it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 87%|████████▋ | 261/300 [00:24<00:03, 10.24it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 88%|████████▊ | 263/300 [00:24<00:03, 10.28it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 88%|████████▊ | 265/300 [00:24<00:03, 10.21it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 89%|████████▉ | 267/300 [00:25<00:03, 10.18it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 90%|████████▉ | 269/300 [00:25<00:02, 10.35it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 90%|█████████ | 271/300 [00:25<00:02, 10.28it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 91%|█████████ | 273/300 [00:25<00:02, 10.36it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 92%|█████████▏| 275/300 [00:25<00:02, 10.37it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 92%|█████████▏| 277/300 [00:26<00:02, 10.51it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 93%|█████████▎| 279/300 [00:26<00:01, 10.59it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 94%|█████████▎| 281/300 [00:26<00:01, 10.53it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 94%|█████████▍| 283/300 [00:26<00:01, 10.46it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 95%|█████████▌| 285/300 [00:26<00:01, 10.43it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 96%|█████████▌| 287/300 [00:26<00:01, 10.44it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 96%|█████████▋| 289/300 [00:27<00:01, 10.35it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 97%|█████████▋| 291/300 [00:27<00:00, 10.49it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 98%|█████████▊| 293/300 [00:27<00:00, 10.44it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 98%|█████████▊| 295/300 [00:27<00:00, 10.52it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ " 99%|█████████▉| 297/300 [00:27<00:00, 10.53it/s]Device set to use cuda:0\n",
+ "Device set to use cuda:0\n",
+ "100%|█████████▉| 299/300 [00:28<00:00, 10.48it/s]Device set to use cuda:0\n",
+ "100%|██████████| 300/300 [00:28<00:00, 10.63it/s]\n"
+ ]
+ }
+ ],
+ "source": [
+ "y_pred = predict(X_test, model, tokenizer)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "id": "3449c759-b590-4455-80d7-a1535e1b8f9f",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Accuracy: 0.903\n",
+ "Accuracy for label Hate: 0.176\n",
+ "Accuracy for label Offensive: 0.961\n",
+ "Accuracy for label Normal: 0.880\n",
+ "\n",
+ "Classification Report:\n",
+ " precision recall f1-score support\n",
+ "\n",
+ " Hate 0.43 0.18 0.25 17\n",
+ " Offensive 0.92 0.96 0.94 233\n",
+ " Normal 0.88 0.88 0.88 50\n",
+ "\n",
+ " accuracy 0.90 300\n",
+ " macro avg 0.74 0.67 0.69 300\n",
+ "weighted avg 0.89 0.90 0.89 300\n",
+ "\n",
+ "\n",
+ "Confusion Matrix:\n",
+ "[[ 3 13 1]\n",
+ " [ 4 224 5]\n",
+ " [ 0 6 44]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "evaluate(y_true, y_pred)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "id": "591f2b8c-3cb1-448d-b70a-e26b0dcfbafd",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "base_model = \"meta-llama/Llama-3.2-3B-Instruct\"\n",
+ "fine_tuned_model = \"/home/marco/llama-3.2-3B-instruct-offensive-classification-2\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "id": "64a3591f-8c98-41f9-8326-a9ed7d0da461",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "62a6fde13e574c21ae5c482ae9c6d9dc",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Loading checkpoint shards: 0%| | 0/2 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\n",
+ "from peft import PeftModel\n",
+ "import torch\n",
+ "\n",
+ "\n",
+ "# Reload tokenizer and model\n",
+ "tokenizer = AutoTokenizer.from_pretrained(base_model)\n",
+ "\n",
+ "base_model_reload = AutoModelForCausalLM.from_pretrained(\n",
+ " base_model,\n",
+ " return_dict=True,\n",
+ " low_cpu_mem_usage=True,\n",
+ " torch_dtype=torch.float16,\n",
+ " device_map=\"auto\",\n",
+ " trust_remote_code=True,\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "id": "37e19428-9786-429f-b119-61ae7b7355ab",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "model = PeftModel.from_pretrained(base_model_reload, fine_tuned_model)\n",
+ "model = model.merge_and_unload()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "9e448406-60a1-4c76-a827-0284f859843e",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Device set to use cpu\n",
+ "Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Offensive\n"
+ ]
+ }
+ ],
+ "source": [
+ "text = \"You are an asshole!\"\n",
+ "prompt = f\"\"\"Classify the text into Hatespeech, Offensive, Normal and return the answer as the corresponding label.\n",
+ "text: {text}\n",
+ "label: \"\"\".strip()\n",
+ "\n",
+ "pipe = pipeline(\n",
+ " \"text-generation\",\n",
+ " model=model,\n",
+ " tokenizer=tokenizer,\n",
+ " torch_dtype=torch.float16,\n",
+ " device_map=\"auto\",\n",
+ ")\n",
+ "\n",
+ "outputs = pipe(prompt, max_new_tokens=2, do_sample=True, temperature=0.1)\n",
+ "print(outputs[0][\"generated_text\"].split(\"label: \")[-1].strip())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "id": "8f479001-338c-4a06-b4e5-6d874a6d9b30",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Device set to use cpu\n",
+ "Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Normal\n"
+ ]
+ }
+ ],
+ "source": [
+ "text = \"I walk in the park!\"\n",
+ "prompt = f\"\"\"Classify the text into Hatespeech, Offensive, Normal and return the answer as the corresponding label.\n",
+ "text: {text}\n",
+ "label: \"\"\".strip()\n",
+ "\n",
+ "pipe = pipeline(\n",
+ " \"text-generation\",\n",
+ " model=model,\n",
+ " tokenizer=tokenizer,\n",
+ " torch_dtype=torch.float16,\n",
+ " device_map=\"auto\",\n",
+ ")\n",
+ "\n",
+ "outputs = pipe(prompt, max_new_tokens=2, do_sample=True, temperature=0.1)\n",
+ "print(outputs[0][\"generated_text\"].split(\"label: \")[-1].strip())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "id": "b182f963-ce02-465a-87dd-312fe782451d",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Device set to use cpu\n",
+ "Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Hate Speech\n"
+ ]
+ }
+ ],
+ "source": [
+ "text = \"Jews are conspiratorial, devious, treacherous, sadistic, child killers, and subversive\"\n",
+ "prompt = f\"\"\"Classify the text into Hatespeech, Offensive, Normal and return the answer as the corresponding label.\n",
+ "text: {text}\n",
+ "label: \"\"\".strip()\n",
+ "pipe = pipeline(\n",
+ " \"text-generation\",\n",
+ " model=model,\n",
+ " tokenizer=tokenizer,\n",
+ " torch_dtype=torch.float16,\n",
+ " device_map=\"auto\",\n",
+ ")\n",
+ "\n",
+ "outputs = pipe(prompt, max_new_tokens=2, do_sample=True, temperature=0.1)\n",
+ "print(outputs[0][\"generated_text\"].split(\"label: \")[-1].strip())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "dfb5394b-8be3-4e25-9417-165f08ff0fad",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "('/home/marco/llama-3.2-3B-instruct-offensive-classification-2/tokenizer_config.json',\n",
+ " '/home/marco/llama-3.2-3B-instruct-offensive-classification-2/special_tokens_map.json',\n",
+ " '/home/marco/llama-3.2-3B-instruct-offensive-classification-2/tokenizer.json')"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "model_dir = \"/home/marco/llama-3.2-3B-instruct-offensive-classification-2\"\n",
+ "model.save_pretrained(model_dir)\n",
+ "tokenizer.save_pretrained(model_dir)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "id": "aa0ffb80-4d69-4099-b279-712c3dfac2fb",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "a2267a17809c48c9a0a310197a828c6a",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Upload 2 LFS files: 0%| | 0/2 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "8c57390c36df4d8aa597180b831a63bf",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "model-00002-of-00002.safetensors: 0%| | 0.00/1.46G [00:00, ?B/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "86df050df82b40a59c3c6f46594153a0",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "model-00001-of-00002.safetensors: 0%| | 0.00/4.97G [00:00, ?B/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "ename": "ConnectionError",
+ "evalue": "(ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')), '(Request ID: 4f29ef98-416f-4d91-bd52-997d447a0e2a)')",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mRemoteDisconnected\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connectionpool.py:789\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 788\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 789\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 790\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 791\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 792\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 793\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 801\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 804\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connectionpool.py:536\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 536\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 537\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connection.py:464\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[0;32m--> 464\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:1428\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1427\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1428\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1429\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:331\u001b[0m, in \u001b[0;36mHTTPResponse.begin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 330\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 331\u001b[0m version, status, reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status \u001b[38;5;241m!=\u001b[39m CONTINUE:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:300\u001b[0m, in \u001b[0;36mHTTPResponse._read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 297\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m line:\n\u001b[1;32m 298\u001b[0m \u001b[38;5;66;03m# Presumably, the server closed the connection before\u001b[39;00m\n\u001b[1;32m 299\u001b[0m \u001b[38;5;66;03m# sending a valid response.\u001b[39;00m\n\u001b[0;32m--> 300\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m RemoteDisconnected(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRemote end closed connection without\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 301\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m response\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "\u001b[0;31mRemoteDisconnected\u001b[0m: Remote end closed connection without response",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mProtocolError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/requests/adapters.py:667\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 666\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 673\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 674\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 675\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 679\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 681\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connectionpool.py:843\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 841\u001b[0m new_e \u001b[38;5;241m=\u001b[39m ProtocolError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection aborted.\u001b[39m\u001b[38;5;124m\"\u001b[39m, new_e)\n\u001b[0;32m--> 843\u001b[0m retries \u001b[38;5;241m=\u001b[39m \u001b[43mretries\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mincrement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 844\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnew_e\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_stacktrace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msys\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexc_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 845\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 846\u001b[0m retries\u001b[38;5;241m.\u001b[39msleep()\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/util/retry.py:474\u001b[0m, in \u001b[0;36mRetry.increment\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m read \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m method \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_method_retryable(method):\n\u001b[0;32m--> 474\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[43mreraise\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43merror\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_stacktrace\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 475\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m read \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/util/util.py:38\u001b[0m, in \u001b[0;36mreraise\u001b[0;34m(tp, value, tb)\u001b[0m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m value\u001b[38;5;241m.\u001b[39m__traceback__ \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m tb:\n\u001b[0;32m---> 38\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m value\u001b[38;5;241m.\u001b[39mwith_traceback(tb)\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m value\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connectionpool.py:789\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 788\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 789\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 790\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 791\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 792\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 793\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 801\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 804\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connectionpool.py:536\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 536\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 537\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/urllib3/connection.py:464\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[0;32m--> 464\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:1428\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1427\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1428\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1429\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:331\u001b[0m, in \u001b[0;36mHTTPResponse.begin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 330\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 331\u001b[0m version, status, reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status \u001b[38;5;241m!=\u001b[39m CONTINUE:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/http/client.py:300\u001b[0m, in \u001b[0;36mHTTPResponse._read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 297\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m line:\n\u001b[1;32m 298\u001b[0m \u001b[38;5;66;03m# Presumably, the server closed the connection before\u001b[39;00m\n\u001b[1;32m 299\u001b[0m \u001b[38;5;66;03m# sending a valid response.\u001b[39;00m\n\u001b[0;32m--> 300\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m RemoteDisconnected(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRemote end closed connection without\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 301\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m response\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "\u001b[0;31mProtocolError\u001b[0m: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[30], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpush_to_hub\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmarcoorasch/llama-3.2-3B-instruct-hatespeech-offensive-classification\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43muse_temp_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/transformers/modeling_utils.py:3087\u001b[0m, in \u001b[0;36mPreTrainedModel.push_to_hub\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 3085\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m tags:\n\u001b[1;32m 3086\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtags\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m tags\n\u001b[0;32m-> 3087\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpush_to_hub\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/transformers/utils/hub.py:954\u001b[0m, in \u001b[0;36mPushToHubMixin.push_to_hub\u001b[0;34m(self, repo_id, use_temp_dir, commit_message, private, token, max_shard_size, create_pr, safe_serialization, revision, commit_description, tags, **deprecated_kwargs)\u001b[0m\n\u001b[1;32m 951\u001b[0m \u001b[38;5;66;03m# Update model card if needed:\u001b[39;00m\n\u001b[1;32m 952\u001b[0m model_card\u001b[38;5;241m.\u001b[39msave(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(work_dir, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mREADME.md\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[0;32m--> 954\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_upload_modified_files\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 955\u001b[0m \u001b[43m \u001b[49m\u001b[43mwork_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 956\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 957\u001b[0m \u001b[43m \u001b[49m\u001b[43mfiles_timestamps\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 958\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommit_message\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_message\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 959\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 960\u001b[0m \u001b[43m \u001b[49m\u001b[43mcreate_pr\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcreate_pr\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 961\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 962\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommit_description\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_description\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 963\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/transformers/utils/hub.py:818\u001b[0m, in \u001b[0;36mPushToHubMixin._upload_modified_files\u001b[0;34m(self, working_dir, repo_id, files_timestamps, commit_message, token, create_pr, revision, commit_description)\u001b[0m\n\u001b[1;32m 815\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 817\u001b[0m logger\u001b[38;5;241m.\u001b[39minfo(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUploading the following files to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrepo_id\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m,\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(modified_files)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 818\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcreate_commit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 819\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 820\u001b[0m \u001b[43m \u001b[49m\u001b[43moperations\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moperations\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 821\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommit_message\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_message\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 822\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommit_description\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_description\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 823\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 824\u001b[0m \u001b[43m \u001b[49m\u001b[43mcreate_pr\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcreate_pr\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 825\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 826\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/huggingface_hub/hf_api.py:1518\u001b[0m, in \u001b[0;36mfuture_compatible.._inner\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_as_future(fn, \u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;66;03m# Otherwise, call the function normally\u001b[39;00m\n\u001b[0;32m-> 1518\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/huggingface_hub/hf_api.py:4086\u001b[0m, in \u001b[0;36mHfApi.create_commit\u001b[0;34m(self, repo_id, operations, commit_message, commit_description, token, repo_type, revision, create_pr, num_threads, parent_commit, run_as_future)\u001b[0m\n\u001b[1;32m 4083\u001b[0m params \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcreate_pr\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m1\u001b[39m\u001b[38;5;124m\"\u001b[39m} \u001b[38;5;28;01mif\u001b[39;00m create_pr \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 4085\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 4086\u001b[0m commit_resp \u001b[38;5;241m=\u001b[39m \u001b[43mget_session\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpost\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_url\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4087\u001b[0m hf_raise_for_status(commit_resp, endpoint_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcommit\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 4088\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m RepositoryNotFoundError \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/requests/sessions.py:637\u001b[0m, in \u001b[0;36mSession.post\u001b[0;34m(self, url, data, json, **kwargs)\u001b[0m\n\u001b[1;32m 626\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost\u001b[39m(\u001b[38;5;28mself\u001b[39m, url, data\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, json\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 627\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a POST request. Returns :class:`Response` object.\u001b[39;00m\n\u001b[1;32m 628\u001b[0m \n\u001b[1;32m 629\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 634\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 635\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 637\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPOST\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/huggingface_hub/utils/_http.py:93\u001b[0m, in \u001b[0;36mUniqueRequestIdAdapter.send\u001b[0;34m(self, request, *args, **kwargs)\u001b[0m\n\u001b[1;32m 91\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Catch any RequestException to append request id to the error message for debugging.\"\"\"\u001b[39;00m\n\u001b[1;32m 92\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 93\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m requests\u001b[38;5;241m.\u001b[39mRequestException \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 95\u001b[0m request_id \u001b[38;5;241m=\u001b[39m request\u001b[38;5;241m.\u001b[39mheaders\u001b[38;5;241m.\u001b[39mget(X_AMZN_TRACE_ID)\n",
+ "File \u001b[0;32m~/.config/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/requests/adapters.py:682\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m conn\u001b[38;5;241m.\u001b[39murlopen(\n\u001b[1;32m 668\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 669\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 678\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[1;32m 679\u001b[0m )\n\u001b[1;32m 681\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m--> 682\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[1;32m 684\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m MaxRetryError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 685\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e\u001b[38;5;241m.\u001b[39mreason, ConnectTimeoutError):\n\u001b[1;32m 686\u001b[0m \u001b[38;5;66;03m# TODO: Remove this in 3.0.0: see #2811\u001b[39;00m\n",
+ "\u001b[0;31mConnectionError\u001b[0m: (ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')), '(Request ID: 4f29ef98-416f-4d91-bd52-997d447a0e2a)')"
+ ]
+ }
+ ],
+ "source": [
+ "model.push_to_hub(\"marcoorasch/llama-3.2-3B-instruct-hatespeech-offensive-classification\",use_temp_dir=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "3d94aa30-c59d-4575-a0b6-1d6c87f1087e",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.5"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}