Merge branch 'master' of https://git.nielsgeens.be/llm/SIA
This commit is contained in:
@@ -57,7 +57,6 @@
|
||||
" load_in_4bit = True, # False for LoRA 16bit\n",
|
||||
" fast_inference = True, # Enable vLLM fast inference\n",
|
||||
" gpu_memory_utilization = 0.8, # Reduce if out of memory\n",
|
||||
" tokenizer = tokenizer,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -175,19 +174,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
|
||||
"\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
|
||||
"\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
|
||||
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"generation_thread.join()"
|
||||
@@ -198,7 +185,7 @@
|
||||
"kernelspec": {
|
||||
"display_name": "sia",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "sia"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
|
||||
@@ -54,16 +54,6 @@
|
||||
"dataset.validate()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"max_seq_length = 2048 # Can increase for longer reasoning traces\n",
|
||||
"lora_rank = 64 # Larger rank = smarter, but slower"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -87,12 +77,7 @@
|
||||
"source": [
|
||||
"model, _returned_tokenizer = FastLanguageModel.from_pretrained(\n",
|
||||
" model_name = args.base_model,\n",
|
||||
" max_seq_length = max_seq_length,\n",
|
||||
" load_in_4bit = True, # False for LoRA 16bit\n",
|
||||
" fast_inference = True, # Enable vLLM fast inference\n",
|
||||
" max_lora_rank = lora_rank,\n",
|
||||
" gpu_memory_utilization = 0.5, # Reduce if out of memory\n",
|
||||
" tokenizer = tokenizer,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -104,18 +89,14 @@
|
||||
"source": [
|
||||
"model = FastLanguageModel.get_peft_model(\n",
|
||||
" model,\n",
|
||||
" r = lora_rank, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128\n",
|
||||
" target_modules = [\n",
|
||||
" \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\n",
|
||||
" \"gate_proj\", \"up_proj\", \"down_proj\",\n",
|
||||
" ], # Remove QKVO if out of memory\n",
|
||||
" lora_alpha = lora_rank,\n",
|
||||
" ],\n",
|
||||
" lora_dropout = 0, # Supports any, but = 0 is optimized\n",
|
||||
" bias = \"none\", # Supports any, but = \"none\" is optimized\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",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -157,7 +138,6 @@
|
||||
" args=training_args,\n",
|
||||
" train_dataset=dataset.to_transformers_dataset(tokenizer),\n",
|
||||
" dataset_text_field=\"messages\",\n",
|
||||
" max_seq_length=max_seq_length,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -179,16 +159,16 @@
|
||||
"model.save_pretrained_merged(\n",
|
||||
" str(args.output_dir), \n",
|
||||
" tokenizer=tokenizer,\n",
|
||||
" #save_method=\"merged_4bit_forced\"\n",
|
||||
" save_method=\"merged_4bit_forced\"\n",
|
||||
")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "train",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "train"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
|
||||
Reference in New Issue
Block a user