{"id":46560,"date":"2023-06-05T07:31:03","date_gmt":"2023-05-15T20:12:40","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/"},"modified":"2024-04-30T07:23:40","modified_gmt":"2024-04-29T23:23:40","slug":"46560-2","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/","title":{"rendered":""},"content":{"rendered":"<p>[\u66f4\u65b0] KubeFlow 1.0\u306eCONFIG_URI\u306b\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002<\/p>\n<h1>0. \u76ee\u6a19<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/2-1.png\" alt=\"undefined\" \/><\/div>\n<p>KubeFlow\u306f\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u958b\u767a\u30fb\u904b\u7528\u306e\u74b0\u5883\u3092\u63d0\u4f9b\u3059\u308bOSS\u3067\u3059\u3002<br \/>\nKubeCon NA 2019\u3067\u3082\u591a\u304f\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3067\u53d6\u308a\u4e0a\u3052\u3089\u308c\u307e\u3057\u305f\u3002Jupyter\u3092\u5fc5\u8981\u306a\u3060\u3051\u8d77\u52d5\u3057\u305f\u308a\u3001\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u3092\u5b9f\u884c\u3067\u304d\u305f\u308a\u3057\u307e\u3059\u3002v0.6.2\u3067\u306f\u3001\u8907\u6570\u30e6\u30fc\u30b6\u3092\u30b5\u30dd\u30fc\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u4eca\u5e74\u524d\u534a\u3067v1.0\u304c\u63d0\u4f9b\u3055\u308c\u308b\u4e88\u5b9a\u3067\u3001\u958b\u767a\u304c\u76ee\u4e0b\u9032\u3081\u3089\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001MLFlow models\u3082\u3001\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u306e\u4fdd\u5b58\u3068\u3044\u3046\u89b3\u70b9\u3067\u306f\u3001\u4fdd\u5b58\u5f62\u5f0f\u306e\u4e00\u3064\u3068\u3057\u3066\u975e\u5e38\u306b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u4ee5\u4e0b\u306e2\u3064\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">KubeFlow\u3092\u69cb\u7bc9\u3002\u305d\u306e\u4e0a\u306b\u3001\u307e\u305a\u30e6\u30fc\u30b6A\u3068\u30e6\u30fc\u30b6B\u305d\u308c\u305e\u308c\u306bJupyter\u3092\u8d77\u52d5\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30e6\u30fc\u30b6A\u304cMLFlow models\u3092\u4f7f\u3063\u3066\u3001\u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30eb\u3092\u4fdd\u5b58\u3002\u305d\u308c\u3092\u3001\u30e6\u30fc\u30b6B\u306eJupyter\u306b\u5171\u6709\u3057\u5fa9\u5143\u3002<\/ul>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/6-0.png\" alt=\"kubeflow-diagram-1.png\" \/><\/div>\n<h1>1. KubeFlow\u306e\u69cb\u7bc9<\/h1>\n<p>KubeFlow\u306e\u74b0\u5883\u304c\u3059\u3067\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306b\u306f\u3001\u3053\u306e\u7ae0\u3092\u8aad\u307f\u98db\u3070\u3057\u3066\u30012.MLFlow\u306e\u7ae0\u306b\u79fb\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u5fc5\u8981\u306a\u74b0\u5883<\/h3>\n<p>\u524d\u63d0\u3068\u306a\u308b\u30ea\u30bd\u30fc\u30b9\u91cf\u304c\u7d50\u69cb\u5927\u304d\u3044\u3067\u3059\u3002<\/p>\n<div>\n<div class=\"post-table\">\u30ea\u30bd\u30fc\u30b9\u91cfCPU4\u30b3\u30a2Memory12GB\u30c7\u30a3\u30b9\u30af50GB<\/div>\n<\/div>\n<h3>\u524d\u63d0\u3068\u306a\u308bkind\u306b\u3088\u308bKubernetes\u74b0\u5883\u306e\u69cb\u7bc9<\/h3>\n<p>KubeFlow\u304c\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u306eKubernetes\u30af\u30e9\u30b9\u30bf\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\nKubeFlow 0.7.1(\u6700\u65b0\u306e1.0\u3082)\u304c\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u306e\u306f\u6700\u65b0\u306eKubernetes\u3067\u306f\u306a\u304f\u3001\u5c11\u3057\u524d\u306e1.15\u3067\u3059\u3002<br \/>\nkind\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b1.15.7\u3068\u3044\u3046\u30ce\u30fc\u30c9\u30a4\u30e1\u30fc\u30b8\u3092\u6307\u5b9a\u3057\u3066\u30af\u30e9\u30b9\u30bf\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>kind create cluster <span class=\"nt\">--image<\/span> kindest\/node:v1.15.xx\r\n<\/code><\/pre>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u90fd\u5ea6\u66f8\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u30022020\/6\/23\u73fe\u5728\u3001v1.15.11\u304c\u6700\u65b0\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u3067\u6700\u65b0\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u691c\u7d22\u3057\u3066\u5229\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<br \/>\nhttps:\/\/hub.docker.com\/r\/kindest\/node\/tags?page=1<\/p>\n<p>kind\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u306f\u3001&#8221;kind\u3067\u8efd\u91cf\u30c6\u30b9\u30c8\u7528Kubernetes\u30af\u30e9\u30b9\u30bf\u3092\u4f5c\u308b\uff06\u904b\u7528\u3059\u308b\u6642\u306eTIPS&#8221;\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>kfctl\u3092\u4f7f\u3063\u305fKubeFlow\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>Kubernetes\u4e0a\u306b\u3001\u30b3\u30de\u30f3\u30c9\u30c4\u30fc\u30ebkfctl v1.0rc\u3092\u4f7f\u3063\u3066\u3001kubeflow v0.7.1\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<h4>\u5931\u6557\u7de8<\/h4>\n<p>\u6700\u521d\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u305f\u4ee5\u4e0b\u3092\u8a66\u3057\u3066\u898b\u307e\u3057\u305f\u304c\u3001\u79c1\u306e\u74b0\u5883 (Macbook) \u3067\u3053\u3061\u3089\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u305f\u969b\u306b\u306f\u3042\u3068\u306b\u51fa\u3066\u304f\u308bkfctl apply\u3067\u5931\u6557\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"post-pre\"><code>wget https:\/\/github.com\/kubeflow\/kubeflow\/releases\/download\/v0.7.0\/kfctl_v0.7.0_darwin.tar.gz\r\n<span class=\"nb\">tar <\/span>zxf kfctl_v0.7.0_darwin.tar.gz\r\n<span class=\"nb\">mv <\/span>kfctl-darwin kfctl\r\n<span class=\"nb\">chmod<\/span> +x kfctl\r\n<\/code><\/pre>\n<h4>\u6210\u529f\u7de8<\/h4>\n<p>\u5b9f\u306fkfctl\u306e\u672c\u5bb6\u306f\u3053\u3061\u3089\u306b\u79fb\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u3053\u3061\u3089\u306e\u6700\u65b0\u7248\u3067\u3042\u308bv1.0-rc\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u5c55\u958b\u3057\u3001kfctl\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0bMac\u306e\u5834\u5408 (Linux\u306f\u4e0a\u8a18URL\u306b\u3042\u308bamd64\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u5909\u3048\u308b)<\/p>\n<pre class=\"post-pre\"><code>mkdir $HOME\/kubeflow\r\ncd $HOME\/kubeflow\r\ncurl -LO https:\/\/github.com\/kubeflow\/kfctl\/releases\/download\/v1.0.1\/kfctl_v1.0.1-0-gf3edb9b_darwin.tar.gz\r\ntar zxf kfctl_v1.0.1-0-gf3edb9b_darwin.tar.gz\r\nchmod +x kfctl\r\nsudo mv kfctl \/usr\/local\/bin\/kfctl\r\n<\/code><\/pre>\n<h3>kfctl\u304c\u4f7f\u7528\u3059\u308b\u74b0\u5883\u5909\u6570\u306e\u4f5c\u6210<\/h3>\n<p>\u4ee5\u4e0b\u306ekubeflow.sh\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n\u5148\u307b\u3069\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305fkfctl\u306b\u30d1\u30b9\u3092\u901a\u3057\u3001kubeflow\u306b\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u7fa4\u3092\u8caf\u3081\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306a\u3069\u306e\u8a2d\u5b9a\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<br \/>\n\u30dd\u30a4\u30f3\u30c8\u306f\u3001KF_DIR\u306bkubeflow\u304c\u81ea\u52d5\u3067\u751f\u6210\u3059\u308bkubernetes\u7528\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3059\u308b\u5834\u6240\uff08\u3053\u308c\u304b\u3089\u4f5c\u6210\u3059\u308b\u7a7a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9\uff09\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">export <\/span><span class=\"nv\">BASE_DIR<\/span><span class=\"o\">=<\/span><span class=\"nv\">$HOME<\/span>\/kubeflow\r\n<span class=\"nb\">export <\/span><span class=\"nv\">PATH<\/span><span class=\"o\">=<\/span><span class=\"nv\">$PATH<\/span>:<span class=\"nv\">$BASE_DIR<\/span>\r\n<span class=\"nb\">export <\/span><span class=\"nv\">KF_NAME<\/span><span class=\"o\">=<\/span>mykubeflow\r\n<span class=\"nb\">export <\/span><span class=\"nv\">KF_DIR<\/span><span class=\"o\">=<\/span><span class=\"k\">${<\/span><span class=\"nv\">BASE_DIR<\/span><span class=\"k\">}<\/span>\/<span class=\"k\">${<\/span><span class=\"nv\">KF_NAME<\/span><span class=\"k\">}<\/span>\r\n<span class=\"nb\">export <\/span><span class=\"nv\">CONFIG_URI<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"https:\/\/raw.githubusercontent.com\/kubeflow\/manifests\/v1.0-branch\/kfdef\/kfctl_k8s_istio.v1.0.1.yaml\"<\/span>\r\n<\/code><\/pre>\n<p>\u69cb\u7bc9\u3059\u308bKubeFlow\u306e\u69cb\u6210\uff08\u8a8d\u8a3c\u6a5f\u80fd\u3042\u308a\u3001\u306a\u3057\uff09\u3084\u3001\u69cb\u7bc9\u5834\u6240\uff08AWS\u3001Azure\u3001GCP\u3001\u65e2\u5b58Kubernetes\uff09\u306b\u3088\u3063\u3066CONFIG_URI\u3092\u5909\u3048\u307e\u3059\u3002<\/p>\n<p>CONFIG_URI\u306e\u30ea\u30b9\u30c8\u306f\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u4e0a\u8a18\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>source kubeflow.sh\r\n<\/code><\/pre>\n<h3>KubeFlow\u306e\u30c7\u30d7\u30ed\u30a4<\/h3>\n<pre class=\"post-pre\"><code>mkdir -p ${KF_DIR}\r\ncd ${KF_DIR}\r\nkfctl apply -V -f ${CONFIG_URI}\r\n<\/code><\/pre>\n<p>\u3053\u306e\u3042\u3068\u3001KubeFlow\u306b\u5fc5\u8981\u306aIstio\u3084\u3055\u307e\u3056\u307e\u306a\u30c4\u30fc\u30eb\u306e\u30b3\u30f3\u30c6\u30ca\u30a4\u30e1\u30fc\u30b8\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u308b\u307e\u3067\u306b\u76f8\u5f53\u306e\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30ca\u304c\u8d77\u52d5\u3057\u305f\u3089\u3001\u7121\u4e8b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u7d42\u4e86\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>kubectl get po <span class=\"nt\">--all-namespaces<\/span>\r\n<\/code><\/pre>\n<h3>\u30ed\u30b0\u30a4\u30f3 &amp; Jupyter\u306e\u8d77\u52d5<\/h3>\n<pre class=\"post-pre\"><code>kubectl port-forward <span class=\"nt\">-n<\/span> istio-system svc\/istio-ingressgateway 80:80 <span class=\"nt\">--address<\/span> 0.0.0.0\r\n<\/code><\/pre>\n<p>http:\/\/localhost\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<br \/>\nJupyter\u3092\u8d77\u52d5\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u753b\u9762\u9077\u79fb\u3057\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/44-1.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/45-1.png\" alt=\"image.png\" \/><\/div>\n<h3>\u8907\u6570\u306eJupyter\u3067\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u3092\u5171\u6709\u3059\u308b\u8a2d\u5b9a<\/h3>\n<p>\u8907\u6570\u306eJupyter\u3092\u8d77\u52d5\u3059\u308b\u3068\u3001\u901a\u5e38\u306f\u307e\u3063\u305f\u304f\u5225\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3048\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u305d\u308c\u305e\u308c\u306eJupyter\u304c\u30b3\u30f3\u30c6\u30ca\u3068\u3057\u3066\u8d77\u52d5\u3057\u3066\u304a\u308a\u3001\u30b3\u30f3\u30c6\u30ca\u306f\u3082\u3068\u3082\u3068\u9694\u96e2\u3059\u308b\u305f\u3081\u306e\u6280\u8853\u306a\u306e\u3067\u305d\u3046\u3044\u3046\u3075\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>KubeFlow\u3067\u306f\u3001\u8907\u6570\u306eJupyter\u3067\u540c\u4e00\u30d5\u30a9\u30eb\u30c0\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u8a2d\u5b9a\u306f\u304b\u3093\u305f\u3093\u3067\u3059\u3002<\/p>\n<p>\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u3092\u898b\u3089\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u30012\u3064\u76ee\u306eJupyter\u4f5c\u6210\u6642\u306eWorkspace Volume\u306bExisting\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u65e2\u5b58\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u9078\u629e\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u30021\u3064\u76ee\u306eJupyter\u4f5c\u6210\u6642\u306b\u3059\u3067\u306b\u30d5\u30a9\u30eb\u30c0\u304c\u3067\u304d\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u6307\u5b9a\u3059\u308c\u3070\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u5171\u6709\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/50-0.png\" alt=\"kubeflow-diagram2.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/51-1.png\" alt=\"image.png\" \/><\/div>\n<p>\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u3092\u307f\u3066\u3044\u308b\u4e8c\u4eba\u3079\u3064\u3079\u3064\u306eJupyter<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/53-1.png\" alt=\"image.png\" \/><\/div>\n<h1>2. MLFlow models\u306e\u4fdd\u5b58\u3068\u5fa9\u5143<\/h1>\n<h3>(\u30e6\u30fc\u30b6A) MNIST\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u5b66\u7fd2\u3057\u305fCNN\u30e2\u30c7\u30eb\u3092\u4f5c\u308b<\/h3>\n<p>\u3053\u3061\u3089\u3092\u53c2\u8003\u306b\u3001Notebook\u306b\u8cbc\u308a\u4ed8\u3051\u308b\u3060\u3051\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u8d77\u52d5\u3057\u305f\u3066\u306eNotebook\u306e\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u4f55\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u306a\u306e\u3067\u3001pip\u30b3\u30de\u30f3\u30c9\u3067\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304b\u3089\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>pip <span class=\"nb\">install <\/span>mlflow <span class=\"nt\">--user<\/span>\r\npip <span class=\"nb\">install <\/span>keras <span class=\"nt\">--user<\/span>\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306fJupyter notebook\u4e0a\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b!\u3092\u3064\u3051\u3066\u304b\u3089\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3059\u308b\u3053\u3068\u3067\u3082\u5b9f\u884c\u3067\u304d\u307e\u3059\u3057\u3001Jupyter\u3067terminal\u3092\u4f5c\u3063\u3066\u304b\u3089\u305d\u3053\u306b\u6253\u3061\u8fbc\u3093\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"post-pre\"><code>!pip install mlflow --user\r\n!pip install keras --user\r\n<\/code><\/pre>\n<h3>(\u30e6\u30fc\u30b6A) MLFlow model\u3092\u4f7f\u3063\u3066\u4fdd\u5b58\u3059\u308b<\/h3>\n<p>Notebook\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u9593\u306f\u3001\u30e1\u30e2\u30ea\u4e0a\u306b\u30e2\u30c7\u30eb\u3092\u4fdd\u6301\u3057\u3066\u3044\u307e\u3059\u3002model\u3068\u3044\u3046\u5909\u6570\u3067\u3059\u3002\u3053\u306e\u30e2\u30c7\u30eb\u306f\u3001\u4e00\u5ea6Notebook\u3092\u7d42\u4e86\u3059\u308b\u3068\u6d88\u3048\u3066\u3057\u307e\u3044\u3001\u518d\u5ea6\u4f5c\u308a\u76f4\u3059\u305f\u3081\u306b\u306f\u3082\u3046\u4e00\u5ea6\u5b66\u7fd2\u3057\u76f4\u3055\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u6642\u9593\u3082\u304b\u304b\u308b\u3057\u30b3\u30b9\u30c8\u3082\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30eb\u3092\u4e00\u5ea6\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3057\u3001\u3044\u3064\u3067\u3082\u5fa9\u5143\u3059\u308b\u305f\u3081\u306e\u4ed5\u639b\u3051\u3092\u63d0\u4f9b\u3059\u308b\u306e\u304c\u3001MLFlow model\u3067\u3059\u3002<br \/>\nMLFlow model\u306f\u3001save_model\u3067\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u3001load_model\u3067\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5fa9\u5143\u3057\u307e\u3059\u3002<\/p>\n<p>\u3055\u304d\u307b\u3069\u306e\u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30ebmodel\u3092save_model\u3067\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"kn\">import<\/span> <span class=\"nn\">mlflow.keras<\/span>\r\n<span class=\"n\">path<\/span> <span class=\"o\">=<\/span> <span class=\"s\">\".\/model\"<\/span>\r\n<span class=\"n\">mlflow<\/span><span class=\"p\">.<\/span><span class=\"n\">keras<\/span><span class=\"p\">.<\/span><span class=\"n\">save_model<\/span><span class=\"p\">(<\/span><span class=\"n\">model<\/span><span class=\"p\">,<\/span> <span class=\"n\">path<\/span><span class=\"p\">)<\/span>\r\n<\/code><\/pre>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u3001.\/model\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u304c\u65b0\u898f\u4f5c\u6210\u3055\u308c\u3001\u4e2d\u8eab\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/67-0.png\" alt=\"image.png\" \/><\/div>\n<p>Notebook\u306f\u3053\u3061\u3089\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>(\u30e6\u30fc\u30b6B) load_model\u3092\u4f7f\u3063\u3066\u5fa9\u5143\u3059\u308b<\/h3>\n<p>\u3064\u304e\u306b\u3001\u305d\u308c\u3092\u30e6\u30fc\u30b6B\u306eJupyter\u4e0a\u306bload_model\u3092\u4f7f\u3063\u3066\u5fa9\u5143\u3057\u307e\u3059\u3002<\/p>\n<p>\u524d\u8ff0\u306e\u30e6\u30fc\u30b6A\u3068\u30e6\u30fc\u30b6B\u306eJupyter\u306e\u30d5\u30a9\u30eb\u30c0\u5171\u6709\u8a2d\u5b9a\u304c\u7d42\u308f\u3063\u3066\u3044\u308b\u3068\u3057\u307e\u3059\u3002\u3059\u308b\u3068\u3001\u30e6\u30fc\u30b6B\u306b\u306f\u3001\u30e6\u30fc\u30b6A\u304c\u4fdd\u5b58\u3057\u305f\u30e2\u30c7\u30eb\u304c.\/model\u30d5\u30a9\u30eb\u30c0\u306b\u898b\u3048\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3053\u308c\u3092\u5229\u7528\u3059\u308bLoadModel\u3068\u3044\u3046Notebook\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30e2\u30c7\u30eb\u3092\u5fa9\u5143\u3057\u3001\u305d\u306eevaluate\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u63a8\u8ad6\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"kn\">import<\/span> <span class=\"nn\">mlflow.keras<\/span>\r\n<span class=\"n\">path<\/span> <span class=\"o\">=<\/span> <span class=\"s\">\".\/model\"<\/span>\r\n<span class=\"n\">model<\/span> <span class=\"o\">=<\/span> <span class=\"n\">mlflow<\/span><span class=\"p\">.<\/span><span class=\"n\">keras<\/span><span class=\"p\">.<\/span><span class=\"n\">load_model<\/span><span class=\"p\">(<\/span><span class=\"n\">path<\/span><span class=\"p\">)<\/span>\r\n\r\n<span class=\"n\">score<\/span> <span class=\"o\">=<\/span> <span class=\"n\">model<\/span><span class=\"p\">.<\/span><span class=\"n\">evaluate<\/span><span class=\"p\">(<\/span><span class=\"n\">x_test<\/span><span class=\"p\">,<\/span> <span class=\"n\">y_test<\/span><span class=\"p\">,<\/span> <span class=\"n\">verbose<\/span><span class=\"o\">=<\/span><span class=\"mi\">0<\/span><span class=\"p\">)<\/span>\r\n<\/code><\/pre>\n<p>Notebook\u306f\u3001\u3053\u3061\u3089\u306b\u304a\u3044\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/75-2.png\" alt=\"image.png\" \/><\/div>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u7121\u4e8b.\/model\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30eb\u304c\u5fa9\u5143\u3055\u308c\u3066\u3001\u63a8\u8ad6\u304c\u3067\u304d\u305f\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<h1>\u307e\u3068\u3081<\/h1>\n<p>KubeFlow\u306f\u3001\u30e6\u30fc\u30b6\u3054\u3068\u306e\u74b0\u5883\u3092\u304b\u3093\u305f\u3093\u306b\u4f5c\u308a\u3001\u30d5\u30a9\u30eb\u30c0\u306e\u5171\u6709\u306a\u3069\u3082\u3067\u304d\u308b\u306e\u3067\u3001\u958b\u767a\u30fb\u904b\u7528\u304c\u697d\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nMLFlow models\u306f\u3001\u3055\u307e\u3056\u307e\u306a\u6a5f\u68b0\u5b66\u7fd2\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30e2\u30c7\u30eb\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u3066\u3001\u4fdd\u5b58\u30fb\u5fa9\u5143\u3092\u5b9f\u73fe\u3057\u307e\u3059\u3002\u30e2\u30c7\u30eb\u5171\u6709\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u306d\u3002\u305f\u3060\u3057\u3001\u30e2\u30c7\u30eb\u3060\u3051\u5171\u6709\u3057\u3066\u3082\u5b8c\u7d50\u3057\u306a\u3044\u3053\u3068\u3082\u591a\u3044\uff08\u518d\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306a\u3069\uff09\u306e\u3067\u3001\u4e00\u822c\u7684\u306a\u904b\u7528\u3067\u306f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9(\u30e2\u30c7\u30eb\u3092\u751f\u6210\u3057\u305fNotebook\u81ea\u4f53)\u3092\u4e00\u7dd2\u306b\u5171\u6709\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u5f8c\u3001\u5b8c\u6210\u3057\u305f\u30e2\u30c7\u30eb\u3092\u672c\u756a\u7cfb\u306b\u30c7\u30d7\u30ed\u30a4\u3055\u305b\u308b\u306e\u306f\u3001\u6b21\u306e\u6a5f\u4f1a\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u66f4\u65b0] KubeFlow 1.0\u306eCONFIG_URI\u306b\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002 0. \u76ee\u6a19 KubeFlow\u306f\u3001\u6a5f\u68b0 [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-46560","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>- Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:description\" content=\"[\u66f4\u65b0] KubeFlow 1.0\u306eCONFIG_URI\u306b\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002 0. \u76ee\u6a19 KubeFlow\u306f\u3001\u6a5f\u68b0 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-15T20:12:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T23:23:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/2-1.png\" \/>\n<meta name=\"author\" content=\"\u5b87, \u534e\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5b87, \u534e\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/\",\"name\":\"- Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-05-15T20:12:40+00:00\",\"dateModified\":\"2024-04-29T23:23:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\",\"name\":\"\u5b87, \u534e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"caption\":\"\u5b87, \u534e\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"- Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/","og_locale":"zh_CN","og_type":"article","og_description":"[\u66f4\u65b0] KubeFlow 1.0\u306eCONFIG_URI\u306b\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002 0. \u76ee\u6a19 KubeFlow\u306f\u3001\u6a5f\u68b0 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-15T20:12:40+00:00","article_modified_time":"2024-04-29T23:23:40+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d655837434c4406d06cc9\/2-1.png"}],"author":"\u5b87, \u534e","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u5b87, \u534e","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/","name":"- Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-05-15T20:12:40+00:00","dateModified":"2024-04-29T23:23:40+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458","name":"\u5b87, \u534e","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","caption":"\u5b87, \u534e"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/46560-2\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=46560"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46560\/revisions"}],"predecessor-version":[{"id":90513,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46560\/revisions\/90513"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=46560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=46560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=46560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}