{"id":5661,"date":"2024-08-16T13:59:19","date_gmt":"2024-08-16T05:59:19","guid":{"rendered":"https:\/\/www.xinyixx.com\/?p=5661"},"modified":"2024-08-16T21:26:07","modified_gmt":"2024-08-16T13:26:07","slug":"mlflow","status":"publish","type":"post","link":"https:\/\/www.xinyixx.com\/index.php\/2024\/08\/16\/mlflow\/","title":{"rendered":"\u4f7f\u7528MLflow\u8ddf\u8e2a\u5927\u578b\u8bed\u8a00\u6a21\u578b(LLM)\uff1a\u5b8c\u6574\u6307\u5357"},"content":{"rendered":"<p>\u968f\u7740\u5927\u578b\u8bed\u8a00\u6a21\u578b (LLM) \u7684\u590d\u6742\u6027\u548c\u89c4\u6a21\u4e0d\u65ad\u589e\u957f\uff0c\u8ddf\u8e2a\u5176\u6027\u80fd\u3001\u5b9e\u9a8c\u548c\u90e8\u7f72\u53d8\u5f97\u8d8a\u6765\u8d8a\u5177\u6709\u6311\u6218\u6027\u3002\u8fd9\u5c31\u662f MLflow \u7684\u4f5c\u7528\u6240\u5728 &#8211; \u63d0\u4f9b\u4e00\u4e2a\u5168\u9762\u7684\u5e73\u53f0\u6765\u7ba1\u7406\u673a\u5668\u5b66\u4e60\u6a21\u578b\uff08\u5305\u62ec LLM\uff09\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u3002<\/p>\n\n\n\n<p>\u5728\u672c\u6df1\u5165\u6307\u5357\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8\u5982\u4f55\u5229\u7528 MLflow \u6765\u8ddf\u8e2a\u3001\u8bc4\u4f30\u548c\u90e8\u7f72 LLM\u3002\u6211\u4eec\u5c06\u6db5\u76d6\u4ece\u8bbe\u7f6e\u73af\u5883\u5230\u9ad8\u7ea7\u8bc4\u4f30\u6280\u672f\u7684\u6240\u6709\u5185\u5bb9\uff0c\u5e76\u63d0\u4f9b\u5927\u91cf\u4ee3\u7801\u793a\u4f8b\u548c\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MLflow \u5728\u5927\u578b\u8bed\u8a00\u6a21\u578b (LLM) \u4e2d\u7684\u529f\u80fd<\/h3>\n\n\n\n<p><a href=\"https:\/\/mlflow.org\/\">\u6d41\u91cf<\/a>&nbsp;\u5df2\u6210\u4e3a\u673a\u5668\u5b66\u4e60\u548c\u6570\u636e\u79d1\u5b66\u754c\u7684\u5173\u952e\u5de5\u5177\uff0c\u5c24\u5176\u662f\u7528\u4e8e\u7ba1\u7406\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u751f\u547d\u5468\u671f\u3002\u5bf9\u4e8e\u5927\u578b\u8bed\u8a00\u6a21\u578b (LLM)\uff0cMLflow \u63d0\u4f9b\u4e86\u4e00\u5957\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u663e\u8457\u7b80\u5316\u5f00\u53d1\u3001\u8ddf\u8e2a\u3001\u8bc4\u4f30\u548c\u90e8\u7f72\u8fd9\u4e9b\u6a21\u578b\u7684\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u6982\u8ff0\u4e86 MLflow \u5728 LLM \u9886\u57df\u4e2d\u7684\u529f\u80fd\u4ee5\u53ca\u5b83\u4e3a\u5de5\u7a0b\u5e08\u548c\u6570\u636e\u79d1\u5b66\u5bb6\u5e26\u6765\u7684\u597d\u5904\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/www.unite.ai\/wp-content\/uploads\/2024\/07\/learn-core-components.png\"><noscript><img decoding=\"async\" src=\"https:\/\/www.unite.ai\/wp-content\/uploads\/2024\/07\/learn-core-components.png\" alt=\"\u4e86\u89e3 MLflow \u7684\u6838\u5fc3\u7ec4\u4ef6\" class=\"wp-image-203904\"><\/noscript><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"\u4e86\u89e3 MLflow \u7684\u6838\u5fc3\u7ec4\u4ef6\" class=\"wp-image-203904 lazyload\" data-src=\"https:\/\/www.unite.ai\/wp-content\/uploads\/2024\/07\/learn-core-components.png\"><\/a><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\">\u8ddf\u8e2a\u548c\u7ba1\u7406 LLM \u4ea4\u4e92<\/h4>\n\n\n\n<p>MLflow \u7684 LLM \u8ddf\u8e2a\u7cfb\u7edf\u662f\u5176\u73b0\u6709\u8ddf\u8e2a\u529f\u80fd\u7684\u589e\u5f3a\uff0c\u9488\u5bf9 LLM \u7684\u72ec\u7279\u9700\u6c42\u91cf\u8eab\u5b9a\u5236\u3002\u5b83\u5141\u8bb8\u5168\u9762\u8ddf\u8e2a\u6a21\u578b\u4ea4\u4e92\uff0c\u5305\u62ec\u4ee5\u4e0b\u5173\u952e\u65b9\u9762\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53c2\u6570<\/strong>\uff1a\u8bb0\u5f55\u8be6\u7ec6\u63cf\u8ff0 LLM \u8f93\u5165\u53c2\u6570\u7684\u952e\u503c\u5bf9\uff0c\u4f8b\u5982\u7279\u5b9a\u4e8e\u6a21\u578b\u7684\u53c2\u6570\uff0c\u5982&nbsp;<code>top_k<\/code>&nbsp;\u548c&nbsp;<code>temperature<\/code>\u3002\u8fd9\u4e3a\u6bcf\u6b21\u8fd0\u884c\u63d0\u4f9b\u4e86\u4e0a\u4e0b\u6587\u548c\u914d\u7f6e\uff0c\u786e\u4fdd\u6355\u83b7\u6a21\u578b\u914d\u7f6e\u7684\u6240\u6709\u65b9\u9762\u3002<\/li>\n\n\n\n<li><strong>\u6307\u6807<\/strong>\uff1a\u5b9a\u91cf\u6307\u6807\uff0c\u53ef\u6d1e\u5bdf LLM \u7684\u6027\u80fd\u548c\u51c6\u786e\u6027\u3002\u8fd9\u4e9b\u6307\u6807\u53ef\u968f\u7740\u8fd0\u884c\u7684\u8fdb\u884c\u800c\u52a8\u6001\u66f4\u65b0\uff0c\u63d0\u4f9b\u5b9e\u65f6\u6216\u540e\u5904\u7406\u6d1e\u5bdf\u3002<\/li>\n\n\n\n<li><strong>\u9884\u6d4b<\/strong>\uff1a\u6355\u83b7\u53d1\u9001\u5230 LLM \u7684\u8f93\u5165\u548c\u76f8\u5e94\u7684\u8f93\u51fa\uff0c\u5b83\u4eec\u4ee5\u7ed3\u6784\u5316\u683c\u5f0f\u5b58\u50a8\u4e3a\u5de5\u4ef6\uff0c\u4ee5\u4fbf\u4e8e\u68c0\u7d22\u548c\u5206\u6790\u3002<\/li>\n\n\n\n<li><strong>\u6587\u7269<\/strong>\uff1a\u9664\u4e86\u9884\u6d4b\u4e4b\u5916\uff0cMLflow \u8fd8\u53ef\u4ee5\u5b58\u50a8\u5404\u79cd\u8f93\u51fa\u6587\u4ef6\uff0c\u4f8b\u5982\u53ef\u89c6\u5316\u3001\u5e8f\u5217\u5316\u6a21\u578b\u548c\u7ed3\u6784\u5316\u6570\u636e\u6587\u4ef6\uff0c\u4ece\u800c\u53ef\u4ee5\u8be6\u7ec6\u8bb0\u5f55\u548c\u5206\u6790\u6a21\u578b\u7684\u6027\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u79cd\u7ed3\u6784\u5316\u65b9\u6cd5\u53ef\u786e\u4fdd\u4e0e LLM \u7684\u6240\u6709\u4ea4\u4e92\u90fd\u88ab\u4e00\u4e1d\u4e0d\u82df\u5730\u8bb0\u5f55\u4e0b\u6765\uff0c\u4e3a\u6587\u672c\u751f\u6210\u6a21\u578b\u63d0\u4f9b\u5168\u9762\u7684\u8c31\u7cfb\u548c\u8d28\u91cf\u8ddf\u8e2a\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">LLM\u8bc4\u4f30<\/h4>\n\n\n\n<p>\u7531\u4e8e LLM \u5177\u6709\u751f\u6210\u6027\u4e14\u7f3a\u4e4f\u5355\u4e00\u57fa\u672c\u4e8b\u5b9e\uff0c\u56e0\u6b64\u8bc4\u4f30 LLM \u9762\u4e34\u7740\u72ec\u7279\u7684\u6311\u6218\u3002MLflow \u4f7f\u7528\u4e13\u4e3a LLM \u8bbe\u8ba1\u7684\u8bc4\u4f30\u5de5\u5177\u7b80\u5316\u4e86\u8fd9\u4e00\u8fc7\u7a0b\u3002\u4e3b\u8981\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u591a\u529f\u80fd\u6a21\u578b\u8bc4\u4f30<\/strong>\uff1a\u652f\u6301\u8bc4\u4f30\u5404\u79cd\u7c7b\u578b\u7684 LLM\uff0c\u65e0\u8bba\u662f MLflow pyfunc \u6a21\u578b\u3001\u6307\u5411\u5df2\u6ce8\u518c MLflow \u6a21\u578b\u7684 URI\uff0c\u8fd8\u662f\u4ee3\u8868\u60a8\u7684\u6a21\u578b\u7684\u4efb\u4f55 Python \u53ef\u8c03\u7528\u51fd\u6570\u3002<\/li>\n\n\n\n<li><strong>\u7efc\u5408\u6307\u6807<\/strong>\uff1a\u63d0\u4f9b\u4e00\u7cfb\u5217\u9488\u5bf9 LLM \u8bc4\u4f30\u91cf\u8eab\u5b9a\u5236\u7684\u6307\u6807\uff0c\u5305\u62ec\u4f9d\u8d56\u4e8e SaaS \u6a21\u578b\u7684\u6307\u6807\uff08\u4f8b\u5982\uff0c\u7b54\u6848\u76f8\u5173\u6027\uff09\u548c\u57fa\u4e8e\u529f\u80fd\u7684\u6307\u6807\uff08\u4f8b\u5982\uff0cROUGE\u3001Flesch Kincaid\uff09\u3002<\/li>\n\n\n\n<li><strong>\u9884\u5b9a\u4e49\u6307\u6807\u96c6\u5408<\/strong>\uff1a\u6839\u636e\u7528\u4f8b\uff08\u4f8b\u5982\u95ee\u7b54\u6216\u6587\u672c\u6458\u8981\uff09\uff0cMLflow \u63d0\u4f9b\u9884\u5b9a\u4e49\u6307\u6807\u6765\u7b80\u5316\u8bc4\u4f30\u8fc7\u7a0b\u3002<\/li>\n\n\n\n<li><strong>\u81ea\u5b9a\u4e49\u6307\u6807\u521b\u5efa<\/strong>\uff1a\u5141\u8bb8\u7528\u6237\u5b9a\u4e49\u548c\u5b9e\u65bd\u81ea\u5b9a\u4e49\u6307\u6807\u4ee5\u6ee1\u8db3\u7279\u5b9a\u7684\u8bc4\u4f30\u9700\u6c42\uff0c\u589e\u5f3a\u6a21\u578b\u8bc4\u4f30\u7684\u7075\u6d3b\u6027\u548c\u6df1\u5ea6\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528\u9759\u6001\u6570\u636e\u96c6\u8fdb\u884c\u8bc4\u4f30<\/strong>\uff1a\u65e0\u9700\u6307\u5b9a\u6a21\u578b\u5373\u53ef\u8bc4\u4f30\u9759\u6001\u6570\u636e\u96c6\uff0c\u8fd9\u5bf9\u4e8e\u65e0\u9700\u91cd\u65b0\u8fd0\u884c\u6a21\u578b\u63a8\u7406\u5373\u53ef\u8fdb\u884c\u5feb\u901f\u8bc4\u4f30\u5f88\u6709\u7528\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u90e8\u7f72\u4e0e\u6574\u5408<\/h4>\n\n\n\n<p>MLflow\u8fd8\u652f\u6301LLM\u7684\u65e0\u7f1d\u90e8\u7f72\u548c\u96c6\u6210\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>MLflow \u90e8\u7f72\u670d\u52a1\u5668<\/strong>\uff1a\u5145\u5f53\u4e0e\u591a\u4e2a LLM \u63d0\u4f9b\u5546\u4ea4\u4e92\u7684\u7edf\u4e00\u63a5\u53e3\u3002\u5b83\u7b80\u5316\u4e86\u96c6\u6210\u3001\u5b89\u5168\u5730\u7ba1\u7406\u51ed\u636e\u5e76\u63d0\u4f9b\u4e00\u81f4\u7684 API \u4f53\u9a8c\u3002\u6b64\u670d\u52a1\u5668\u652f\u6301\u6765\u81ea\u6d41\u884c SaaS \u4f9b\u5e94\u5546\u7684\u4e00\u7cfb\u5217\u57fa\u7840\u6a21\u578b\u4ee5\u53ca\u81ea\u6258\u7ba1\u6a21\u578b\u3002<\/li>\n\n\n\n<li><strong>\u7edf\u4e00\u7aef\u70b9<\/strong>\uff1a\u65e0\u9700\u66f4\u6539\u4ee3\u7801\u5373\u53ef\u8f7b\u677e\u5728\u63d0\u4f9b\u5546\u4e4b\u95f4\u5207\u6362\uff0c\u4ece\u800c\u6700\u5927\u9650\u5ea6\u5730\u51cf\u5c11\u505c\u673a\u65f6\u95f4\u5e76\u589e\u5f3a\u7075\u6d3b\u6027\u3002<\/li>\n\n\n\n<li><strong>\u7efc\u5408\u7ed3\u679c\u89c6\u56fe<\/strong>\uff1a\u63d0\u4f9b\u5168\u9762\u7684\u8bc4\u4f30\u7ed3\u679c\uff0c\u53ef\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u8bbf\u95ee\u6216\u901a\u8fc7 MLflow UI \u8fdb\u884c\u8be6\u7ec6\u5206\u6790\u3002<\/li>\n<\/ul>\n\n\n\n<p>MLflow \u662f\u4e00\u5957\u5168\u9762\u7684\u5de5\u5177\u548c\u96c6\u6210\uff0c\u4f7f\u5176\u6210\u4e3a\u4f7f\u7528\u9ad8\u7ea7 NLP \u6a21\u578b\u7684\u5de5\u7a0b\u5e08\u548c\u6570\u636e\u79d1\u5b66\u5bb6\u7684\u5b9d\u8d35\u8d44\u4ea7\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8bbe\u7f6e\u73af\u5883<\/h2>\n\n\n\n<p>\u5728\u6df1\u5165\u7814\u7a76\u4f7f\u7528 MLflow \u8ddf\u8e2a LLM \u4e4b\u524d\uff0c\u8ba9\u6211\u4eec\u5148\u8bbe\u7f6e\u4e00\u4e0b\u5f00\u53d1\u73af\u5883\u3002\u6211\u4eec\u9700\u8981\u5b89\u88c5 MLflow \u548c\u5176\u4ed6\u51e0\u4e2a\u5173\u952e\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install mlflow&gt;=2.8.1\npip install openai\npip install chromadb==0.4.15\npip install langchain==0.0.348\npip install tiktoken\npip install 'mlflow&#91;genai]'\npip install databricks-sdk --upgrade<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u540e\uff0c\u6700\u597d\u91cd\u65b0\u542f\u52a8 Python \u73af\u5883\u4ee5\u786e\u4fdd\u6240\u6709\u5e93\u90fd\u5df2\u6b63\u786e\u52a0\u8f7d\u3002\u5728 Jupyter \u7b14\u8bb0\u672c\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import mlflow\nimport chromadb\nprint(f\"MLflow version: {mlflow.__version__}\")\nprint(f\"ChromaDB version: {chromadb.__version__}\")<\/code><\/pre>\n\n\n\n<p>\u8fd9\u5c06\u786e\u8ba4\u6211\u4eec\u5c06\u4f7f\u7528\u7684\u5173\u952e\u5e93\u7684\u7248\u672c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e86\u89e3 MLflow \u7684 LLM \u8ddf\u8e2a\u529f\u80fd<\/h2>\n\n\n\n<p>MLflow \u7684 LLM \u8ddf\u8e2a\u7cfb\u7edf\u4ee5\u73b0\u6709\u7684\u8ddf\u8e2a\u529f\u80fd\u4e3a\u57fa\u7840\uff0c\u6dfb\u52a0\u4e86\u4e13\u95e8\u9488\u5bf9 LLM \u72ec\u7279\u65b9\u9762\u8bbe\u8ba1\u7684\u529f\u80fd\u3002\u8ba9\u6211\u4eec\u5206\u89e3\u4e00\u4e0b\u5173\u952e\u7ec4\u4ef6\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8fd0\u884c\u548c\u5b9e\u9a8c<\/h3>\n\n\n\n<p>\u5728 MLflow \u4e2d\uff0c\u201c\u8fd0\u884c\u201d\u8868\u793a\u6a21\u578b\u4ee3\u7801\u7684\u4e00\u6b21\u6267\u884c\uff0c\u800c\u201c\u5b9e\u9a8c\u201d\u5219\u662f\u76f8\u5173\u8fd0\u884c\u7684\u96c6\u5408\u3002\u5bf9\u4e8e LLM\uff0c\u8fd0\u884c\u53ef\u80fd\u8868\u793a\u6a21\u578b\u5904\u7406\u7684\u5355\u4e2a\u67e5\u8be2\u6216\u4e00\u6279\u63d0\u793a\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5173\u952e\u8ffd\u8e2a\u7ec4\u4ef6<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u53c2\u6570<\/strong>\uff1a\u8fd9\u4e9b\u662f LLM \u7684\u8f93\u5165\u914d\u7f6e\uff0c\u4f8b\u5982\u6e29\u5ea6\u3001top_k \u6216 max_tokens\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u8bb0\u5f55\u8fd9\u4e9b\u914d\u7f6e&nbsp;<code>mlflow.log_param()<\/code>&nbsp;or&nbsp;<code>mlflow.log_params()<\/code>.<\/li>\n\n\n\n<li><strong>\u6307\u6807<\/strong>\uff1aLLM \u8868\u73b0\u7684\u91cf\u5316\u6307\u6807\uff0c\u4f8b\u5982\u51c6\u786e\u5ea6\u3001\u5ef6\u8fdf\u6216\u81ea\u5b9a\u4e49\u5206\u6570\u3002\u4f7f\u7528&nbsp;<code>mlflow.log_metric()<\/code>&nbsp;or&nbsp;<code>mlflow.log_metrics()<\/code>&nbsp;\u6765\u8ffd\u8e2a\u8fd9\u4e9b\u3002<\/li>\n\n\n\n<li><strong>\u9884\u6d4b<\/strong>\uff1a\u5bf9\u4e8e LLM\uff0c\u8bb0\u5f55\u8f93\u5165\u63d0\u793a\u548c\u6a21\u578b\u8f93\u51fa\u81f3\u5173\u91cd\u8981\u3002MLflow \u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u5c06\u5b83\u4eec\u5b58\u50a8\u4e3a CSV \u683c\u5f0f\u7684\u5de5\u4ef6\uff1a&nbsp;<code>mlflow.log_table()<\/code>.<\/li>\n\n\n\n<li><strong>\u6587\u7269<\/strong>\uff1a\u4e0e\u60a8\u7684 LLM \u8fd0\u884c\u76f8\u5173\u7684\u4efb\u4f55\u5176\u4ed6\u6587\u4ef6\u6216\u6570\u636e\uff0c\u4f8b\u5982\u6a21\u578b\u68c0\u67e5\u70b9\u3001\u53ef\u89c6\u5316\u6216\u6570\u636e\u96c6\u6837\u672c\u3002\u4f7f\u7528&nbsp;<code>mlflow.log_artifact()<\/code>&nbsp;\u6765\u5b58\u50a8\u8fd9\u4e9b\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u8bb0\u5f55 LLM \u8fd0\u884c\u7684\u57fa\u672c\u793a\u4f8b\uff1a<\/p>\n\n\n\n<p>\u6b64\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u5c06\u53c2\u6570\u3001\u6307\u6807\u548c\u8f93\u5165\/\u8f93\u51fa\u8bb0\u5f55\u4e3a\u8868\u683c\u5de5\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import mlflow\nimport openai\ndef query_llm(prompt, max_tokens=100):\n    response = openai.Completion.create(\n        engine=\"text-davinci-002\",\n        prompt=prompt,\n        max_tokens=max_tokens\n    )\n    return response.choices&#91;0].text.strip()\nwith mlflow.start_run():\n    prompt = \"Explain the concept of machine learning in simple terms.\"\n     \n    # Log parameters\n    mlflow.log_param(\"model\", \"text-davinci-002\")\n    mlflow.log_param(\"max_tokens\", 100)\n     \n    # Query the LLM and log the result\n    result = query_llm(prompt)\n    mlflow.log_metric(\"response_length\", len(result))\n     \n    # Log the prompt and response\n    mlflow.log_table(\"prompt_responses\", {\"prompt\": &#91;prompt], \"response\": &#91;result]})\n     \n    print(f\"Response: {result}\")<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528 MLflow \u90e8\u7f72 LLM<\/h2>\n\n\n\n<p>MLflow \u63d0\u4f9b\u4e86\u5f3a\u5927\u7684 LLM \u90e8\u7f72\u529f\u80fd\uff0c\u8ba9\u60a8\u80fd\u591f\u66f4\u8f7b\u677e\u5730\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4e3a\u6a21\u578b\u63d0\u4f9b\u670d\u52a1\u3002\u8ba9\u6211\u4eec\u63a2\u7d22\u5982\u4f55\u4f7f\u7528 MLflow \u7684\u90e8\u7f72\u529f\u80fd\u90e8\u7f72 LLM\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u521b\u5efa\u7aef\u70b9<\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 MLflow \u7684\u90e8\u7f72\u5ba2\u6237\u7aef\u4e3a\u6211\u4eec\u7684 LLM \u521b\u5efa\u4e00\u4e2a\u7aef\u70b9\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import mlflow\nfrom mlflow.deployments import get_deploy_client\n# Initialize the deployment client\nclient = get_deploy_client(\"databricks\")\n# Define the endpoint configuration\nendpoint_name = \"llm-endpoint\"\nendpoint_config = {\n    \"served_entities\": &#91;{\n        \"name\": \"gpt-model\",\n        \"external_model\": {\n            \"name\": \"gpt-3.5-turbo\",\n            \"provider\": \"openai\",\n            \"task\": \"llm\/v1\/completions\",\n            \"openai_config\": {\n                \"openai_api_type\": \"azure\",\n                \"openai_api_key\": \"{{secrets\/scope\/openai_api_key}}\",\n                \"openai_api_base\": \"{{secrets\/scope\/openai_api_base}}\",\n                \"openai_deployment_name\": \"gpt-35-turbo\",\n                \"openai_api_version\": \"2023-05-15\",\n            },\n        },\n    }],\n}\n# Create the endpoint\nclient.create_endpoint(name=endpoint_name, config=endpoint_config)<\/code><\/pre>\n\n\n\n<p>\u6b64\u4ee3\u7801\u4f7f\u7528 Azure OpenAI \u4e3a GPT-3.5-turbo \u6a21\u578b\u8bbe\u7f6e\u7aef\u70b9\u3002\u8bf7\u6ce8\u610f\u4f7f\u7528 Databricks \u673a\u5bc6\u8fdb\u884c\u5b89\u5168 API \u5bc6\u94a5\u7ba1\u7406\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6d4b\u8bd5\u7aef\u70b9<\/h3>\n\n\n\n<p>\u4e00\u65e6\u521b\u5efa\u4e86\u7aef\u70b9\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u6d4b\u8bd5\u5b83\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=\"relative flex flex-col rounded-lg\"&gt;\nresponse = client.predict(\nendpoint=endpoint_name,\ninputs={\"prompt\": \"Explain the concept of neural networks briefly.\",\"max_tokens\": 100,},)\nprint(response)<\/code><\/pre>\n\n\n\n<p>\u8fd9\u5c06\u5411\u6211\u4eec\u90e8\u7f72\u7684\u6a21\u578b\u53d1\u9001\u63d0\u793a\u5e76\u8fd4\u56de\u751f\u6210\u7684\u54cd\u5e94\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528 MLflow \u8bc4\u4f30 LLM<\/h2>\n\n\n\n<p>\u8bc4\u4f30\u5bf9\u4e8e\u4e86\u89e3 LLM \u7684\u6027\u80fd\u548c\u884c\u4e3a\u81f3\u5173\u91cd\u8981\u3002MLflow \u63d0\u4f9b\u4e86\u7528\u4e8e\u8bc4\u4f30 LLM \u7684\u5168\u9762\u5de5\u5177\uff0c\u5305\u62ec\u5185\u7f6e\u6307\u6807\u200b\u200b\u548c\u81ea\u5b9a\u4e49\u6307\u6807\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u51c6\u5907 LLM \u8bc4\u4f30<\/h3>\n\n\n\n<p>\u8bc4\u4f30LLM <code>mlflow.evaluate()<\/code>\uff0c\u6a21\u578b\u9700\u8981\u91c7\u7528\u4ee5\u4e0b\u5f62\u5f0f\u4e4b\u4e00\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>An&nbsp;<code>mlflow.pyfunc.PyFuncModel<\/code>&nbsp;\u5b9e\u4f8b\u6216\u6307\u5411\u5df2\u8bb0\u5f55\u7684 MLflow \u6a21\u578b\u7684 URI\u3002<\/li>\n\n\n\n<li>\u63a5\u53d7\u5b57\u7b26\u4e32\u8f93\u5165\u5e76\u8f93\u51fa\u5355\u4e2a\u5b57\u7b26\u4e32\u7684 Python \u51fd\u6570\u3002<\/li>\n\n\n\n<li>MLflow \u90e8\u7f72\u7aef\u70b9 URI\u3002<\/li>\n\n\n\n<li>\u5728&nbsp;<code>model=None<\/code>&nbsp;\u5e76\u5c06\u6a21\u578b\u8f93\u51fa\u7eb3\u5165\u8bc4\u4f30\u6570\u636e\u4e2d\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u4f7f\u7528\u8bb0\u5f55\u7684 MLflow \u6a21\u578b\u7684\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import mlflow\nimport openai\nwith mlflow.start_run():\n    system_prompt = \"Answer the following question concisely.\"\n    logged_model_info = mlflow.openai.log_model(\n        model=\"gpt-3.5-turbo\",\n        task=openai.chat.completions,\n        artifact_path=\"model\",\n        messages=&#91;\n            {\"role\": \"system\", \"content\": system_prompt},\n            {\"role\": \"user\", \"content\": \"{question}\"},\n        ],\n    )\n# Prepare evaluation data\neval_data = pd.DataFrame({\n    \"question\": &#91;\"What is machine learning?\", \"Explain neural networks.\"],\n    \"ground_truth\": &#91;\n        \"Machine learning is a subset of AI that enables systems to learn and improve from experience without explicit programming.\",\n        \"Neural networks are computing systems inspired by biological neural networks, consisting of interconnected nodes that process and transmit information.\"\n    ]\n})\n# Evaluate the model\nresults = mlflow.evaluate(\n    logged_model_info.model_uri,\n    eval_data,\n    targets=\"ground_truth\",\n    model_type=\"question-answering\",\n)\nprint(f\"Evaluation metrics: {results.metrics}\")<\/code><\/pre>\n\n\n\n<p>\u6b64\u793a\u4f8b\u8bb0\u5f55\u4e00\u4e2a OpenAI \u6a21\u578b\uff0c\u51c6\u5907\u8bc4\u4f30\u6570\u636e\uff0c\u7136\u540e\u4f7f\u7528 MLflow \u7684\u5185\u7f6e\u95ee\u7b54\u4efb\u52a1\u6307\u6807\u5bf9\u8be5\u6a21\u578b\u8fdb\u884c\u8bc4\u4f30\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u81ea\u5b9a\u4e49\u8bc4\u4f30\u6307\u6807<\/h3>\n\n\n\n<p>MLflow \u5141\u8bb8\u60a8\u5b9a\u4e49 LLM \u8bc4\u4f30\u7684\u81ea\u5b9a\u4e49\u6307\u6807\u3002\u4ee5\u4e0b\u662f\u521b\u5efa\u7528\u4e8e\u8bc4\u4f30\u54cd\u5e94\u4e13\u4e1a\u6027\u7684\u81ea\u5b9a\u4e49\u6307\u6807\u7684\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from mlflow.metrics.genai import EvaluationExample, make_genai_metric\nprofessionalism = make_genai_metric(\n    name=\"professionalism\",\n    definition=\"Measure of formal and appropriate communication style.\",\n    grading_prompt=(\n        \"Score the professionalism of the answer on a scale of 0-4:\\n\"\n        \"0: Extremely casual or inappropriate\\n\"\n        \"1: Casual but respectful\\n\"\n        \"2: Moderately formal\\n\"\n        \"3: Professional and appropriate\\n\"\n        \"4: Highly formal and expertly crafted\"\n    ),\n    examples=&#91;\n        EvaluationExample(\n            input=\"What is MLflow?\",\n            output=\"MLflow is like your friendly neighborhood toolkit for managing ML projects. It's super cool!\",\n            score=1,\n            justification=\"The response is casual and uses informal language.\"\n        ),\n        EvaluationExample(\n            input=\"What is MLflow?\",\n            output=\"MLflow is an open-source platform for the machine learning lifecycle, including experimentation, reproducibility, and deployment.\",\n            score=4,\n            justification=\"The response is formal, concise, and professionally worded.\"\n        )\n    ],\n    model=\"openai:\/gpt-3.5-turbo-16k\",\n    parameters={\"temperature\": 0.0},\n    aggregations=&#91;\"mean\", \"variance\"],\n    greater_is_better=True,\n)\n# Use the custom metric in evaluation\nresults = mlflow.evaluate(\n    logged_model_info.model_uri,\n    eval_data,\n    targets=\"ground_truth\",\n    model_type=\"question-answering\",\n    extra_metrics=&#91;professionalism]\n)\nprint(f\"Professionalism score: {results.metrics&#91;'professionalism_mean']}\")\n<\/code><\/pre>\n\n\n\n<p>\u8be5\u81ea\u5b9a\u4e49\u6307\u6807\u4f7f\u7528 GPT-3.5-turbo \u6765\u8bc4\u5206\u54cd\u5e94\u7684\u4e13\u4e1a\u6027\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u5229\u7528 LLM \u672c\u8eab\u8fdb\u884c\u8bc4\u4f30\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9ad8\u7ea7 LLM \u8bc4\u4f30\u6280\u672f<\/h2>\n\n\n\n<p>\u968f\u7740 LLM \u53d8\u5f97\u8d8a\u6765\u8d8a\u590d\u6742\uff0c\u8bc4\u4f30\u5b83\u4eec\u7684\u6280\u672f\u4e5f\u53d8\u5f97\u8d8a\u6765\u8d8a\u590d\u6742\u3002\u8ba9\u6211\u4eec\u4f7f\u7528 MLflow \u63a2\u7d22\u4e00\u4e9b\u9ad8\u7ea7\u8bc4\u4f30\u65b9\u6cd5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u68c0\u7d22\u589e\u5f3a\u751f\u6210 (RAG) \u8bc4\u4f30<\/h3>\n\n\n\n<p>RAG \u7cfb\u7edf\u7ed3\u5408\u4e86\u57fa\u4e8e\u68c0\u7d22\u7684\u6a21\u578b\u548c\u751f\u6210\u6a21\u578b\u7684\u5f3a\u5927\u529f\u80fd\u3002\u8bc4\u4f30 RAG \u7cfb\u7edf\u9700\u8981\u8bc4\u4f30\u68c0\u7d22\u548c\u751f\u6210\u7ec4\u4ef6\u3002\u4ee5\u4e0b\u662f\u8bbe\u7f6e RAG \u7cfb\u7edf\u5e76\u4f7f\u7528 MLflow \u5bf9\u5176\u8fdb\u884c\u8bc4\u4f30\u7684\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from langchain.document_loaders import WebBaseLoader\nfrom langchain.text_splitter import CharacterTextSplitter\nfrom langchain.embeddings import OpenAIEmbeddings\nfrom langchain.vectorstores import Chroma\nfrom langchain.chains import RetrievalQA\nfrom langchain.llms import OpenAI\n# Load and preprocess documents\nloader = WebBaseLoader(&#91;\"https:\/\/mlflow.org\/docs\/latest\/index.html\"])\ndocuments = loader.load()\ntext_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\ntexts = text_splitter.split_documents(documents)\n# Create vector store\nembeddings = OpenAIEmbeddings()\nvectorstore = Chroma.from_documents(texts, embeddings)\n# Create RAG chain\nllm = OpenAI(temperature=0)\nqa_chain = RetrievalQA.from_chain_type(\n    llm=llm,\n    chain_type=\"stuff\",\n    retriever=vectorstore.as_retriever(),\n    return_source_documents=True\n)\n# Evaluation function\ndef evaluate_rag(question):\n    result = qa_chain({\"query\": question})\n    return result&#91;\"result\"], &#91;doc.page_content for doc in result&#91;\"source_documents\"]]\n# Prepare evaluation data\neval_questions = &#91;\n    \"What is MLflow?\",\n    \"How does MLflow handle experiment tracking?\",\n    \"What are the main components of MLflow?\"\n]\n# Evaluate using MLflow\nwith mlflow.start_run():\n    for question in eval_questions:\n        answer, sources = evaluate_rag(question)\n         \n        mlflow.log_param(f\"question\", question)\n        mlflow.log_metric(\"num_sources\", len(sources))\n        mlflow.log_text(answer, f\"answer_{question}.txt\")\n         \n        for i, source in enumerate(sources):\n            mlflow.log_text(source, f\"source_{question}_{i}.txt\")\n    # Log custom metrics\n    mlflow.log_metric(\"avg_sources_per_question\", sum(len(evaluate_rag(q)&#91;1]) for q in eval_questions) \/ len(eval_questions))\n<\/code><\/pre>\n\n\n\n<p>\u6b64\u793a\u4f8b\u4f7f\u7528 LangChain \u548c Chroma \u8bbe\u7f6e RAG \u7cfb\u7edf\uff0c\u7136\u540e\u901a\u8fc7\u5c06\u95ee\u9898\u3001\u7b54\u6848\u3001\u68c0\u7d22\u5230\u7684\u6e90\u548c\u81ea\u5b9a\u4e49\u6307\u6807\u8bb0\u5f55\u5230 MLflow \u5bf9\u5176\u8fdb\u884c\u8bc4\u4f30\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5206\u5757\u7b56\u7565\u8bc4\u4f30<\/h3>\n\n\n\n<p>\u5bf9\u6587\u6863\u8fdb\u884c\u5206\u5757\u7684\u65b9\u5f0f\u4f1a\u663e\u8457\u5f71\u54cd RAG \u6027\u80fd\u3002MLflow \u53ef\u4ee5\u5e2e\u52a9\u60a8\u8bc4\u4f30\u4e0d\u540c\u7684\u5206\u5757\u7b56\u7565\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import mlflow\nfrom langchain.text_splitter import CharacterTextSplitter, TokenTextSplitter\ndef evaluate_chunking_strategy(documents, chunk_size, chunk_overlap, splitter_class):\n    splitter = splitter_class(chunk_size=chunk_size, chunk_overlap=chunk_overlap)\n    chunks = splitter.split_documents(documents)\n     \n    with mlflow.start_run():\n        mlflow.log_param(\"chunk_size\", chunk_size)\n        mlflow.log_param(\"chunk_overlap\", chunk_overlap)\n        mlflow.log_param(\"splitter_class\", splitter_class.__name__)\n         \n        mlflow.log_metric(\"num_chunks\", len(chunks))\n        mlflow.log_metric(\"avg_chunk_length\", sum(len(chunk.page_content) for chunk in chunks) \/ len(chunks))\n         \n        # Evaluate retrieval performance (simplified)\n        correct_retrievals = sum(1 for _ in range(100) if simulate_retrieval(chunks))\n        mlflow.log_metric(\"retrieval_accuracy\", correct_retrievals \/ 100)\n# Evaluate different strategies\nfor chunk_size in &#91;500, 1000, 1500]:\n    for chunk_overlap in &#91;0, 50, 100]:\n        for splitter_class in &#91;CharacterTextSplitter, TokenTextSplitter]:\n            evaluate_chunking_strategy(documents, chunk_size, chunk_overlap, splitter_class)\n# Compare results\nbest_run = mlflow.search_runs(order_by=&#91;\"metrics.retrieval_accuracy DESC\"]).iloc&#91;0]\nprint(f\"Best chunking strategy: {best_run&#91;'params.splitter_class']} with size {best_run&#91;'params.chunk_size']} and overlap {best_run&#91;'params.chunk_overlap']}\")\n<\/code><\/pre>\n\n\n\n<p>\u8be5\u811a\u672c\u8bc4\u4f30\u5757\u5927\u5c0f\u3001\u91cd\u53e0\u548c\u5206\u5272\u65b9\u6cd5\u7684\u4e0d\u540c\u7ec4\u5408\uff0c\u5e76\u5c06\u7ed3\u679c\u8bb0\u5f55\u5230 MLflow \u4ee5\u4fbf\u4e8e\u6bd4\u8f83\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53ef\u89c6\u5316 LLM \u8bc4\u4f30\u7ed3\u679c<\/h2>\n\n\n\n<p>MLflow \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u53ef\u89c6\u5316\u4f60\u7684 LLM \u8bc4\u4f30\u7ed3\u679c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6280\u5de7\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u7528 MLflow UI<\/h3>\n\n\n\n<p>\u8fd0\u884c\u8bc4\u4f30\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 MLflow UI \u6765\u53ef\u89c6\u5316\u7ed3\u679c\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u542f\u52a8 MLflow UI\uff1a&nbsp;<code>mlflow ui<\/code><\/li>\n\n\n\n<li>\u6253\u5f00\u7f51\u7edc\u6d4f\u89c8\u5668\u5e76\u5bfc\u822a\u5230&nbsp;<code>http:\/\/localhost:5000<\/code><\/li>\n\n\n\n<li>\u9009\u62e9\u60a8\u7684\u5b9e\u9a8c\u5e76\u8fd0\u884c\u4ee5\u67e5\u770b\u6307\u6807\u3001\u53c2\u6570\u548c\u5de5\u4ef6<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u81ea\u5b9a\u4e49\u53ef\u89c6\u5316<\/h3>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528 Matplotlib \u6216 Plotly \u7b49\u5e93\u521b\u5efa\u8bc4\u4f30\u7ed3\u679c\u7684\u81ea\u5b9a\u4e49\u53ef\u89c6\u5316\uff0c\u7136\u540e\u5c06\u5176\u8bb0\u5f55\u4e3a\u5de5\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nimport matplotlib.pyplot as plt\nimport mlflow\ndef plot_metric_comparison(metric_name, run_ids):\n    plt.figure(figsize=(10, 6))\n    for run_id in run_ids:\n        run = mlflow.get_run(run_id)\n        metric_values = mlflow.get_metric_history(run_id, metric_name)\n        plt.plot(&#91;m.step for m in metric_values], &#91;m.value for m in metric_values], label=run.data.tags.get(\"mlflow.runName\", run_id))\n     \n    plt.title(f\"Comparison of {metric_name}\")\n    plt.xlabel(\"Step\")\n    plt.ylabel(metric_name)\n    plt.legend()\n     \n    # Save and log the plot\n    plt.savefig(f\"{metric_name}_comparison.png\")\n    mlflow.log_artifact(f\"{metric_name}_comparison.png\")\n# Usage\nwith mlflow.start_run():\n    plot_metric_comparison(\"answer_relevance\", &#91;\"run_id_1\", \"run_id_2\", \"run_id_3\"])\n<\/code><\/pre>\n\n\n\n<p>\u6b64\u51fd\u6570\u4f1a\u521b\u5efa\u4e00\u4e2a\u7ebf\u56fe\uff0c\u6bd4\u8f83\u591a\u6b21\u8fd0\u884c\u4e2d\u7684\u7279\u5b9a\u6307\u6807\uff0c\u5e76\u5c06\u5176\u8bb0\u5f55\u4e3a\u5de5\u4ef6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5f00\u6e90 MLflow \u7684\u66ff\u4ee3\u54c1<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.unite.ai\/wp-content\/uploads\/2024\/07\/platforms-os-pr.png\"><\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><noscript><img decoding=\"async\" width=\"1024\" height=\"259\" src=\"http:\/\/101.42.96.217:21080\/wp-content\/uploads\/2024\/08\/image-25-1024x259.png\" alt class=\"wp-image-5662\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-1024x259.png 1024w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-300x76.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-768x195.png 768w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/noscript><img decoding=\"async\" width=\"1024\" height=\"259\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201024%20259%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-5662 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201024%20259%22%3E%3C%2Fsvg%3E 1024w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-1024x259.png 1024w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-300x76.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25-768x195.png 768w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2024\/08\/image-25.png 1200w\" data-src=\"http:\/\/101.42.96.217:21080\/wp-content\/uploads\/2024\/08\/image-25-1024x259.png\"><\/figure>\n\n\n\n<p>\u5f00\u6e90\u6709\u5f88\u591a\u66ff\u4ee3\u65b9\u6848&nbsp;<a href=\"https:\/\/www.mlflow.org\/\">\u6d41\u91cf<\/a>&nbsp;\u7528\u4e8e\u7ba1\u7406\u673a\u5668\u5b66\u4e60\u5de5\u4f5c\u6d41\u7a0b\uff0c\u6bcf\u4e2a\u6d41\u7a0b\u90fd\u63d0\u4f9b\u72ec\u7279\u7684\u529f\u80fd\u548c\u96c6\u6210\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Databricks \u7ba1\u7406\u7684 MLflow<\/h4>\n\n\n\n<p>\u6258\u7ba1 MLflow\uff0c\u7531&nbsp;<a href=\"https:\/\/databricks.com\/\">Databricks<\/a>\uff0c\u63d0\u4f9b\u5f00\u6e90 MLflow \u7684\u6838\u5fc3\u529f\u80fd\uff0c\u4f46\u8fd8\u5177\u6709\u5176\u4ed6\u4f18\u52bf\uff0c\u4f8b\u5982\u4e0e Databricks \u751f\u6001\u7cfb\u7edf\u65e0\u7f1d\u96c6\u6210\u3001\u9ad8\u7ea7\u5b89\u5168\u529f\u80fd\u548c\u6258\u7ba1\u57fa\u7840\u67b6\u6784\u3002\u8fd9\u4f7f\u5176\u6210\u4e3a\u9700\u8981\u5f3a\u5927\u5b89\u5168\u6027\u548c\u53ef\u6269\u5c55\u6027\u7684\u7ec4\u7ec7\u7684\u7edd\u4f73\u9009\u62e9\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Azure\u673a\u5668\u5b66\u4e60<\/h4>\n\n\n\n<p><a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/machine-learning\/\">Azure\u673a\u5668\u5b66\u4e60<\/a>&nbsp;\u5728\u5fae\u8f6f Azure \u4e91\u5e73\u53f0\u4e0a\u63d0\u4f9b\u7aef\u5230\u7aef\u673a\u5668\u5b66\u4e60\u89e3\u51b3\u65b9\u6848\u3002\u5b83\u63d0\u4f9b\u4e0e MLflow \u7ec4\u4ef6\uff08\u5982\u6a21\u578b\u6ce8\u518c\u8868\u548c\u5b9e\u9a8c\u8ddf\u8e2a\u5668\uff09\u7684\u517c\u5bb9\u6027\uff0c\u5c3d\u7ba1\u5b83\u4e0d\u662f\u57fa\u4e8e MLflow\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u4e13\u7528\u673a\u5668\u5b66\u4e60\u5e73\u53f0<\/h4>\n\n\n\n<p>\u6709\u591a\u5bb6\u516c\u53f8\u63d0\u4f9b\u5177\u6709\u591a\u79cd\u529f\u80fd\u7684\u6258\u7ba1 ML \u4ea7\u54c1\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/neptune.ai\/\">NEPTUNE<\/a><\/strong>\uff1a\u4e13\u6ce8\u4e8e\u5b9e\u9a8c\u8ddf\u8e2a\u548c\u6a21\u578b\u7ba1\u7406\u3002<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/wandb.ai\/\">WANDB<\/a><\/strong>\uff1a\u63d0\u4f9b\u5e7f\u6cdb\u7684\u5b9e\u9a8c\u8ddf\u8e2a\u3001\u6570\u636e\u96c6\u7248\u672c\u63a7\u5236\u548c\u534f\u4f5c\u5de5\u5177\u3002<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/www.comet.ml\/\">COMET<\/a><\/strong>\uff1a\u63d0\u4f9b\u5b9e\u9a8c\u8ddf\u8e2a\u3001\u6a21\u578b\u751f\u4ea7\u76d1\u63a7\u548c\u6570\u636e\u8bb0\u5f55\u3002<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/valohai.com\/\">VALOHAI<\/a><\/strong>\uff1a\u4e13\u95e8\u4ece\u4e8b\u673a\u5668\u5b66\u4e60\u7ba1\u9053\u548c\u7f16\u6392\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">METAFLOW<\/h4>\n\n\n\n<p><a href=\"https:\/\/metaflow.org\/\">METAFLOW<\/a> \u7531 Netflix \u5f00\u53d1\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u65e8\u5728\u534f\u8c03\u6570\u636e\u5de5\u4f5c\u6d41\u548c ML \u7ba1\u9053\u3002\u867d\u7136\u5b83\u5728\u7ba1\u7406\u5927\u89c4\u6a21\u90e8\u7f72\u65b9\u9762\u8868\u73b0\u51fa\u8272\uff0c\u4f46\u4e0e MLflow \u76f8\u6bd4\uff0c\u5b83\u7f3a\u4e4f\u5168\u9762\u200b\u200b\u7684\u5b9e\u9a8c\u8ddf\u8e2a\u548c\u6a21\u578b\u7ba1\u7406\u529f\u80fd\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Amazon SageMaker \u548c Google \u7684 Vertex AI<\/h4>\n\n\n\n<p>\u4ee5\u4e0a\u7686\u662f&nbsp;<a href=\"https:\/\/aws.amazon.com\/sagemaker\/\">\u4e9a\u9a6c\u900aSageMaker<\/a>&nbsp;\u548c&nbsp;<a>\u8c37\u6b4c\u7684 Vertex AI<\/a>&nbsp;\u63d0\u4f9b\u96c6\u6210\u5230\u5404\u81ea\u4e91\u5e73\u53f0\u7684\u7aef\u5230\u7aef MLOps \u89e3\u51b3\u65b9\u6848\u3002\u8fd9\u4e9b\u670d\u52a1\u63d0\u4f9b\u4e86\u7528\u4e8e\u5927\u89c4\u6a21\u6784\u5efa\u3001\u8bad\u7ec3\u548c\u90e8\u7f72\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u5f3a\u5927\u5de5\u5177\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8be6\u7ec6\u6bd4\u8f83<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u6258\u7ba1 MLflow \u4e0e\u5f00\u6e90 MLflow<\/h4>\n\n\n\n<p>Databricks \u7684\u6258\u7ba1 MLflow \u4e0e\u5f00\u6e90\u7248\u672c\u76f8\u6bd4\u5177\u6709\u51e0\u4e2a\u4f18\u52bf\uff0c\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8bbe\u7f6e\u548c\u90e8\u7f72<\/strong>\uff1a\u4e0e Databricks \u7684\u65e0\u7f1d\u96c6\u6210\u51cf\u5c11\u4e86\u8bbe\u7f6e\u65f6\u95f4\u548c\u7cbe\u529b\u3002<\/li>\n\n\n\n<li><strong>\u53ef\u6269\u5c55\u6027<\/strong>\uff1a\u80fd\u591f\u8f7b\u677e\u5904\u7406\u5927\u89c4\u6a21\u673a\u5668\u5b66\u4e60\u5de5\u4f5c\u8d1f\u8f7d\u3002<\/li>\n\n\n\n<li><strong>\u5b89\u5168\u548c\u7ba1\u7406<\/strong>\uff1a\u5f00\u7bb1\u5373\u7528\u7684\u5b89\u5168\u529f\u80fd\uff0c\u5982\u57fa\u4e8e\u89d2\u8272\u7684\u8bbf\u95ee\u63a7\u5236 (RBAC) \u548c\u6570\u636e\u52a0\u5bc6\u3002<\/li>\n\n\n\n<li><strong>\u4e4b\u8def<\/strong>\uff1a\u4e0e Databricks \u7684\u670d\u52a1\u6df1\u5ea6\u96c6\u6210\uff0c\u589e\u5f3a\u4e92\u64cd\u4f5c\u6027\u548c\u529f\u80fd\u6027\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u5b58\u50a8\u4e0e\u5907\u4efd<\/strong>\uff1a\u81ea\u52a8\u5316\u5907\u4efd\u7b56\u7565\uff0c\u4fdd\u969c\u6570\u636e\u5b89\u5168\u53ef\u9760\u3002<\/li>\n\n\n\n<li><strong>\u6d3b\u52a8\u95e8\u7968\u4ef7\u683c\u8868<\/strong>\uff1a\u7528\u6237\u652f\u4ed8\u5e73\u53f0\u3001\u5b58\u50a8\u548c\u8ba1\u7b97\u8d44\u6e90\u7684\u8d39\u7528\u3002<\/li>\n\n\n\n<li><strong>\u652f\u6301\u548c\u7ef4\u62a4<\/strong>\uff1aDatabricks \u63d0\u4f9b\u4e13\u95e8\u7684\u652f\u6301\u548c\u7ef4\u62a4\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u7ed3\u8bba<\/h2>\n\n\n\n<p>\u4f7f\u7528 MLflow \u8ddf\u8e2a\u5927\u578b\u8bed\u8a00\u6a21\u578b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u6846\u67b6\u6765\u7ba1\u7406 LLM \u5f00\u53d1\u3001\u8bc4\u4f30\u548c\u90e8\u7f72\u7684\u590d\u6742\u6027\u3002\u901a\u8fc7\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\u5e76\u5229\u7528\u672c\u6307\u5357\u4e2d\u6982\u8ff0\u7684\u9ad8\u7ea7\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u66f4\u6709\u6761\u7406\u3001\u53ef\u91cd\u590d\u4e14\u66f4\u6709\u89c1\u5730\u7684 LLM \u5b9e\u9a8c\u3002<\/p>\n\n\n\n<p>\u8bf7\u8bb0\u4f4f\uff0cLLM \u9886\u57df\u6b63\u5728\u5feb\u901f\u53d1\u5c55\uff0c\u65b0\u7684\u8bc4\u4f30\u548c\u8ddf\u8e2a\u6280\u672f\u4e5f\u5728\u4e0d\u65ad\u6d8c\u73b0\u3002\u8bf7\u968f\u65f6\u5173\u6ce8\u6700\u65b0\u7684 MLflow \u7248\u672c\u548c LLM \u7814\u7a76\uff0c\u4ee5\u4e0d\u65ad\u5b8c\u5584\u60a8\u7684\u8ddf\u8e2a\u548c\u8bc4\u4f30\u6d41\u7a0b\u3002<\/p>\n\n\n\n<p>\u5f53\u5728\u9879\u76ee\u4e2d\u5e94\u7528\u8fd9\u4e9b\u6280\u672f\u65f6\uff0c\u5c06\u66f4\u6df1\u5165\u5730\u4e86\u89e3 LLM \u7684\u884c\u4e3a\u548c\u6027\u80fd\uff0c\u4ece\u800c\u83b7\u5f97\u66f4\u6709\u6548\u3001\u66f4\u53ef\u9760\u7684\u8bed\u8a00\u6a21\u578b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u5927\u578b\u8bed\u8a00\u6a21\u578b (LLM) \u7684\u590d\u6742\u6027\u548c\u89c4\u6a21\u4e0d\u65ad\u589e\u957f\uff0c\u8ddf\u8e2a\u5176\u6027\u80fd\u3001\u5b9e\u9a8c\u548c\u90e8\u7f72\u53d8\u5f97\u8d8a\u6765\u8d8a\u5177\u6709\u6311\u6218\u6027\u3002\u8fd9\u5c31\u662f ML [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[145,6,14],"tags":[389],"class_list":["post-5661","post","type-post","status-publish","format-standard","hentry","category-ai","category-build","category-teacher","tag-mlflow","entry"],"_links":{"self":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/5661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/comments?post=5661"}],"version-history":[{"count":0,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/5661\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/media?parent=5661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/categories?post=5661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/tags?post=5661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}