diff --git a/docs/user-guide/examples/pyfunc_model.md b/docs/user-guide/examples/pyfunc_model.md index eb5a22155..4c99153cc 100644 --- a/docs/user-guide/examples/pyfunc_model.md +++ b/docs/user-guide/examples/pyfunc_model.md @@ -2,6 +2,19 @@ Try out the notebooks below to learn how to deploy PyFunc Models to Merlin. +**Note on compatibility**: The Pyfunc servers are compatible with `protobuf>=3.12.0,<5.0.0`. Users whose models have a strong dependency on Protobuf `3.x.x` are advised to pin the library version in their conda environment, when submitting the model version. If using Protobuf `3.x.x`, users can do one of the following: +* Use `protobuf>=3.20.0` - these versions support simplified class definitions and this is the recommended approach. +* If you must use `protobuf>=3.12.0,<3.20.0`, other packages used in the Pyfunc server need to be downgraded as well. Please pin the following in your model’s conda environment: +```yaml +dependencies: + - pip: + - protobuf==3.15.6 # Example older protobuf version + - caraml-upi-protos<=0.3.6 + - grpcio<1.49.0 + - grpcio-reflection<1.49.0 + - grpcio-health-checking<1.49.0 +``` + ## Deploy PyFunc Model {% embed url="https://github.com/caraml-dev/merlin/blob/main/examples/pyfunc/Pyfunc.ipynb" %} diff --git a/python/batch-predictor/docker/app.Dockerfile b/python/batch-predictor/docker/app.Dockerfile index 1f8582da4..4f75150be 100644 --- a/python/batch-predictor/docker/app.Dockerfile +++ b/python/batch-predictor/docker/app.Dockerfile @@ -24,6 +24,6 @@ ARG GOOGLE_APPLICATION_CREDENTIALS RUN if [[ ! -z "$GOOGLE_APPLICATION_CREDENTIALS" ]]; then gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}; fi RUN gsutil -m cp -r ${MODEL_URL} . RUN /bin/bash -c ". activate ${CONDA_ENVIRONMENT} && \ - sed -i 's/mlflow\(\s*==\s*[^ ]*\)\{0,1\}/mlflow==1.26.1/g' ${HOME}/model/conda.yaml && \ + sed -i 's/mlflow[><=]\{0,1\}.*$/mlflow==1.26.1/g' ${HOME}/model/conda.yaml && \ conda env update --name ${CONDA_ENVIRONMENT} --file ${HOME}/model/conda.yaml && \ python ${HOME}/merlin-spark-app/main.py --dry-run-model ${HOME}/model" diff --git a/python/pyfunc-server/docker/Dockerfile b/python/pyfunc-server/docker/Dockerfile index 807e8bed3..eb4d05c51 100644 --- a/python/pyfunc-server/docker/Dockerfile +++ b/python/pyfunc-server/docker/Dockerfile @@ -24,7 +24,7 @@ WORKDIR /pyfunc-server RUN if [ ! -z "$GOOGLE_APPLICATION_CREDENTIALS" ]; then gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}; fi RUN gsutil cp -r ${MODEL_URL} . RUN /bin/bash -c ". activate merlin-model && \ - sed -i 's/mlflow\(\s*==\s*[^ ]*\)\{0,1\}/mlflow==1.26.1/g' model/conda.yaml && \ + sed -i 's/mlflow[><=]\{0,1\}.*$/mlflow==1.26.1/g' model/conda.yaml && \ conda env update --name merlin-model --file model/conda.yaml && \ python -m pyfuncserver --model_dir model --dry_run" diff --git a/python/sdk/setup.py b/python/sdk/setup.py index 0e42c5bbf..ab938f5ea 100644 --- a/python/sdk/setup.py +++ b/python/sdk/setup.py @@ -30,7 +30,7 @@ "cookiecutter>=1.7.2", "docker>=4.2.1", "google-cloud-storage>=1.19.0", - "protobuf>=3.0.0,<5.0.0", + "protobuf>=3.12.0,<5.0.0", # Determined by the mlflow dependency "mlflow>=1.26.1,<2.0.0", "PyPrind>=2.11.2", "python_dateutil>=2.5.3",