Skip to content

Commit

Permalink
updates peft model saving
Browse files Browse the repository at this point in the history
  • Loading branch information
djliden committed Apr 13, 2024
1 parent 4b99a40 commit a570178
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion notebooks/drafts/olmo_peft.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,21 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from peft import PeftModel, PeftModelForCausalLM, AutoPeftModelForCausalLM\n",
"\n",
"final_peft_model = AutoPeftModelForCausalLM.from_pretrained(\n",
" \"/Volumes/daniel_liden/fine_tuning/assets/final/\",\n",
" device_map=\"auto\",\n",
" load_in_8bit=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -554,7 +569,7 @@
"with mlflow.start_run(run_id=last_run_id):\n",
" mlflow.log_params(lora_config.to_dict())\n",
" mlflow.transformers.log_model(\n",
" transformers_model={\"model\": final_model, \"tokenizer\": tokenizer},\n",
" transformers_model={\"model\": final_peft_model, \"tokenizer\": tokenizer},\n",
" signature=signature,\n",
" artifact_path=\"model\", # This is a relative path to save model files within MLflow run\n",
" )"
Expand Down

0 comments on commit a570178

Please sign in to comment.