Spaces:
Build error
Build error
File size: 14,443 Bytes
25aea89 |
1 |
{"cells":[{"cell_type":"code","execution_count":10,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{},"inputWidgets":{},"nuid":"0ea8b46b-839b-445b-8043-ccdf4e920ace","showTitle":false,"title":""},"id":"YLH80COBzi_F","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1719451913970,"user_tz":-480,"elapsed":471,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"0104a389-132f-4fd9-89f6-aae27bb8c369"},"outputs":[{"output_type":"stream","name":"stdout","text":["The autoreload extension is already loaded. To reload it, use:\n"," %reload_ext autoreload\n"]}],"source":["%load_ext autoreload\n","%autoreload 2"]},{"cell_type":"code","source":["from google.colab import drive\n","drive.mount('/content/drive')"],"metadata":{"id":"63B5exAuzq4M","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1719451916936,"user_tz":-480,"elapsed":2581,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"21003e67-b8be-4ea5-e210-eed179e28f0a"},"execution_count":11,"outputs":[{"output_type":"stream","name":"stdout","text":["Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"]}]},{"cell_type":"code","source":["workding_dir = \"/content/drive/MyDrive/logical-reasoning/\""],"metadata":{"id":"zFulf0bg0H-9","executionInfo":{"status":"ok","timestamp":1719451916936,"user_tz":-480,"elapsed":2,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}}},"execution_count":12,"outputs":[]},{"cell_type":"code","execution_count":13,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{},"inputWidgets":{},"nuid":"6d394937-6c99-4a7c-9d32-7600a280032f","showTitle":false,"title":""},"id":"Rzln0ffbzi_H","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1719451916936,"user_tz":-480,"elapsed":2,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"7d792e4a-0c1c-4682-f398-b59f0cbf6a47"},"outputs":[{"output_type":"stream","name":"stdout","text":["workding dir: /content/drive/MyDrive/logical-reasoning/\n"]}],"source":["import os\n","import sys\n","from pathlib import Path\n","\n","os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","source":["%%capture\n","# Installs Unsloth, Xformers (Flash Attention) and all other packages!\n","!pip install \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git\"\n","!pip install --no-deps xformers \"trl<0.9.0\" peft accelerate bitsandbytes"],"metadata":{"id":"blBRUfev1ccE","executionInfo":{"status":"ok","timestamp":1719452306704,"user_tz":-480,"elapsed":19373,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}}},"execution_count":19,"outputs":[]},{"cell_type":"code","source":["%%capture\n","!pip install -r requirements.txt"],"metadata":{"id":"zUqv4IUmU6Yv","executionInfo":{"status":"ok","timestamp":1719452341495,"user_tz":-480,"elapsed":9646,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}}},"execution_count":22,"outputs":[]},{"cell_type":"code","execution_count":24,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{},"inputWidgets":{},"nuid":"9f67ec60-2f24-411c-84eb-0dd664b44775","showTitle":false,"title":""},"id":"DIUiweYYzi_I","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1719452361195,"user_tz":-480,"elapsed":369,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"9772a343-40cf-4216-df67-6176908693ad"},"outputs":[{"output_type":"stream","name":"stdout","text":["loading env vars from: /content/drive/MyDrive/logical-reasoning/.env.example\n"]},{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":24}],"source":["from dotenv import find_dotenv, load_dotenv\n","\n","found_dotenv = find_dotenv(\".env\")\n","\n","if len(found_dotenv) == 0:\n"," found_dotenv = find_dotenv(\".env.example\")\n","print(f\"loading env vars from: {found_dotenv}\")\n","load_dotenv(found_dotenv, override=True)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"4hQO8gkFzi_K","colab":{"base_uri":"https://localhost:8080/"},"outputId":"bdd25999-bbcc-4022-bca0-6f2650e70500"},"outputs":[{"output_type":"stream","name":"stdout","text":["Current Directory:\n","/content/drive/MyDrive/logical-reasoning\n","Thu Jun 27 01:40:46 2024 \n","+---------------------------------------------------------------------------------------+\n","| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 |\n","|-----------------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|=========================================+======================+======================|\n","| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n","| N/A 38C P8 9W / 70W | 0MiB / 15360MiB | 0% Default |\n","| | | N/A |\n","+-----------------------------------------+----------------------+----------------------+\n"," \n","+---------------------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=======================================================================================|\n","| No running processes found |\n","+---------------------------------------------------------------------------------------+\n","Linux 1508906e64c1 6.1.85+ #1 SMP PREEMPT_DYNAMIC Fri May 24 14:06:39 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux\n","PRETTY_NAME=\"Ubuntu 22.04.3 LTS\"\n","NAME=\"Ubuntu\"\n","VERSION_ID=\"22.04\"\n","VERSION=\"22.04.3 LTS (Jammy Jellyfish)\"\n","VERSION_CODENAME=jammy\n","ID=ubuntu\n","ID_LIKE=debian\n","HOME_URL=\"https://www.ubuntu.com/\"\n","SUPPORT_URL=\"https://help.ubuntu.com/\"\n","BUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\n","PRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\n","UBUNTU_CODENAME=jammy\n","Architecture: x86_64\n"," CPU op-mode(s): 32-bit, 64-bit\n"," Address sizes: 46 bits physical, 48 bits virtual\n"," Byte Order: Little Endian\n","CPU(s): 2\n"," On-line CPU(s) list: 0,1\n","Vendor ID: GenuineIntel\n"," Model name: Intel(R) Xeon(R) CPU @ 2.20GHz\n"," CPU family: 6\n"," Model: 79\n"," Thread(s) per core: 2\n"," Core(s) per socket: 1\n"," Socket(s): 1\n"," Stepping: 0\n"," BogoMIPS: 4399.99\n"," Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cl\n"," flush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc re\n"," p_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3\n"," fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand\n"," hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp \n"," fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx sm\n"," ap xsaveopt arat md_clear arch_capabilities\n","Virtualization features: \n"," Hypervisor vendor: KVM\n"," Virtualization type: full\n","Caches (sum of all): \n"," L1d: 32 KiB (1 instance)\n"," L1i: 32 KiB (1 instance)\n"," L2: 256 KiB (1 instance)\n"," L3: 55 MiB (1 instance)\n","NUMA: \n"," NUMA node(s): 1\n"," NUMA node0 CPU(s): 0,1\n","Vulnerabilities: \n"," Gather data sampling: Not affected\n"," Itlb multihit: Not affected\n"," L1tf: Mitigation; PTE Inversion\n"," Mds: Vulnerable; SMT Host state unknown\n"," Meltdown: Vulnerable\n"," Mmio stale data: Vulnerable\n"," Reg file data sampling: Not affected\n"," Retbleed: Vulnerable\n"," Spec rstack overflow: Not affected\n"," Spec store bypass: Vulnerable\n"," Spectre v1: Vulnerable: __user pointer sanitization and usercopy barriers only; no swa\n"," pgs barriers\n"," Spectre v2: Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BH\n"," I: Vulnerable (Syscall hardening enabled)\n"," Srbds: Not affected\n"," Tsx async abort: Vulnerable\n","MemTotal: 13290460 kB\n","Tuning unsloth/Qwen2-0.5B-Instruct\n","loading env vars from: /content/drive/MyDrive/logical-reasoning/.env.example\n","Adding /content/drive/MyDrive/logical-reasoning to sys.path\n","🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.\n","2024-06-27 01:40:52.684349: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n","2024-06-27 01:40:52.684401: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n","2024-06-27 01:40:52.685772: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n","2024-06-27 01:40:52.693223: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n","To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n","2024-06-27 01:40:53.782543: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n","[nltk_data] Downloading package wordnet to /root/nltk_data...\n","[nltk_data] Package wordnet is already up-to-date!\n","[nltk_data] Downloading package punkt to /root/nltk_data...\n","[nltk_data] Package punkt is already up-to-date!\n","[nltk_data] Downloading package omw-1.4 to /root/nltk_data...\n","[nltk_data] Package omw-1.4 is already up-to-date!\n","loading /content/drive/MyDrive/logical-reasoning/llm_toolkit/translation_engine.py\n","unsloth/Qwen2-0.5B-Instruct True 2048 10 None datasets/mac/mac.tsv results/mac-results-colab.csv True False False False\n","(1) GPU = Tesla T4. Max memory = 14.748 GB.\n","0.0 GB of memory reserved.\n","loading model: unsloth/Qwen2-0.5B-Instruct\n","config.json: 100% 1.19k/1.19k [00:00<00:00, 8.35MB/s]\n","==((====))== Unsloth: Fast Qwen2 patching release 2024.6\n"," \\\\ /| GPU: Tesla T4. Max memory: 14.748 GB. Platform = Linux.\n","O^O/ \\_/ \\ Pytorch: 2.3.0+cu121. CUDA = 7.5. CUDA Toolkit = 12.1.\n","\\ / Bfloat16 = FALSE. Xformers = 0.0.26.post1. FA = False.\n"," \"-____-\" Free Apache license: http://github.com/unslothai/unsloth\n","model.safetensors: 100% 457M/457M [00:02<00:00, 222MB/s]\n","generation_config.json: 100% 242/242 [00:00<00:00, 1.28MB/s]\n","Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n","Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n","(2) GPU = Tesla T4. Max memory = 14.748 GB.\n","0.633 GB of memory reserved.\n","loading train/test data files\n","Map: 100% 4528/4528 [00:00<00:00, 21429.62 examples/s]\n","Map: 100% 1133/1133 [00:00<00:00, 25264.07 examples/s]\n","DatasetDict({\n"," train: Dataset({\n"," features: ['chinese', 'english', 'text', 'prompt'],\n"," num_rows: 4528\n"," })\n"," test: Dataset({\n"," features: ['chinese', 'english', 'text', 'prompt'],\n"," num_rows: 1133\n"," })\n","})\n","Evaluating base model: unsloth/Qwen2-0.5B-Instruct\n"," 0% 0/1133 [00:00<?, ?it/s]--------\n","step 1: Old Teng held his gun, closing his eyes and raising one triangular eye. A round shot rang out as the bullet was fired. The cannonball flew like a raindrop through the grass, cracking and clattering.<|im_end|>\n","--------\n","step 2: Old Teng held his gun, closing his eyes and raising one triangular eye. A round shot rang out as the bullet was fired. The cannonball flew like a raindrop through the grass, cracking and clattering.\n","--------\n","step 3: Old Teng held his gun, closing his eyes and raising one triangular eye. A round shot rang out as the bullet was fired. The cannonball flew like a raindrop through the grass, cracking and clattering.\n"," 26% 297/1133 [15:45<48:20, 3.47s/it]"]}],"source":["%%time\n","\n","!chmod +x ./scripts/tune-mac.sh\n","!./scripts/tune-mac.sh"]}],"metadata":{"accelerator":"GPU","application/vnd.databricks.v1+notebook":{"dashboards":[],"environmentMetadata":null,"language":"python","notebookMetadata":{"pythonIndentUnit":4},"notebookName":"07_MAC_+_Qwen2-7B-Instructi_Unsloth_train","widgets":{}},"colab":{"gpuType":"T4","provenance":[]},"kernelspec":{"display_name":"Python 3","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.14"}},"nbformat":4,"nbformat_minor":0} |