Skip to content

Commit 49322c9

Browse files
Minor Multi-model FT
1 parent a4b2a35 commit 49322c9

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Models
2+
3+
- codellama:7b-python
4+
- codellama:13b-python
5+
- codellama:34b-python
6+
- codellama:7b-instruct
7+
- codellama:13b-instruct
8+
- codellama:34b-instruct
9+
- llama2:7b
10+
- llama2:13b
11+
- llama2:70b
12+
- vicuna:7b
13+
- vicuna:13b
14+
- vicuna:33b
15+
- phind-codellama:34b-v2
16+
- phind-codellama:34b-python
17+
- wizardcoder:7b-python
18+
- wizardcoder:13b-python
19+
- wizardcoder:34b-python
20+
- orca2:7b
21+
- orca2:13b
22+
- gpt-3.5-turbo
23+
- gpt-4
24+
25+
# HG
26+
27+
- codellama/CodeLlama-7b-Python-hf
28+
- codellama/CodeLlama-13b-Python-hf
29+
- codellama/CodeLlama-34b-Python-hf
30+
- codellama/CodeLlama-7b-Instruct-hf
31+
- codellama/CodeLlama-13b-Instruct-hf
32+
- codellama/CodeLlama-34b-Instruct-hf
33+
- meta-llama/Llama-2-7b-hf
34+
- meta-llama/Llama-2-13b-hf
35+
- meta-llama/Llama-2-70b-hf
36+
- lmsys/vicuna-7b-v1.5
37+
- lmsys/vicuna-13b-v1.5
38+
- lmsys/vicuna-33b-v1.3
39+
- Phind/Phind-CodeLlama-34B-v2
40+
- Phind/Phind-CodeLlama-34B-Python-v1
41+
- WizardLM/WizardCoder-Python-7B-V1.0
42+
- WizardLM/WizardCoder-Python-13B-V1.0
43+
- WizardLM/WizardCoder-Python-34B-V1.0
44+
- microsoft/Orca-2-7b
45+
- microsoft/Orca-2-13b

src/target_tools/ollama/src/fine_tuning/llama_fine_tuning.ipynb

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"from datasets import load_dataset\n",
6060
"from functools import partial\n",
6161
"import os\n",
62+
"import time\n",
6263
"from peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training, AutoPeftModelForCausalLM\n",
6364
"import torch\n",
6465
"from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed, Trainer, TrainingArguments, BitsAndBytesConfig, \\\n",
@@ -357,6 +358,35 @@
357358
"## Load model"
358359
]
359360
},
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+
},
360390
{
361391
"cell_type": "code",
362392
"execution_count": null,
@@ -365,10 +395,10 @@
365395
"outputs": [],
366396
"source": [
367397
"# 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",
369398
"output_dir_str = \"/scratch/hpc-prf-hdgen/ashwin/finetuned_models/ft_{model_name}\"\n",
370399
"output_dir_merged_str = \"/scratch/hpc-prf-hdgen/ashwin/finetuned_models/ft_{model_name}_merged\"\n",
371400
"\n",
401+
"start_time = time.time()\n",
372402
"for model_name in models_list:\n",
373403
" print(f\"Processing Model: {model_name}\")\n",
374404
" # model_name = \"meta-llama/Llama-2-7b-hf\" \n",
@@ -396,7 +426,9 @@
396426
"\n",
397427
" # save tokenizer for easy inference\n",
398428
" 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}\")"
400432
]
401433
}
402434
],
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
torch
2+
accelerate @ git+https://github.com/huggingface/accelerate.git
3+
bitsandbytes
4+
datasets
5+
transformers @ git+https://github.com/huggingface/transformers.git
6+
peft @ git+https://github.com/huggingface/peft.git
7+
trl @ git+https://github.com/lvwerra/trl.git
8+
scipy

0 commit comments

Comments
 (0)