Skip to content

Commit

Permalink
feat: add lora fine tuning for llama 3.2 (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrery authored Dec 19, 2024
1 parent 3dfea9d commit ef602d9
Show file tree
Hide file tree
Showing 34 changed files with 7,396 additions and 997 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_timing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow uses GitHub CLI to get timings of last 50 runs of Concrete-ML main CI
# This workflow uses GitHub CLI to get timings of last 50 runs of Concrete ML main CI
# and send it to slack and add it as an artifact on the workflow
name: CML build time
on:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/refresh-one-notebook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- KNearestNeighbors \n
- LinearRegression \n
- LinearSVR \n
- LLamaFineTuning \n
- LogisticRegression \n
- LogisticRegressionTraining \n
- LoraMLP \n
Expand Down Expand Up @@ -76,6 +77,7 @@ env:
KNearestNeighbors: "docs/advanced_examples/KNearestNeighbors.ipynb"
LinearRegression: "docs/advanced_examples/LinearRegression.ipynb"
LinearSVR: "docs/advanced_examples/LinearSVR.ipynb"
LLamaFineTuning: "use_case_examples/lora_finetuning/LLamaFineTuning.ipynb"
LogisticRegression: "docs/advanced_examples/LogisticRegression.ipynb"
LogisticRegressionTraining: "docs/advanced_examples/LogisticRegressionTraining.ipynb"
LoraMLP: "docs/advanced_examples/LoraMLP.ipynb"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:
tags: true

# This action creates docker and pypi images directly on the AWS EC2 instance
# The 'PRIVATE_RELEASE_IMAGE_BASE' variable is kept here in case Concrete-ML starts to publish
# The 'PRIVATE_RELEASE_IMAGE_BASE' variable is kept here in case Concrete ML starts to publish
# private nightly releases one day. Currently, release candidates and actual releases are all
# done through the 'PUBLIC_RELEASE_IMAGE_BASE' image. The private image is also used to list all
# tags easily
Expand Down Expand Up @@ -471,7 +471,7 @@ jobs:
echo "" >> "${SECRETS_FILE}"
echo "SECRETS_FILE=${SECRETS_FILE}" >> "$GITHUB_ENV"
- name: Build Docker Concrete-ML Image
- name: Build Docker Concrete ML Image
if: ${{ success() && !cancelled() }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
Expand Down
18 changes: 9 additions & 9 deletions docs/advanced_examples/DecisionTreeRegressor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"id": "5755bc04",
"metadata": {},
"source": [
"# Decision Tree Regression Using Concrete-ML\n",
"# Decision Tree Regression Using Concrete ML\n",
"\n",
"In this tutorial, we show how to create, train and evaluate a decision tree regression model using Concrete-ML library.\n",
"In this tutorial, we show how to create, train and evaluate a decision tree regression model using Concrete ML library.\n",
"\n"
]
},
Expand All @@ -18,16 +18,16 @@
"id": "2c256087-c16a-4249-9c90-3f4863938385",
"metadata": {},
"source": [
"### Introducing Concrete-ML\n",
"### Introducing Concrete ML\n",
"\n",
"> Concrete-ML is an open-source, privacy-preserving, machine learning inference framework based on fully homomorphic encryption (FHE).\n",
"> Concrete ML is an open-source, privacy-preserving, machine learning inference framework based on fully homomorphic encryption (FHE).\n",
"> It enables data scientists without any prior knowledge of cryptography to automatically turn machine learning models into their FHE equivalent,using familiar APIs from Scikit-learn and PyTorch.\n",
"> <cite>&mdash; [Zama documentation](../README.md)</cite>\n",
"\n",
"This tutorial does not require a deep understanding of the technology behind concrete-ML.\n",
"Nonetheless, newcomers might be interested in reading introductory sections of the official documentation such as:\n",
"\n",
"- [What is Concrete-ML](../README.md)\n",
"- [What is Concrete ML](../README.md)\n",
"- [Key Concepts](../getting-started/concepts.md)\n",
"\n",
"In the tutorial, we will be using the following terminology:\n",
Expand Down Expand Up @@ -233,10 +233,10 @@
"source": [
"## Training A Decision Tree\n",
"\n",
"ConcreteDecisionTreeRegressor is the Concrete-ML equivalent of scikit-learn's DecisionTreeRegressor.\n",
"ConcreteDecisionTreeRegressor is the Concrete ML equivalent of scikit-learn's DecisionTreeRegressor.\n",
"It supports the same parameters and a similar interface, with the extra capability of predicting directly on ciphertext without the need to decipher it, thus preservacy privacy.\n",
"\n",
"Currently, Concrete-ML models must be trained on plaintext. To see how it works, we train a DecisionTreeRegressor with default parameters and estimate its accuracy on test data. Note here that predictions are done on plaintext too, but soon, we will predict on ciphertext."
"Currently, Concrete ML models must be trained on plaintext. To see how it works, we train a DecisionTreeRegressor with default parameters and estimate its accuracy on test data. Note here that predictions are done on plaintext too, but soon, we will predict on ciphertext."
]
},
{
Expand Down Expand Up @@ -479,7 +479,7 @@
"source": [
"## Predicting on Ciphertext\n",
"If the predictions are similar although slightly less accurate, the real advantage of ConcreteML is privacy.\n",
"We now show how we can perform prediction on ciphertext with Concrete-ML, so that the model does not need to decipher the data at all to compute its estimate."
"We now show how we can perform prediction on ciphertext with Concrete ML, so that the model does not need to decipher the data at all to compute its estimate."
]
},
{
Expand Down Expand Up @@ -798,7 +798,7 @@
"Once the model is carefully trained and quantized, it is ready to be deployed and used in production. Here are some useful links on the subject:\n",
" \n",
" - [Inference in the Cloud](../getting-started/cloud.md) summarize the steps for cloud deployment\n",
" - [Production Deployment](../guides/client_server.md) offers a high-level view of how to deploy a Concrete-ML model in a client/server setting.\n",
" - [Production Deployment](../guides/client_server.md) offers a high-level view of how to deploy a Concrete ML model in a client/server setting.\n",
" - [Client Server in Concrete ML](./ClientServer.ipynb) provides a more hands-on approach as another tutorial."
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced_examples/LinearSVR.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"\n",
"\n",
"def get_concrete_plot_config(mse_score=None):\n",
" label = \"Concrete-ML\"\n",
" label = \"Concrete ML\"\n",
" if mse_score is not None:\n",
" label += f\", {'$MSE$'}={mse_score:.4f}\"\n",
" return {\"c\": \"orange\", \"linewidth\": 2.5, \"label\": label}"
Expand Down Expand Up @@ -646,7 +646,7 @@
"y_pred_sklearn = sklearn_rgs.predict(X_test)\n",
"print(f\"Execution time: {(time.time() - time_begin) / len(X_test):.4f} seconds per sample\")\n",
"\n",
"# Now predict using clear quantized Concrete-ML model on testing set\n",
"# Now predict using clear quantized Concrete ML model on testing set\n",
"time_begin = time.time()\n",
"y_preds_quantized = concrete_rgs.predict(X_test)\n",
"print(f\"Execution time: {(time.time() - time_begin) / len(X_test):.4f} seconds per sample\")"
Expand Down
Loading

0 comments on commit ef602d9

Please sign in to comment.