Repository: mlflow/mlflow

Issue:
[DOC-FIX] mlflow.pyfunc.get_model_dependencies() downloads all the artifacts
### Willingness to contribute

Yes. I can contribute a documentation fix independently.

### URL(s) with the issue

Hello,
Here is the current link of this method documentation : https://mlflow.org/docs/latest/python_api/mlflow.pyfunc.html
My issue is that the documentation of the method `mlflow.pyfunc.get_model_dependencies` doesn't specify that it downloads all the artifacts of a given model (not only the `requirements.txt` file), which causes me some troubles (`Connection broken` and `ChunkedEncodingError`) when a large model (about 500MiB) is stored in the artifacts. 

I don't know if it's you're first intention to return all the artifacts or if this method should only download and return the `requirement.txt` file. To this extent, I propose you to add a little description to indicate its behavior. Otherwise, we could imagine to add an input parameter to choose whether the user needs to download all the artifacts or only the requirements.

### Description of proposal (what needs changing)

mlflow.pyfunc.get_model_dependencies(model_uri, format='pip')[[source]](https://mlflow.org/docs/latest/_modules/mlflow/pyfunc.html#get_model_dependencies)

**Proposal ---------------**
Download all the artifacts from the model_uri, store them in a `temp/` folder and return the path of the requirements.txt file of that folder.
**-------------------------**

Parameters
model_uri – The uri of the model to get dependencies from.

format – The format of the returned dependency file. If the "pip" format is specified, the path to a pip requirements.txt file is returned. If the "conda" format is specified, the path to a "conda.yaml" file is returned . If the "pip" format is specified but the model was not saved with a requirements.txt file, the pip section of the model’s conda.yaml file is extracted instead, and any additional conda dependencies are ignored. Default value is "pip".

Returns
The local filesystem path to either a pip requirements.txt file (if format="pip") or a conda.yaml file (if format="conda") specifying the model’s dependencies.


Discussion:
@Val3nt-ML The reason we download all the artifacts is `requirements.txt` may contain references to other requirement files. The proposal makes sense!
We can also document how to dowload only `requirements.txt` if you think that's helpful.
I understand. Yes, I think that It would be helpful :)
Another idea would be to add an explicit parameter list that : 
- When equals to None, download by default only the artifacts that starts with a given prefix like “requirement(s)“
- Else: provide the list of the user requirements files that will be downloaded.
I would consider adding that parameter if there are more requests :)

Resolving patch:
diff --git a/mlflow/pyfunc/__init__.py b/mlflow/pyfunc/__init__.py
--- a/mlflow/pyfunc/__init__.py
+++ b/mlflow/pyfunc/__init__.py
@@ -842,6 +842,14 @@ def get_conda_yaml_path():
 
 def get_model_dependencies(model_uri, format="pip"):  # pylint: disable=redefined-builtin
     """
+    Downloads the model dependencies and returns the path to requirements.txt or conda.yaml file.
+
+    .. warning::
+        This API downloads all the model artifacts to the local filesystem. This may take
+        a long time for large models. To avoid this overhead, use
+        ``mlflow.artifacts.download_artifacts("<model_uri>/requirements.txt")`` or
+        ``mlflow.artifacts.download_artifacts("<model_uri>/conda.yaml")`` instead.
+
     :param model_uri: The uri of the model to get dependencies from.
     :param format: The format of the returned dependency file. If the ``"pip"`` format is
                    specified, the path to a pip ``requirements.txt`` file is returned.


Test patch: