{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "de38bf8f-3186-4014-a29e-eca49cb72aea", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.\n", "🦥 Unsloth Zoo will now patch everything to make training faster!\n", "==((====))== Unsloth 2025.3.14: Fast Qwen2 patching. Transformers: 4.49.0.\n", " \\\\ /| NVIDIA A100-PCIE-40GB. Num GPUs = 1. Max memory: 39.394 GB. Platform: Linux.\n", "O^O/ \\_/ \\ Torch: 2.5.1+cu121. CUDA: 8.0. CUDA Toolkit: 12.1. Triton: 3.1.0\n", "\\ / Bfloat16 = TRUE. FA [Xformers = 0.0.29.post1. FA2 = False]\n", " \"-____-\" Free license: http://github.com/unslothai/unsloth\n", "Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "38898fae87c94e53ba161b9a7d1c38fb", "version_major": 2, "version_minor": 0 }, "text/plain": [ "model.safetensors: 0%| | 0.00/3.09G [00:00 0 ! Suggested 8, 16, 32, 64, 128\n", " target_modules = [\"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\n", " \"gate_proj\", \"up_proj\", \"down_proj\",],\n", " lora_alpha = 16,\n", " lora_dropout = 0, # Supports any, but = 0 is optimized\n", " bias = \"none\", # Supports any, but = \"none\" is optimized\n", " # [NEW] \"unsloth\" uses 30% less VRAM, fits 2x larger batch sizes!\n", " use_gradient_checkpointing = \"unsloth\", # True or \"unsloth\" for very long context\n", " random_state = 3407,\n", " use_rslora = False, # We support rank stabilized LoRA\n", " loftq_config = None, # And LoftQ\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "3b8cd54e-88de-4247-8788-e068b7239555", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e94729d01636494bbe2ba05ebe015f46", "version_major": 2, "version_minor": 0 }, "text/plain": [ "README.md: 0%| | 0.00/5.60k [00:00system\n", "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n", "<|im_start|>user\n", "The cost of five pencils and one pen is $\\$2.50$, and the cost of one pencil and two pens is $\\$1.85$. What is the cost of two pencils and one pen?<|im_end|>\n", "<|im_start|>assistant\n", "\n", "Alright, let's try to solve this problem step by step. So, we have two equations here:\n", "\n", "1. The cost of five pencils and one pen is $2.50.\n", "2. The cost of one pencil and two pens is $1.85.\n", "\n", "We need t...\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3c4bfda39749415a9c1b3a330cf5365b", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Saving the dataset (0/1 shards): 0%| | 0/10000 [00:00system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n'\n", "\n", " # Add each message\n", " for message in messages:\n", " role = message.get('role')\n", " content = message.get('content')\n", "\n", " if role and content:\n", " # Add formatted message\n", " target_format += f'<|im_start|>{role}\\n{content}<|im_end|>\\n'\n", "\n", " return target_format\n", "\n", "def process_dataset():\n", " # Load the dataset from Hugging Face\n", " dataset = load_dataset(\"oumi-ai/MetaMathQA-R1\")\n", "\n", " # Create new datasets dict to store the converted data\n", " converted_datasets = {}\n", "\n", " # Process each split in the dataset\n", " for split_name in dataset.keys():\n", " print(f\"\\nProcessing split: {split_name}\")\n", " split = dataset[split_name]\n", "\n", " # Check if 'messages' column exists in this split\n", " if 'messages' in split.column_names:\n", " messages_list = split['messages']\n", " print(f\"Number of examples in {split_name}: {len(messages_list)}\")\n", "\n", " # Get the first 10000 examples (or all if less than 10000)\n", " num_examples = min(10000, len(messages_list))\n", "\n", " # Convert each messages entry and store in a list\n", " converted_texts = []\n", " for i in range(num_examples):\n", " # Convert this entry to the target format\n", " converted = convert_format(messages_list[i])\n", " converted_texts.append(converted)\n", "\n", " # Print progress\n", " if i % 1000 == 0:\n", " print(f\"Processed {i} examples\")\n", "\n", " # Create a new dataset with a 'text' column containing the converted data\n", " converted_dataset = Dataset.from_dict({\"text\": converted_texts})\n", " converted_datasets[split_name] = converted_dataset\n", "\n", " print(f\"Conversion complete for {split_name}, processed {num_examples} examples\")\n", " else:\n", " print(f\"'messages' column not found in {split_name} split\")\n", "\n", " return converted_datasets\n", "\n", "if __name__ == \"__main__\":\n", " # Process the dataset and get the converted datasets\n", " converted_data = process_dataset()\n", "\n", " # Example of accessing an element (if 'train' split exists)\n", " if 'train' in converted_data:\n", " print(\"\\nExample of accessing converted data:\")\n", " print(\"Dataset[0]['text']:\")\n", " print(converted_data['train'][0]['text'][:500] + \"...\") # Show first 500 chars\n", "\n", " # You can save the datasets if needed\n", " for split_name, dataset in converted_data.items():\n", " dataset.save_to_disk(f\"converted_{split_name}\")\n", " print(f\"Saved {split_name} dataset to disk as 'converted_{split_name}'\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "7117b4c2-1dde-4b46-bd51-16bba68b4c44", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c71365ef63df431fbf20b5838703cad9", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Unsloth: Tokenizing [\"text\"] (num_proc=2): 0%| | 0/10000 [00:00user\\n\",\n", " response_part = \"<|im_start|>assistant\\n\",\n", ")" ] }, { "cell_type": "code", "execution_count": 7, "id": "93d21670-3de4-473f-872f-810e77f80d21", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n<|im_start|>user\\nThe cost of five pencils and one pen is $\\\\$2.50$, and the cost of one pencil and two pens is $\\\\$1.85$. What is the cost of two pencils and one pen?<|im_end|>\\n<|im_start|>assistant\\n\\nAlright, let\\'s try to solve this problem step by step. So, we have two equations here:\\n\\n1. The cost of five pencils and one pen is $2.50.\\n2. The cost of one pencil and two pens is $1.85.\\n\\nWe need to find the cost of two pencils and one pen. Hmm, okay. So first off, let me assign variables to these things to make it easier. Let\\'s say the cost of one pencil is \"p\" dollars, and the cost of one pen is \"n\" dollars. Then we can translate the given information into equations.\\n\\nFirst equation: Five pencils and one pen cost $2.50. That would be 5 times p plus 1 times n equals 2.50. So, mathematically, that\\'s:\\n\\n5p + n = 2.50\\n\\nSecond equation: One pencil and two pens cost $1.85. That translates to 1 times p plus 2 times n equals 1.85. So:\\n\\np + 2n = 1.85\\n\\nOkay, so now we have a system of two equations with two variables. We need to solve for p and n, and once we have those, we can figure out what 2 pencils and 1 pen would cost by calculating 2p + n.\\n\\nSo, let me think about how to solve these equations. There are a couple of methods: substitution and elimination. Which one would be easier here?\\n\\nLooking at the two equations:\\n\\n1) 5p + n = 2.50 \\n2) p + 2n = 1.85\\n\\nMaybe substitution would work. Let\\'s see. Maybe if we solve one of the equations for one variable and substitute into the other. Let\\'s take the first equation, maybe solve for n.\\n\\nFrom equation 1: \\n5p + n = 2.50 \\nSo, subtract 5p from both sides: \\nn = 2.50 - 5p\\n\\nNow, substitute this expression for n into equation 2. Equation 2 is p + 2n = 1.85. Substituting:\\n\\np + 2*(2.50 - 5p) = 1.85\\n\\nLet me compute that. Multiply out the 2:\\n\\np + 5.00 - 10p = 1.85\\n\\nCombine like terms (p - 10p): \\n-9p + 5.00 = 1.85\\n\\nNow, subtract 5.00 from both sides:\\n\\n-9p = 1.85 - 5.00 \\nWhich is:\\n\\n-9p = -3.15\\n\\nDivide both sides by -9:\\n\\np = (-3.15)/(-9) = 3.15 / 9\\n\\nHmm, let me do that division. 3.15 divided by 9. Let\\'s see, 9 goes into 3.15 how many times?\\n\\nWell, 9 x 0.35 is 3.15. Because 9 x 0.30 = 2.70, and 9 x 0.05 = 0.45, so 2.70 + 0.45 = 3.15. Yup. So, p = 0.35. So each pencil is 35 cents.\\n\\nNow, substitute p = 0.35 back into our expression for n. Earlier, we had n = 2.50 - 5p. Let\\'s plug that in:\\n\\nn = 2.50 - 5*(0.35) \\nCalculate 5*0.35: that\\'s 1.75 \\nSo:\\n\\nn = 2.50 - 1.75 \\nWhich is 0.75. So, a pen is 75 cents.\\n\\nLet me check to make sure these values satisfy both equations.\\n\\nFirst equation: 5 pencils and 1 pen. 5*0.35 is 1.75, plus 0.75 is 2.50. That checks out. Second equation: 1 pencil is 0.35, 2 pens is 0.75*2=1.50. Together, 0.35 + 1.50 = 1.85, which matches the second equation. So, p = $0.35 and n = $0.75 are correct.\\n\\nNow, the question asks for the cost of two pencils and one pen. So, 2p + n.\\n\\nLet\\'s compute that: 2*0.35 + 0.75. That is 0.70 + 0.75 = 1.45. So, the answer should be $1.45.\\n\\nWait, let\\'s make sure we didn\\'t make any arithmetic mistakes. Let\\'s retrace:\\n\\n1. Assigned variables: p = pencil, n = pen.\\n\\n2. Equations: 5p + n = 2.50 and p + 2n = 1.85.\\n\\n3. Solved first equation for n: n = 2.50 -5p.\\n\\n4. Substituted into second equation: p + 2*(2.50 -5p) = 1.85.\\n\\n5. Calculated that as p + 5.00 -10p =1.85, simplifies to -9p +5.00 =1.85.\\n\\n6. Subtract 5: -9p = -3.15, divide by -9: p=0.35.\\n\\n7. Then n = 2.50 -5*0.35=2.50 -1.75=0.75.\\n\\n8. Cost for two pencils and one pen: 2*0.35 +0.75=0.70+0.75=1.45.\\n\\nYes, that all seems correct.\\n\\nAlternatively, we can test using elimination to see if we get the same result.\\n\\nLet me try the elimination method as a check. Maybe multiply the second equation by five:\\n\\nEquation 1: 5p + n = 2.50 \\nEquation 2: p + 2n = 1.85\\n\\nMultiply equation 2 by 5:\\n\\n5p + 10n = 9.25\\n\\nNow subtract equation 1 from this new equation:\\n\\n(5p + 10n) - (5p +n) = 9.25 -2.50 \\nWhich is 5p +10n -5p -n = 6.75 \\nSimplifies to 9n =6.75 \\nThus, n=6.75 /9=0.75.\\n\\nSo, n=0.75. Then substitute back into equation2: p +2*0.75=1.85 \\np +1.50=1.85 \\np=1.85 -1.50=0.35.\\n\\nSame results. So, that reaffirms p=0.35 and n=0.75. So, 2p +n=0.70 +0.75=1.45. Therefore, the answer is indeed $1.45. So written in dollars, that\\'s \\\\$1.45. Hence, the cost of two pencils and one pen is \\\\$1.45.\\n\\nI can see that both substitution and elimination methods give the same answer. So, unless there\\'s a miscalculation that I\\'m missing, the answer should be \\\\$1.45. Given that cross-verification hasn\\'t shown any problems, I think that is correct.\\n\\n**Final Answer**\\n\\\\boxed{1.45}\\n\\n\\nLet \\\\( p \\\\) be the cost of one pencil in dollars and \\\\( n \\\\) be the cost of one pen in dollars. We are given the following system of equations:\\n\\n1. \\\\( 5p + n = 2.50 \\\\)\\n2. \\\\( p + 2n = 1.85 \\\\)\\n\\nFirst, solve the first equation for \\\\( n \\\\):\\n\\\\[\\nn = 2.50 - 5p\\n\\\\]\\n\\nSubstitute this expression for \\\\( n \\\\) into the second equation:\\n\\\\[\\np + 2(2.50 - 5p) = 1.85\\n\\\\]\\nSimplify and solve for \\\\( p \\\\):\\n\\\\[\\np + 5.00 - 10p = 1.85 \\\\\\\\\\n-9p + 5.00 = 1.85 \\\\\\\\\\n-9p = 1.85 - 5.00 \\\\\\\\\\n-9p = -3.15 \\\\\\\\\\np = \\\\frac{-3.15}{-9} = 0.35\\n\\\\]\\n\\nNow substitute \\\\( p = 0.35 \\\\) back into the expression for \\\\( n \\\\):\\n\\\\[\\nn = 2.50 - 5(0.35) \\\\\\\\\\nn = 2.50 - 1.75 \\\\\\\\\\nn = 0.75\\n\\\\]\\n\\nWe need to find the cost of two pencils and one pen, which is \\\\( 2p + n \\\\):\\n\\\\[\\n2(0.35) + 0.75 = 0.70 + 0.75 = 1.45\\n\\\\]\\n\\nThus, the cost of two pencils and one pen is \\\\(\\\\boxed{1.45}\\\\).<|im_end|>\\n'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tokenizer.decode(trainer.train_dataset[0][\"input_ids\"])" ] }, { "cell_type": "code", "execution_count": 8, "id": "0625d8df-5034-4597-8650-c06530aabc22", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "' \\nAlright, let\\'s try to solve this problem step by step. So, we have two equations here:\\n\\n1. The cost of five pencils and one pen is $2.50.\\n2. The cost of one pencil and two pens is $1.85.\\n\\nWe need to find the cost of two pencils and one pen. Hmm, okay. So first off, let me assign variables to these things to make it easier. Let\\'s say the cost of one pencil is \"p\" dollars, and the cost of one pen is \"n\" dollars. Then we can translate the given information into equations.\\n\\nFirst equation: Five pencils and one pen cost $2.50. That would be 5 times p plus 1 times n equals 2.50. So, mathematically, that\\'s:\\n\\n5p + n = 2.50\\n\\nSecond equation: One pencil and two pens cost $1.85. That translates to 1 times p plus 2 times n equals 1.85. So:\\n\\np + 2n = 1.85\\n\\nOkay, so now we have a system of two equations with two variables. We need to solve for p and n, and once we have those, we can figure out what 2 pencils and 1 pen would cost by calculating 2p + n.\\n\\nSo, let me think about how to solve these equations. There are a couple of methods: substitution and elimination. Which one would be easier here?\\n\\nLooking at the two equations:\\n\\n1) 5p + n = 2.50 \\n2) p + 2n = 1.85\\n\\nMaybe substitution would work. Let\\'s see. Maybe if we solve one of the equations for one variable and substitute into the other. Let\\'s take the first equation, maybe solve for n.\\n\\nFrom equation 1: \\n5p + n = 2.50 \\nSo, subtract 5p from both sides: \\nn = 2.50 - 5p\\n\\nNow, substitute this expression for n into equation 2. Equation 2 is p + 2n = 1.85. Substituting:\\n\\np + 2*(2.50 - 5p) = 1.85\\n\\nLet me compute that. Multiply out the 2:\\n\\np + 5.00 - 10p = 1.85\\n\\nCombine like terms (p - 10p): \\n-9p + 5.00 = 1.85\\n\\nNow, subtract 5.00 from both sides:\\n\\n-9p = 1.85 - 5.00 \\nWhich is:\\n\\n-9p = -3.15\\n\\nDivide both sides by -9:\\n\\np = (-3.15)/(-9) = 3.15 / 9\\n\\nHmm, let me do that division. 3.15 divided by 9. Let\\'s see, 9 goes into 3.15 how many times?\\n\\nWell, 9 x 0.35 is 3.15. Because 9 x 0.30 = 2.70, and 9 x 0.05 = 0.45, so 2.70 + 0.45 = 3.15. Yup. So, p = 0.35. So each pencil is 35 cents.\\n\\nNow, substitute p = 0.35 back into our expression for n. Earlier, we had n = 2.50 - 5p. Let\\'s plug that in:\\n\\nn = 2.50 - 5*(0.35) \\nCalculate 5*0.35: that\\'s 1.75 \\nSo:\\n\\nn = 2.50 - 1.75 \\nWhich is 0.75. So, a pen is 75 cents.\\n\\nLet me check to make sure these values satisfy both equations.\\n\\nFirst equation: 5 pencils and 1 pen. 5*0.35 is 1.75, plus 0.75 is 2.50. That checks out. Second equation: 1 pencil is 0.35, 2 pens is 0.75*2=1.50. Together, 0.35 + 1.50 = 1.85, which matches the second equation. So, p = $0.35 and n = $0.75 are correct.\\n\\nNow, the question asks for the cost of two pencils and one pen. So, 2p + n.\\n\\nLet\\'s compute that: 2*0.35 + 0.75. That is 0.70 + 0.75 = 1.45. So, the answer should be $1.45.\\n\\nWait, let\\'s make sure we didn\\'t make any arithmetic mistakes. Let\\'s retrace:\\n\\n1. Assigned variables: p = pencil, n = pen.\\n\\n2. Equations: 5p + n = 2.50 and p + 2n = 1.85.\\n\\n3. Solved first equation for n: n = 2.50 -5p.\\n\\n4. Substituted into second equation: p + 2*(2.50 -5p) = 1.85.\\n\\n5. Calculated that as p + 5.00 -10p =1.85, simplifies to -9p +5.00 =1.85.\\n\\n6. Subtract 5: -9p = -3.15, divide by -9: p=0.35.\\n\\n7. Then n = 2.50 -5*0.35=2.50 -1.75=0.75.\\n\\n8. Cost for two pencils and one pen: 2*0.35 +0.75=0.70+0.75=1.45.\\n\\nYes, that all seems correct.\\n\\nAlternatively, we can test using elimination to see if we get the same result.\\n\\nLet me try the elimination method as a check. Maybe multiply the second equation by five:\\n\\nEquation 1: 5p + n = 2.50 \\nEquation 2: p + 2n = 1.85\\n\\nMultiply equation 2 by 5:\\n\\n5p + 10n = 9.25\\n\\nNow subtract equation 1 from this new equation:\\n\\n(5p + 10n) - (5p +n) = 9.25 -2.50 \\nWhich is 5p +10n -5p -n = 6.75 \\nSimplifies to 9n =6.75 \\nThus, n=6.75 /9=0.75.\\n\\nSo, n=0.75. Then substitute back into equation2: p +2*0.75=1.85 \\np +1.50=1.85 \\np=1.85 -1.50=0.35.\\n\\nSame results. So, that reaffirms p=0.35 and n=0.75. So, 2p +n=0.70 +0.75=1.45. Therefore, the answer is indeed $1.45. So written in dollars, that\\'s \\\\$1.45. Hence, the cost of two pencils and one pen is \\\\$1.45.\\n\\nI can see that both substitution and elimination methods give the same answer. So, unless there\\'s a miscalculation that I\\'m missing, the answer should be \\\\$1.45. Given that cross-verification hasn\\'t shown any problems, I think that is correct.\\n\\n**Final Answer**\\n\\\\boxed{1.45}\\n\\n\\nLet \\\\( p \\\\) be the cost of one pencil in dollars and \\\\( n \\\\) be the cost of one pen in dollars. We are given the following system of equations:\\n\\n1. \\\\( 5p + n = 2.50 \\\\)\\n2. \\\\( p + 2n = 1.85 \\\\)\\n\\nFirst, solve the first equation for \\\\( n \\\\):\\n\\\\[\\nn = 2.50 - 5p\\n\\\\]\\n\\nSubstitute this expression for \\\\( n \\\\) into the second equation:\\n\\\\[\\np + 2(2.50 - 5p) = 1.85\\n\\\\]\\nSimplify and solve for \\\\( p \\\\):\\n\\\\[\\np + 5.00 - 10p = 1.85 \\\\\\\\\\n-9p + 5.00 = 1.85 \\\\\\\\\\n-9p = 1.85 - 5.00 \\\\\\\\\\n-9p = -3.15 \\\\\\\\\\np = \\\\frac{-3.15}{-9} = 0.35\\n\\\\]\\n\\nNow substitute \\\\( p = 0.35 \\\\) back into the expression for \\\\( n \\\\):\\n\\\\[\\nn = 2.50 - 5(0.35) \\\\\\\\\\nn = 2.50 - 1.75 \\\\\\\\\\nn = 0.75\\n\\\\]\\n\\nWe need to find the cost of two pencils and one pen, which is \\\\( 2p + n \\\\):\\n\\\\[\\n2(0.35) + 0.75 = 0.70 + 0.75 = 1.45\\n\\\\]\\n\\nThus, the cost of two pencils and one pen is \\\\(\\\\boxed{1.45}\\\\).<|im_end|>\\n'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "space = tokenizer(\" \", add_special_tokens = False).input_ids[0]\n", "tokenizer.decode([space if x == -100 else x for x in trainer.train_dataset[0][\"labels\"]])" ] }, { "cell_type": "code", "execution_count": 9, "id": "0e8c8bb6-0907-4106-a3cb-94c8b3c6da1c", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "==((====))== Unsloth - 2x faster free finetuning | Num GPUs used = 1\n", " \\\\ /| Num examples = 10,000 | Num Epochs = 6 | Total steps = 936\n", "O^O/ \\_/ \\ Batch size per device = 16 | Gradient accumulation steps = 4\n", "\\ / Data Parallel GPUs = 1 | Total batch size (16 x 4 x 1) = 64\n", " \"-____-\" Trainable parameters = 36,929,536/1,580,643,840 (2.34% trained)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Unsloth: Will smartly offload gradients to save VRAM!\n" ] }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " [936/936 7:52:53, Epoch 5/6]\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
StepTraining Loss
501.074000
1000.914600
1500.853400
2000.823500
2500.826000
3000.831000
3500.811000
4000.805300
4500.803300
5000.790300
5500.783200
6000.784600
6500.784000
7000.771100
7500.767800
8000.773000
8500.768000
9000.756900

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "trainer_stats = trainer.train()" ] }, { "cell_type": "code", "execution_count": null, "id": "d5fb9b55-1819-44da-ba3a-1a6bc976b80b", "metadata": {}, "outputs": [], "source": [ "from huggingface_hub import login\n", "login()" ] }, { "cell_type": "code", "execution_count": 10, "id": "51fe7a4e-a22f-4809-883c-811d2799bb42", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('lora_model/tokenizer_config.json',\n", " 'lora_model/special_tokens_map.json',\n", " 'lora_model/vocab.json',\n", " 'lora_model/merges.txt',\n", " 'lora_model/added_tokens.json',\n", " 'lora_model/tokenizer.json')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model.save_pretrained(\"lora_model\") # Local saving\n", "tokenizer.save_pretrained(\"lora_model\")\n", "# model.push_to_hub(\"your_name/lora_model\", token = \"...\") # Online saving\n", "# tokenizer.push_to_hub(\"your_name/lora_model\", token = \"...\") # Online saving" ] }, { "cell_type": "code", "execution_count": null, "id": "e8a1585a-5acd-4571-a291-3db9a04d826d", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python3 (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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }