Skip to content

Commit

Permalink
fix: Miscellaneous bug fixes for MLflow client upgrade (#487)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. Run unit tests and ensure that they are passing
2. If your change introduces any API changes, make sure to update the
e2e tests
3. Make sure documentation is updated for your PR!

-->

**What this PR does / why we need it**:
<!-- Explain here the context and why you're making the change. What is
the problem you're trying to solve. --->

This PR contains miscellaneous bug fixes, following
#465

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

1. Correcting the `protobuf` version range that the SDK can work with
2. Updating Pyfunc user docs to elaborate on the Protobuf compatibility
3. Correcting the `sed` command for fixing the `mlflow` dependency in
the conda env file (example test below)

![Screenshot 2023-11-09 at 7 07 23
AM](https://github.com/caraml-dev/merlin/assets/23465343/d5e9fb72-6cd5-450d-9f70-dec633de5716)

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required. Enter your extended release note in
the block below.
If the PR requires additional action from users switching to the new
release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note
Update protobuf dependency range and docs
```

**Checklist**

- [ ] Added unit test, integration, and/or e2e tests
- [x] Tested locally
- [x] Updated documentation
- [ ] Update Swagger spec if the PR introduce API changes
- [ ] Regenerated Golang and Python client if the PR introduce API
changes
  • Loading branch information
krithika369 authored Nov 9, 2023
1 parent 76a7ff7 commit 281a15d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions docs/user-guide/examples/pyfunc_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
Expand Down
2 changes: 1 addition & 1 deletion python/batch-predictor/docker/app.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion python/pyfunc-server/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion python/sdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 281a15d

Please sign in to comment.