|
59 | 59 | "from datasets import load_dataset\n",
|
60 | 60 | "from functools import partial\n",
|
61 | 61 | "import os\n",
|
| 62 | + "import time\n", |
62 | 63 | "from peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training, AutoPeftModelForCausalLM\n",
|
63 | 64 | "import torch\n",
|
64 | 65 | "from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed, Trainer, TrainingArguments, BitsAndBytesConfig, \\\n",
|
|
357 | 358 | "## Load model"
|
358 | 359 | ]
|
359 | 360 | },
|
| 361 | + { |
| 362 | + "cell_type": "code", |
| 363 | + "execution_count": null, |
| 364 | + "metadata": {}, |
| 365 | + "outputs": [], |
| 366 | + "source": [ |
| 367 | + "models_list = [\n", |
| 368 | + " \"codellama/CodeLlama-7b-Python-hf\",\n", |
| 369 | + " \"codellama/CodeLlama-13b-Python-hf\",\n", |
| 370 | + " \"codellama/CodeLlama-34b-Python-hf\",\n", |
| 371 | + " \"codellama/CodeLlama-7b-Instruct-hf\",\n", |
| 372 | + " \"codellama/CodeLlama-13b-Instruct-hf\",\n", |
| 373 | + " \"codellama/CodeLlama-34b-Instruct-hf\",\n", |
| 374 | + " \"meta-llama/Llama-2-7b-hf\",\n", |
| 375 | + " \"meta-llama/Llama-2-13b-hf\",\n", |
| 376 | + " \"meta-llama/Llama-2-70b-hf\",\n", |
| 377 | + " \"lmsys/vicuna-7b-v1.5\",\n", |
| 378 | + " \"lmsys/vicuna-13b-v1.5\",\n", |
| 379 | + " \"lmsys/vicuna-33b-v1.3\",\n", |
| 380 | + " \"Phind/Phind-CodeLlama-34B-v2\",\n", |
| 381 | + " \"Phind/Phind-CodeLlama-34B-Python-v1\",\n", |
| 382 | + " \"WizardLM/WizardCoder-Python-7B-V1.0\",\n", |
| 383 | + " \"WizardLM/WizardCoder-Python-13B-V1.0\",\n", |
| 384 | + " \"WizardLM/WizardCoder-Python-34B-V1.0\",\n", |
| 385 | + " \"microsoft/Orca-2-7b\",\n", |
| 386 | + " \"microsoft/Orca-2-13b\",\n", |
| 387 | + "]" |
| 388 | + ] |
| 389 | + }, |
360 | 390 | {
|
361 | 391 | "cell_type": "code",
|
362 | 392 | "execution_count": null,
|
|
365 | 395 | "outputs": [],
|
366 | 396 | "source": [
|
367 | 397 | "# Load model from HF with user's token and with bitsandbytes config\n",
|
368 |
| - "models_list = [\"meta-llama/Llama-2-7b-hf\", \"meta-llama/Llama-2-13b-hf\"]\n", |
369 | 398 | "output_dir_str = \"/scratch/hpc-prf-hdgen/ashwin/finetuned_models/ft_{model_name}\"\n",
|
370 | 399 | "output_dir_merged_str = \"/scratch/hpc-prf-hdgen/ashwin/finetuned_models/ft_{model_name}_merged\"\n",
|
371 | 400 | "\n",
|
| 401 | + "start_time = time.time()\n", |
372 | 402 | "for model_name in models_list:\n",
|
373 | 403 | " print(f\"Processing Model: {model_name}\")\n",
|
374 | 404 | " # model_name = \"meta-llama/Llama-2-7b-hf\" \n",
|
|
396 | 426 | "\n",
|
397 | 427 | " # save tokenizer for easy inference\n",
|
398 | 428 | " tokenizer = AutoTokenizer.from_pretrained(model_name)\n",
|
399 |
| - " tokenizer.save_pretrained(output_merged_dir)\n" |
| 429 | + " tokenizer.save_pretrained(output_merged_dir)\n", |
| 430 | + "\n", |
| 431 | + "print(f\"DONE! Took{time.time()-start_time}\")" |
400 | 432 | ]
|
401 | 433 | }
|
402 | 434 | ],
|
|
0 commit comments