Comments (5)
@ai-learner-00 I was able to reproduce the same issue. Filed #11049 as a fix. This PR can be tested using the following command:
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/11080/merge
from mlflow.
@ai-learner-00 Thanks for reporting this. It looks like we forgot to update _PromptlabModel
. Does it work fine if you set MLFLOW_GATEWAY_URI
?
from mlflow.
@harupy I did try mlflow.gateway.set_gateway_uri("http://localhost:7000")
, but got an error when calling loaded_model.predict(pd.DataFrame(data))
:
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\utils\request_utils.py:63, in augmented_raise_for_status(response)
62 try:
---> 63 response.raise_for_status()
64 except HTTPError as e:
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\requests\models.py:1021, in Response.raise_for_status(self)
1020 if http_error_msg:
-> 1021 raise HTTPError(http_error_msg, response=self)
HTTPError: 400 Client Error: Bad Request for url: http://localhost:7000/gateway/completions/invocations
During handling of the above exception, another exception occurred:
HTTPError Traceback (most recent call last)
Cell In[14], line 17
14 print(data)
16 import pandas as pd
---> 17 loaded_model.predict(pd.DataFrame(data))
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\pyfunc\__init__.py:501, in PyFuncModel.predict(self, data, params)
498 if _MLFLOW_TESTING.get():
499 raise
--> 501 return _predict()
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\pyfunc\__init__.py:489, in PyFuncModel.predict.<locals>._predict()
487 return self._predict_fn(data, params=params)
488 _log_warning_if_params_not_in_predict_signature(_logger, params)
--> 489 return self._predict_fn(data)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\promptlab\__init__.py:37, in _PromptlabModel.predict(self, inputs)
34 model_parameters_as_dict = {param.key: param.value for param in self.model_parameters}
35 query_data = self._construct_query_data(prompt)
---> 37 response = query(
38 route=self.model_route, data={**query_data, **model_parameters_as_dict}
39 )
40 results.append(self._parse_gateway_response(response))
42 return results
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\utils.py:144, in gateway_deprecated.<locals>.wrapper(*args, **kwargs)
141 @functools.wraps(obj)
142 def wrapper(*args, **kwargs):
143 warnings.warn(msg, FutureWarning, stacklevel=2)
--> 144 return obj(*args, **kwargs)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\fluent.py:254, in query(route, data)
188 @gateway_deprecated
189 def query(route: str, data):
190 """
191 Issues a query request to a configured service through a named route on the Gateway Server.
192 This function will interface with a configured route name (examples below) and return the
(...)
252 )
253 """
--> 254 return MlflowGatewayClient().query(route, data)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\utils.py:144, in gateway_deprecated.<locals>.wrapper(*args, **kwargs)
141 @functools.wraps(obj)
142 def wrapper(*args, **kwargs):
143 warnings.warn(msg, FutureWarning, stacklevel=2)
--> 144 return obj(*args, **kwargs)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\client.py:361, in MlflowGatewayClient.query(self, route, data)
358 query_route = assemble_uri_path([MLFLOW_GATEWAY_ROUTE_BASE, route, MLFLOW_QUERY_SUFFIX])
360 try:
--> 361 return self._call_endpoint("POST", query_route, data).json()
362 except MlflowException as e:
363 if isinstance(e.__cause__, requests.exceptions.Timeout):
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\client.py:106, in MlflowGatewayClient._call_endpoint(self, method, route, json_body)
95 call_kwargs["json"] = json_body
97 response = http_request(
98 host_creds=self._host_creds,
99 endpoint=route,
(...)
104 **call_kwargs,
105 )
--> 106 augmented_raise_for_status(response)
107 return response
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\utils\request_utils.py:66, in augmented_raise_for_status(response)
64 except HTTPError as e:
65 if response.text:
---> 66 raise HTTPError(
67 f"{e}. Response text: {response.text}", request=e.request, response=e.response
68 )
69 else:
70 raise e
HTTPError: 400 Client Error: Bad Request for url: http://localhost:7000/gateway/completions/invocations. Response text: {"detail":"Unrecognized request argument supplied: route_type"}
The same error occurs when calling evaluate
.
with mlflow.start_run():
results = mlflow.evaluate(
model=logged_model,
data=data,
# targets="ground_truth",
model_type="text-summarization",
)
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\utils\request_utils.py:63, in augmented_raise_for_status(response)
62 try:
---> 63 response.raise_for_status()
64 except HTTPError as e:
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\requests\models.py:1021, in Response.raise_for_status(self)
1020 if http_error_msg:
-> 1021 raise HTTPError(http_error_msg, response=self)
HTTPError: 400 Client Error: Bad Request for url: http://localhost:7000/gateway/completions/invocations
During handling of the above exception, another exception occurred:
HTTPError Traceback (most recent call last)
Cell In[17], line 20
17 # loaded_model.predict(pd.DataFrame(data))
19 with mlflow.start_run():
---> 20 results = mlflow.evaluate(
21 model=logged_model,
22 data=data,
23 # targets="ground_truth",
24 model_type="text-summarization",
25 )
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\models\evaluation\base.py:1880, in evaluate(model, data, model_type, targets, predictions, dataset_path, feature_names, evaluators, evaluator_config, custom_metrics, extra_metrics, custom_artifacts, validation_thresholds, baseline_model, env_manager, model_config, baseline_config)
1877 predictions_expected_in_model_output = predictions if model is not None else None
1879 try:
-> 1880 evaluate_result = _evaluate(
1881 model=model,
1882 model_type=model_type,
1883 dataset=dataset,
1884 run_id=run_id,
1885 evaluator_name_list=evaluator_name_list,
1886 evaluator_name_to_conf_map=evaluator_name_to_conf_map,
1887 custom_metrics=custom_metrics,
1888 extra_metrics=extra_metrics,
1889 custom_artifacts=custom_artifacts,
1890 baseline_model=baseline_model,
1891 predictions=predictions_expected_in_model_output,
1892 )
1893 finally:
1894 if isinstance(model, _ServedPyFuncModel):
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\models\evaluation\base.py:1120, in _evaluate(model, model_type, dataset, run_id, evaluator_name_list, evaluator_name_to_conf_map, custom_metrics, extra_metrics, custom_artifacts, baseline_model, predictions)
1118 if evaluator.can_evaluate(model_type=model_type, evaluator_config=config):
1119 _logger.info(f"Evaluating the model with the {evaluator_name} evaluator.")
-> 1120 eval_result = evaluator.evaluate(
1121 model=model,
1122 model_type=model_type,
1123 dataset=dataset,
1124 run_id=run_id,
1125 evaluator_config=config,
1126 custom_metrics=custom_metrics,
1127 extra_metrics=extra_metrics,
1128 custom_artifacts=custom_artifacts,
1129 baseline_model=baseline_model,
1130 predictions=predictions,
1131 )
1132 eval_results.append(eval_result)
1134 _last_failed_evaluator = None
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\models\evaluation\default_evaluator.py:1883, in DefaultEvaluator.evaluate(self, model_type, dataset, run_id, evaluator_config, model, custom_metrics, extra_metrics, custom_artifacts, baseline_model, predictions, **kwargs)
1881 if baseline_model:
1882 _logger.info("Evaluating candidate model:")
-> 1883 evaluation_result = self._evaluate(model, is_baseline_model=False)
1885 if not baseline_model:
1886 return evaluation_result
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\models\evaluation\default_evaluator.py:1734, in DefaultEvaluator._evaluate(self, model, is_baseline_model, **kwargs)
1732 self.extra_metrics.remove(extra_metric)
1733 break
-> 1734 self._generate_model_predictions(compute_latency=compute_latency)
1735 if self.model_type in (_ModelType.CLASSIFIER, _ModelType.REGRESSOR):
1736 self._compute_builtin_metrics()
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\models\evaluation\default_evaluator.py:1369, in DefaultEvaluator._generate_model_predictions(self, compute_latency)
1367 model_predictions = predict_with_latency(X_copy)
1368 else:
-> 1369 model_predictions = self.model.predict(X_copy)
1370 else:
1371 if self.dataset.predictions_data is None:
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\pyfunc\__init__.py:501, in PyFuncModel.predict(self, data, params)
498 if _MLFLOW_TESTING.get():
499 raise
--> 501 return _predict()
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\pyfunc\__init__.py:489, in PyFuncModel.predict.<locals>._predict()
487 return self._predict_fn(data, params=params)
488 _log_warning_if_params_not_in_predict_signature(_logger, params)
--> 489 return self._predict_fn(data)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\promptlab\__init__.py:37, in _PromptlabModel.predict(self, inputs)
34 model_parameters_as_dict = {param.key: param.value for param in self.model_parameters}
35 query_data = self._construct_query_data(prompt)
---> 37 response = query(
38 route=self.model_route, data={**query_data, **model_parameters_as_dict}
39 )
40 results.append(self._parse_gateway_response(response))
42 return results
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\utils.py:144, in gateway_deprecated.<locals>.wrapper(*args, **kwargs)
141 @functools.wraps(obj)
142 def wrapper(*args, **kwargs):
143 warnings.warn(msg, FutureWarning, stacklevel=2)
--> 144 return obj(*args, **kwargs)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\fluent.py:254, in query(route, data)
188 @gateway_deprecated
189 def query(route: str, data):
190 """
191 Issues a query request to a configured service through a named route on the Gateway Server.
192 This function will interface with a configured route name (examples below) and return the
(...)
252 )
253 """
--> 254 return MlflowGatewayClient().query(route, data)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\utils.py:144, in gateway_deprecated.<locals>.wrapper(*args, **kwargs)
141 @functools.wraps(obj)
142 def wrapper(*args, **kwargs):
143 warnings.warn(msg, FutureWarning, stacklevel=2)
--> 144 return obj(*args, **kwargs)
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\client.py:361, in MlflowGatewayClient.query(self, route, data)
358 query_route = assemble_uri_path([MLFLOW_GATEWAY_ROUTE_BASE, route, MLFLOW_QUERY_SUFFIX])
360 try:
--> 361 return self._call_endpoint("POST", query_route, data).json()
362 except MlflowException as e:
363 if isinstance(e.__cause__, requests.exceptions.Timeout):
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\gateway\client.py:106, in MlflowGatewayClient._call_endpoint(self, method, route, json_body)
95 call_kwargs["json"] = json_body
97 response = http_request(
98 host_creds=self._host_creds,
99 endpoint=route,
(...)
104 **call_kwargs,
105 )
--> 106 augmented_raise_for_status(response)
107 return response
File c:\Users\_\miniconda3\envs\ml-3.10\lib\site-packages\mlflow\utils\request_utils.py:66, in augmented_raise_for_status(response)
64 except HTTPError as e:
65 if response.text:
---> 66 raise HTTPError(
67 f"{e}. Response text: {response.text}", request=e.request, response=e.response
68 )
69 else:
70 raise e
HTTPError: 400 Client Error: Bad Request for url: http://localhost:7000/gateway/completions/invocations. Response text: {"detail":"Unrecognized request argument supplied: route_type"}
from mlflow.
@mlflow/mlflow-team Please assign a maintainer and start triaging this issue.
from mlflow.
Ended up stuck here while following this example: https://mlflow.org/docs/latest/llms/prompt-engineering/index.html
from mlflow.
Related Issues (20)
- [BUG] Typo in MlflowException message HOT 1
- [BUG] "Charts" UI contains few points, making it not usable HOT 9
- [BUG] Recipes: last experiment runs exceed range of values of hyperparameter tuning HOT 2
- [BUG] mlflow version >=2.8.0 not compatible with certain versions of gunicorn HOT 3
- [BUG] Too many 429 error responses from Azure mlflow API with XGBoost autolog and n_estimators > ~700 HOT 15
- [FR] Render Tags and Aliases in the MLFlow Models UI HOT 5
- [BUG] Deployments Server import warning: "UserWarning: Valid config keys have changed in V2"
- [FR] Support arbitrary types for (hyper)parameters HOT 3
- [FR]The problem of derived features in reasoning process HOT 2
- [BUG] Model metrics plots truncate/miss steps HOT 4
- [FR] Allow docker args to be passed into `mlflow models build-docker` and `mlflow sagemaker build-and-push-container` HOT 5
- Can't able to version the run name but we can add version as tag which is not usefull for sorting in the UI. The Version column in the UI is empty. HOT 3
- [BUG] mlflow server ignoring environment variables HOT 1
- [FR] Decoupling MLFlow Permissions for Experiment and Run HOT 10
- [FR] Remove "Automatically grants MANAGE permission to the creator." for Registered Models. HOT 9
- [BUG]Fail to download artifact when load models HOT 1
- [FR] Add a "description" column in the main panel HOT 14
- [FR] Adding LLM evaluation metrics to existing (prompt engineering) run HOT 7
- mlflow.start_run() spike HOT 3
- [BUG] how to upgrade mlflow from v1 to v2 with cloudpickle version change HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlflow.