From 225f9107479e8311fc4803c7f15c1ff57de28b8c Mon Sep 17 00:00:00 2001 From: jfrery Date: Mon, 15 Apr 2024 16:18:11 +0200 Subject: [PATCH] chore: remove unecessary requirements --- script/make_utils/run_use_case_examples.sh | 22 +++++++------------ .../requirements.txt | 1 - .../cifar_brevitas_training/requirements.txt | 1 - .../credit_scoring/requirements.txt | 2 -- .../deployment/cifar_8_bit/requirements.txt | 1 + .../sentiment_analysis/requirements.txt | 2 -- .../disease_prediction/requirements.txt | 3 --- use_case_examples/federated_learning/Makefile | 4 +++- use_case_examples/hybrid_model/Makefile | 13 +++++++++++ .../hybrid_model/requirements.txt | 1 + .../requirements.txt | 2 -- use_case_examples/titanic/requirements.txt | 2 -- 12 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 use_case_examples/hybrid_model/Makefile diff --git a/script/make_utils/run_use_case_examples.sh b/script/make_utils/run_use_case_examples.sh index 4bf17dfe68..e21d2ca25d 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,12 @@ run_example() { echo "*** Running example: $example_name ***" setup_virtualenv "$example_name" - install_concrete_ml || return - install_requirements || return + install_requirements "$example_dir" || return echo "Running use case example using Makefile..." make -C "$example_dir" run_example - local result="${PIPESTATUS[0]}" + local result=$? if [ "$result" -ne 0 ]; then echo "Failure in example $example_name." diff --git a/use_case_examples/cifar/cifar_brevitas_finetuning/requirements.txt b/use_case_examples/cifar/cifar_brevitas_finetuning/requirements.txt index 9319c81c08..9574857ba2 100644 --- a/use_case_examples/cifar/cifar_brevitas_finetuning/requirements.txt +++ b/use_case_examples/cifar/cifar_brevitas_finetuning/requirements.txt @@ -1,3 +1,2 @@ concrete-ml -jupyter torchvision diff --git a/use_case_examples/cifar/cifar_brevitas_training/requirements.txt b/use_case_examples/cifar/cifar_brevitas_training/requirements.txt index 9319c81c08..9574857ba2 100644 --- a/use_case_examples/cifar/cifar_brevitas_training/requirements.txt +++ b/use_case_examples/cifar/cifar_brevitas_training/requirements.txt @@ -1,3 +1,2 @@ concrete-ml -jupyter torchvision diff --git a/use_case_examples/credit_scoring/requirements.txt b/use_case_examples/credit_scoring/requirements.txt index 56b78ae9f5..9e6d157332 100644 --- a/use_case_examples/credit_scoring/requirements.txt +++ b/use_case_examples/credit_scoring/requirements.txt @@ -1,3 +1 @@ concrete-ml -jupyter -pandas diff --git a/use_case_examples/deployment/cifar_8_bit/requirements.txt b/use_case_examples/deployment/cifar_8_bit/requirements.txt index d5fa2d7c94..734b8a77c3 100644 --- a/use_case_examples/deployment/cifar_8_bit/requirements.txt +++ b/use_case_examples/deployment/cifar_8_bit/requirements.txt @@ -1,2 +1,3 @@ torchvision==0.14.1 Pillow +concrete-ml \ No newline at end of file diff --git a/use_case_examples/deployment/sentiment_analysis/requirements.txt b/use_case_examples/deployment/sentiment_analysis/requirements.txt index 8af277bc18..c67d3212ac 100644 --- a/use_case_examples/deployment/sentiment_analysis/requirements.txt +++ b/use_case_examples/deployment/sentiment_analysis/requirements.txt @@ -1,4 +1,2 @@ concrete-ml -jupyter -pandas transformers diff --git a/use_case_examples/disease_prediction/requirements.txt b/use_case_examples/disease_prediction/requirements.txt index 1709ea8a17..9e6d157332 100644 --- a/use_case_examples/disease_prediction/requirements.txt +++ b/use_case_examples/disease_prediction/requirements.txt @@ -1,4 +1 @@ concrete-ml -jupyter -pandas -matplotlib 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 diff --git a/use_case_examples/sentiment_analysis_with_transformer/requirements.txt b/use_case_examples/sentiment_analysis_with_transformer/requirements.txt index 8af277bc18..c67d3212ac 100644 --- a/use_case_examples/sentiment_analysis_with_transformer/requirements.txt +++ b/use_case_examples/sentiment_analysis_with_transformer/requirements.txt @@ -1,4 +1,2 @@ concrete-ml -jupyter -pandas transformers diff --git a/use_case_examples/titanic/requirements.txt b/use_case_examples/titanic/requirements.txt index 56b78ae9f5..9e6d157332 100644 --- a/use_case_examples/titanic/requirements.txt +++ b/use_case_examples/titanic/requirements.txt @@ -1,3 +1 @@ concrete-ml -jupyter -pandas