From 3fbef88ca7bc275cf5262c313563b0a6826c8e1e Mon Sep 17 00:00:00 2001 From: jfrery Date: Mon, 15 Apr 2024 17:17:12 +0200 Subject: [PATCH] chore: update --- .github/workflows/run_use_cases_examples.yaml | 5 +++- script/make_utils/run_use_case_examples.sh | 24 ++++++++----------- use_case_examples/federated_learning/Makefile | 4 +++- use_case_examples/hybrid_model/Makefile | 13 ++++++++++ .../hybrid_model/requirements.txt | 1 + 5 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 use_case_examples/hybrid_model/Makefile diff --git a/.github/workflows/run_use_cases_examples.yaml b/.github/workflows/run_use_cases_examples.yaml index 7e0904943c..8b657ac15f 100644 --- a/.github/workflows/run_use_cases_examples.yaml +++ b/.github/workflows/run_use_cases_examples.yaml @@ -56,7 +56,10 @@ jobs: - name: Set up Environment run: | # Setup commands if any, for example, installing dependencies, etc. - apt-get update && apt-get install -y python3-venv make && apt install git git-lfs -y + apt-get update && apt-get install -y python3-venv make git git-lfs + # Initialize Git LFS and pull the files + git lfs install + git lfs pull - name: Run Use Case Examples Script run: | diff --git a/script/make_utils/run_use_case_examples.sh b/script/make_utils/run_use_case_examples.sh index 4bf17dfe68..159fe39d6f 100755 --- a/script/make_utils/run_use_case_examples.sh +++ b/script/make_utils/run_use_case_examples.sh @@ -31,24 +31,19 @@ setup_virtualenv() { echo "Virtual environment activated." } -install_concrete_ml() { - pip install -U pip setuptools wheel - if pip install -e .; then - echo "Concrete ML installation successful." - else - echo "Failed to install Concrete ML." - return 1 - fi -} - install_requirements() { - if [ -f "requirements.txt" ]; then + pip install -U pip setuptools wheel + local example_dir=$1 + if [ -f "${example_dir}/requirements.txt" ]; then + pushd "$example_dir" if pip install -r requirements.txt; then echo "Requirements installed successfully." else echo "Failed to install requirements." + popd return 1 fi + popd fi } @@ -63,13 +58,14 @@ run_example() { echo "*** Running example: $example_name ***" setup_virtualenv "$example_name" - install_concrete_ml || return - install_requirements || return + install_requirements "$example_dir" || return + set +e echo "Running use case example using Makefile..." make -C "$example_dir" run_example + set -e - local result="${PIPESTATUS[0]}" + local result=$? if [ "$result" -ne 0 ]; then echo "Failure in example $example_name." diff --git a/use_case_examples/federated_learning/Makefile b/use_case_examples/federated_learning/Makefile index 6a5f3bd9bf..2f8985dea3 100644 --- a/use_case_examples/federated_learning/Makefile +++ b/use_case_examples/federated_learning/Makefile @@ -8,7 +8,9 @@ PYTHON_RUN=python run_example: run_sh load_to_cml run_sh: + @echo "Running federated learning training script..." @./run.sh load_to_cml: - @$(PYTHON_RUN) load_to_cml.py \ No newline at end of file + @echo "Loading and compiling the model with Concrete ML..." + @$(PYTHON_RUN) load_to_cml.py diff --git a/use_case_examples/hybrid_model/Makefile b/use_case_examples/hybrid_model/Makefile new file mode 100644 index 0000000000..c2ae4efdc8 --- /dev/null +++ b/use_case_examples/hybrid_model/Makefile @@ -0,0 +1,13 @@ +# Useful for jupyter notebooks +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 + +EXAMPLE_NAME=hybrid_model + +run_example: compile_model serve_model + +compile_model: + @python compile_hybrid_llm.py + +serve_model: + @./serve.sh \ No newline at end of file diff --git a/use_case_examples/hybrid_model/requirements.txt b/use_case_examples/hybrid_model/requirements.txt index 0c2fb6c2d6..cf4c9ebcce 100644 --- a/use_case_examples/hybrid_model/requirements.txt +++ b/use_case_examples/hybrid_model/requirements.txt @@ -1,3 +1,4 @@ +concrete-ml datasets==2.14.4 apache_beam==2.49.0 mwparserfromhell==0.6.4