{"id":10020559,"date":"2024-12-27T22:27:43","date_gmt":"2024-12-27T14:27:43","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020559"},"modified":"2024-12-27T22:27:43","modified_gmt":"2024-12-27T14:27:43","slug":"amazon-bedrock-%e5%ae%9e%e8%b7%b5-%e5%88%a9%e7%94%a8-llama-3-2-%e6%a8%a1%e5%9e%8b%e5%88%86%e6%9e%90%e5%85%a8%e7%90%83%e7%b3%96%e5%b0%bf%e7%97%85%e8%b6%8b%e5%8a%bf","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020559","title":{"rendered":"Amazon Bedrock \u5b9e\u8df5 &#8211; \u5229\u7528 Llama 3.2 \u6a21\u578b\u5206\u6790\u5168\u7403\u7cd6\u5c3f\u75c5\u8d8b\u52bf"},"content":{"rendered":"<blockquote>\n<p>\u9ec4\u6d69\u6587<\/p>\n<p>\u8d44\u6df1\u5f00\u53d1\u8005\u5e03\u9053\u5e08<\/p>\n<p>\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280<\/p>\n<p>\u62e5\u6709\u7535\u4fe1\u3001\u4e92\u8054\u7f51\u4ee5\u53ca\u4e91\u8ba1\u7b97\u7b49\u884c\u4e1a\u8d85\u8fc7 20 \u5e74\u7684\u4e30\u5bcc\u7ecf\u9a8c\uff0c\u66fe\u4efb\u804c\u4e8e\u5fae\u8f6f\u3001Sun \u548c\u4e2d\u56fd\u7535\u4fe1\u3002\u4ed6\u76ee\u524d\u4e13\u6ce8\u4e8e\u751f\u6210\u5f0f AI\u3001\u5927\u578b\u8bed\u8a00\u6a21\u578b (LLM)\u3001\u673a\u5668\u5b66\u4e60\u548c\u6570\u636e\u79d1\u5b66\u7b49\u9886\u57df\u7684\u6280\u672f\u5185\u5bb9\u521b\u4f5c\u548c\u5b9e\u8df5\u5206\u4eab\uff0c\u81f4\u529b\u4e8e\u8d4b\u80fd\u5168\u7403\u5f00\u53d1\u8005\u3002<\/p>\n<\/blockquote>\n<p>\u672c\u535a\u5ba2\u5185\u5bb9\u539f\u6587\u6765\u81ea\u4e8e\u4f5c\u8005\u5728\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u5f00\u53d1\u8005\u793e\u533a\u53d1\u8868\u7684\u6280\u672f\u535a\u5ba2\uff1a<\/p>\n<p>\u201cLeveraging Llama 3.2 90B Instruct model for Multimodal Diabetes Prevalence Analysis on Amazon Bedrock\u201d\uff1a<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=x7FcWerhYdWLWP9haX7u8Q%3D%3D.GTCTtZa2Ub0Et7VKPE2MFzwxKRdKLfCQYrdVZE%2BqgcILvRz8y1rJwrAk%2BcxN4WQKxxN9QRZoVBqx3CxQZwUsH8J%2Bhi6qksfOpQbfTDWJJ4k%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/community.aws\/content\/2p6VvdzzeBfpOzSBXEzZdmJEyaE\/?tr&#8230;<\/a><\/p>\n<blockquote><p><a href=\"https:\/\/link.segmentfault.com\/?enc=ZMJydLhCeW3g3ZmjhUs8wQ%3D%3D.ttai7vEtqJysxY4XD82eitu2jTXRMd4nk65VEFJ7EP4y0mU0ULaq9e5Ux018A9nzMJYK6LYO4q%2BGO4MSUgiHI2bqpxbvW23H9mR13Wo1sVPEK6Jvatz5x5M73xtq8z5F\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u5f00\u53d1\u8005\u793e\u533a<\/a>\u4e3a\u5f00\u53d1\u8005\u4eec\u63d0\u4f9b\u5168\u7403\u7684\u5f00\u53d1\u6280\u672f\u8d44\u6e90\u3002\u8fd9\u91cc\u6709\u6280\u672f\u6587\u6863\u3001\u5f00\u53d1\u6848\u4f8b\u3001\u6280\u672f\u4e13\u680f\u3001\u57f9\u8bad\u89c6\u9891\u3001\u6d3b\u52a8\u4e0e\u7ade\u8d5b\u7b49\u3002\u5e2e\u52a9\u4e2d\u56fd\u5f00\u53d1\u8005\u5bf9\u63a5\u4e16\u754c\u6700\u524d\u6cbf\u6280\u672f\uff0c\u89c2\u70b9\uff0c\u548c\u9879\u76ee\uff0c\u5e76\u5c06\u4e2d\u56fd\u4f18\u79c0\u5f00\u53d1\u8005\u6216\u6280\u672f\u63a8\u8350\u7ed9\u5168\u7403\u4e91\u793e\u533a\u3002\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5173\u6ce8\/\u6536\u85cf\uff0c\u770b\u5230\u8fd9\u91cc\u8bf7\u4e00\u5b9a\u4e0d\u8981\u5306\u5306\u5212\u8fc7\uff0c<a href=\"https:\/\/link.segmentfault.com\/?enc=6ehaOxQof178XwkTfxcMQA%3D%3D.wOFdh6kYQ7e6dXNTUt7B4b6khHK1Jx2LoZCrfuw%2F9qpD4ySkW27DZL%2BxM19slFzbpsi9k5AX6791%2Ffp%2FkI%2Ff%2BYyIUPHEQxxCWy9UOexanxdHXvqP7l%2FAHHKjr4FnSwojNbpFjppDrioT1xee9zYwGQ%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">\u70b9\u8fd9\u91cc<\/a>\u8ba9\u5b83\u6210\u4e3a\u4f60\u7684\u6280\u672f\u5b9d\u5e93\uff01<\/p><\/blockquote>\n<h3>\u6982\u8ff0<\/h3>\n<p>\u5728\u5927\u578b\u8bed\u8a00\u6a21\u578b\u9886\u57df\uff0c\u591a\u6a21\u6001\u6a21\u578b\u7684\u5f3a\u5927\u80fd\u529b\u5df2\u7ecf\u5f00\u59cb\u4e3a\u89e3\u51b3\u590d\u6742\u95ee\u9898\u5f00\u8f9f\u4e86\u65b0\u7684\u53ef\u80fd\u6027\u3002\u672c\u6587\u63a2\u8ba8\u7684\u95ee\u9898\u662f\u5206\u6790\u5168\u7403\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u8d8b\u52bf\uff0c\u8fd9\u662f\u4e00\u4e2a\u5173\u7cfb\u5230\u5168\u7403\u6570\u4ebf\u4eba\u7684\u91cd\u5927\u5065\u5eb7\u95ee\u9898\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5c06\u63a2\u8ba8\u5982\u4f55\u5728 Amazon Bedrock \u4e0a\uff0c\u4f7f\u7528 Meta Llama 3.2 90B Instruct \u6a21\u578b\u6765\u5206\u6790\u5168\u7403\u4e0d\u540c\u56fd\u5bb6\u6216\u5730\u533a\u7684\u7cd6\u5c3f\u75c5\u60a3\u8005\u7684\u60a3\u75c5\u7387\u5206\u5e03\u6570\u636e\u3002 <\/p>\n<p>Meta \u5f00\u53d1\u7684 Llama 3.2 90B Instruct \u6a21\u578b\uff0c\u662f\u4e00\u79cd\u5148\u8fdb\u7684\u5177\u6709\u591a\u6a21\u6001\u80fd\u529b\u7684\u5927\u6a21\u578b\uff0c\u5b83\u80fd\u591f\u5904\u7406\u548c\u5206\u6790\u6587\u672c\u548c\u56fe\u50cf\uff0c\u8fd9\u4f7f\u5b83\u6210\u4e3a\u6211\u4eec\u5206\u6790\u5168\u7403\u7cd6\u5c3f\u75c5\u60a3\u8005\u7684\u60a3\u75c5\u7387\u6570\u636e\u7684\u7406\u60f3\u9009\u62e9\u4e4b\u4e00\u3002 <\/p>\n<p>\u6211\u4eec\u5c06\u91c7\u7528\u8fd0\u884c\u5728 Amazon Bedrock \u7684 Llama 3.2 90B Instruct \u6a21\u578b\u6765\u8fdb\u884c\u5206\u6790\uff0cAmazon Bedrock \u4e0e\u6d41\u884c\u7684\u5148\u8fdb\u5927\u578b\u8bed\u8a00\u6a21\u578b\u65e0\u7f1d\u96c6\u6210\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u9ad8\u6548\u4e13\u4e1a\u5730\u521b\u5efa\u81ea\u5df1\u7684\u751f\u6210\u5f0f AI \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<h3>\u591a\u6a21\u6001\u80fd\u529b\u548c\u57fa\u51c6<\/h3>\n<p>Meta \u5728\u5176\u5bf9\u5916\u53d1\u5e03\u7684\u8bba\u6587 \u201cThe Llama 3 Herd of Models\u201d \u4e4b\u4e2d\uff0c\u8be6\u7ec6\u9610\u91ca\u4e86\u5c06\u591a\u6a21\u6001\u80fd\u529b\u6dfb\u52a0\u5230 Llama 3 \u7cfb\u5217\u6a21\u578b\u7684\u7814\u7a76\u7ec4\u5408\u65b9\u6cd5\uff0c\u8be5\u65b9\u6cd5\u4f1a\u7ecf\u8fc7\u4e94\u4e2a\u9636\u6bb5\u6765\u8bad\u7ec3\u591a\u6a21\u6001\u6a21\u578b\uff0c\u5206\u522b\u662f\uff1a<\/p>\n<p>(1) \u8bed\u8a00\u6a21\u578b\u9884\u8bad\u7ec3 <\/p>\n<p>(2) \u591a\u6a21\u6001\u7f16\u7801\u5668\u9884\u8bad\u7ec3 <\/p>\n<p>(3) \u89c6\u89c9\u9002\u914d\u5668\u8bad\u7ec3 <\/p>\n<p>(4) \u6a21\u578b\u5fae\u8c03 <\/p>\n<p>(5) \u8bed\u97f3\u9002\u914d\u5668\u8bad\u7ec3 <\/p>\n<p>\u8be5\u8bba\u6587\u4e2d\u7684\u56fe\u793a\u8bf4\u660e\u4e86\u8fd9\u4e00\u8fc7\u7a0b\u3002<br \/><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"378\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdfQN1\" alt=\"image.png\" title=\"image.png\"><\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=nZu4b%2Bp5wh1jXwGwXhiNMA%3D%3D.7SnDx%2BuYCcg3B%2FmUpfp4bcmeizs9G6M8%2BtMdPw%2F%2Byo8pnKUWfNhleMXZCFgNqANfeZlzFiLiUbj%2Fo4ik%2BOtau0kxmML%2BO7TzB1slHyUxi4ru1h0wFk4cld9VzNjPWz8c\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/ai.meta.com\/research\/publications\/the-llama-3-herd-of&#8230;<\/a><\/p>\n<p>\u6765\u81ea llama.com \u7f51\u7ad9\u516c\u5f00\u7684\u6d4b\u8bd5\u6570\u636e\uff0c\u6bd4\u8f83\u4e86\u4e0d\u540c AI \u6a21\u578b\u5728\u5404\u79cd\u57fa\u51c6\u6d4b\u8bd5\u548c\u4efb\u52a1\u4e0a\u7684\u8868\u73b0\u3002\u4e0b\u8868\u5206\u4e3a\u201c\u5927\u5b66\u6c34\u5e73\u95ee\u9898\u548c\u6570\u5b66\u63a8\u7406\u201d\u548c\u201c\u56fe\u8868\u548c\u56fe\u89e3\u7406\u89e3\u201d\u4e24\u5927\u90e8\u5206\uff0c\u6bcf\u4e2a\u90e8\u5206\u4e0b\u53c8\u6709\u51e0\u4e2a\u5b50\u7c7b\u522b\u3002<\/p>\n<p>\u5728\u5927\u591a\u6570\u57fa\u51c6\u6d4b\u8bd5\u4e2d\uff0cLlama 3.2 90B \u6a21\u578b\u7684\u8868\u73b0\u666e\u904d\u4f18\u4e8e\u5176\u4ed6\u6a21\u578b\uff0c\u5728\u201cAI2 Diagram\u201d\u57fa\u51c6\u6d4b\u8bd5\u4e2d\uff0cLlama 3.2 90B \u6a21\u578b\u83b7\u5f97\u4e86 92.3% \u7684\u6700\u9ad8\u5206\uff01<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"345\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdfQN2\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=pMFehK%2BGfEQUxQOJ1Jcfrw%3D%3D.MQlog42x9yOJ%2F79g2KJ82epT%2F1M80IFDU%2BPp9lY0DQmkcyIby%2BHBAkJnZjV6GTUx\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/www.llama.com\/?trk=cndc-detail<\/a><\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u4e00\u4e2a\u5177\u4f53\u7684\u6848\u4f8b\u7814\u7a76\uff0c\u6f14\u793a\u5982\u4f55\u5728 Amazon Bedrock \u4e0a\u65b9\u4fbf\u9ad8\u6548\u5730\u5229\u7528 Llama 3.2 90B Instruct \u6a21\u578b\u7684\u591a\u6a21\u6001\u80fd\u529b\u3002\u6211\u4eec\u5c06\u4f7f\u7528\u8fd9\u4e2a\u6a21\u578b\u5206\u6790\u5168\u7403\u4e0d\u540c\u56fd\u5bb6\u548c\u5730\u533a\u7684\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u8d8b\u52bf\u3002<\/p>\n<h3>\u524d\u671f\u51c6\u5907<\/h3>\n<p>\u6211\u4eec\u7684\u5206\u6790\u6570\u636e\u96c6\u662f\u4e00\u4e2a\u5305\u542b\u7cd6\u5c3f\u75c5\u6d41\u884c\u7387\u4fe1\u606f\u7684\u6570\u636e\u96c6\uff0c\u5176\u5305\u62ec\u76f8\u5173\u7684\u56fe\u50cf\u7b49\u3002\u5728\u6211\u4eec\u53ef\u4ee5\u5229\u7528 Meta Llama 3.2 90B Instruct \u6a21\u578b\u8fdb\u884c\u63a8\u7406\u4e4b\u524d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u786e\u4fdd\u6211\u4eec\u7684\u56fe\u50cf\u6570\u636e\u4e0e\u5176\u8981\u6c42\u517c\u5bb9\u3002 <\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u5f00\u53d1\u4e86\u4e00\u4e2a\u5b9e\u7528\u7684 Python \u7a0b\u5e8f\u51fd\u6570\uff08\u53ef\u5728 <a href=\"https:\/\/link.segmentfault.com\/?enc=tHpjCZlyLJ1vSgrNZ5%2BK%2FA%3D%3D.6FAj1a%2FNzjqHUs3h3NurgcQPECOMHZnhRQ%2F1sTOVfv3uzhSX8QjAmCMiehHuaHvHctyD%2BjGKHrmh3BOfw79zMMWblFcRp4jha643fPPw5OVOKv7QDYXt6dWDMSpLA0XW\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/github.com\/hanyun2019\/bedrock-in-practice\/blob\/main\/utils.py?trk=cndc-detail<\/a>  \u83b7\u5f97\uff09\uff0c\u7528\u4e8e\u8c03\u6574\u56fe\u50cf\u5927\u5c0f\u5e76\u786e\u4fdd\u7b26\u5408 Meta Llama 3.2 90B Instruct \u6a21\u578b\u89c4\u8303\u3002<\/p>\n<p>\u5206\u6790\u4e2d\u91c7\u7528\u7684\u4e24\u5f20\u5173\u4e8e\u7cd6\u5c3f\u75c5\u75c5\u60a3\u6570\u636e\u53ca\u8d8b\u52bf\u7684\u56fe\u50cf\u6765\u7f51\u7ad9\u5982\u4e0b\u6240\u793a\u3002\u8be5\u7f51\u7ad9\u6c47\u7f16\u4e86\u4e16\u754c\u94f6\u884c\uff082024 \u5e74\uff09\u4ece\u591a\u4e2a\u6765\u6e90\u6536\u96c6\u7684\u76f8\u5173\u6570\u636e\uff1a<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=iLjc6%2BBkHX4DQ6TzBotMpg%3D%3D.dS4dMy1I10yrb34Ah0nofLCKSdMrpdsbTrsUa7Bs6Po0MESgsFDpSDfwDiztlMhKtw%2BVKCzL85fclVnkzsii7hhVqSZECxam0gMMh6KQMCc%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/ourworldindata.org\/grapher\/diabetes-prevalence?trk=cn&#8230;<\/a><\/p>\n<h3>\u8bbe\u7f6e<\/h3>\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\u5e76\u6253\u5370 boto3 \u7248\u672c\u3002\u4ee5\u4e0b\u4ee3\u7801\u5c06\u5bfc\u5165\u4e86 <code>boto3<\/code> \u5e93\uff0c\u8fd9\u662f\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u670d\u52a1\u7684 Python SDK\uff0c\u7136\u540e\u6253\u5370 <code>boto3<\/code> \u7684\u7248\u672c\u4ee5\u786e\u4fdd\u5b83\u662f\u6700\u65b0\u7684:<\/p>\n<pre><code>import boto3\nprint('boto3 version')\nprint(boto3.__version__)\n\n!pip install --upgrade boto3<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765,\u6211\u4eec\u5b9a\u4e49\u6a21\u578b ID \u5e76\u52a0\u8f7d\u9700\u8981\u5206\u6790\u7684\u56fe\u50cf\uff1a<\/p>\n<p>(1) <code>MODEL_ID<\/code>\u88ab\u8bbe\u7f6e\u4e3a\u5728 Amazon Bedrock \u4e0a Llama 3.2 90B Instruct \u6a21\u578b\u7684\u7279\u5b9a\u6a21\u578b ID<\/p>\n<p>(2) <code>ORIGIN_IMAGE<\/code>\u88ab\u8bbe\u7f6e\u4e3a\u539f\u59cb\u56fe\u50cf\u6587\u4ef6\u7684\u8def\u5f84<\/p>\n<pre><code>MODEL_ID = &quot;us.meta.llama3-2-90b-instruct-v1:0&quot;\nORIGIN_IMAGE = &quot;images\/diabetes-prevalence.png&quot;<\/code><\/pre>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u4ece\u6211\u7f16\u5199\u7684\u81ea\u5b9a\u4e49 <code>utils<\/code> \u6a21\u5757\u5bfc\u5165\u4e24\u4e2a\u51fd\u6570\uff1a<code>disp_image<\/code> \u548c <code>resize_image<\/code>\u3002\u9700\u8981\u8c03\u6574\u56fe\u50cf\u5927\u5c0f\u662f\u56e0\u4e3a\uff1aMeta Llama 90B Instruct \u6a21\u578b\u5bf9\u8f93\u5165\u56fe\u50cf\u7684\u5927\u5c0f\u6709\u4e00\u5b9a\u9650\u5236\u3002<\/p>\n<pre><code>from utils import disp_image\nfrom utils import resize_image\n\ndisp_image(ORIGIN_IMAGE)\n\n# Image processing\nfrom PIL import Image\nimg1 = Image.open(ORIGIN_IMAGE)\nimg1.size\nRESIZED_IMG = resize_image(img1)\n\n# Open the JPG image\njpg_image = Image.open(&quot;images\/resized_image.jpg&quot;)\n\n# Convert the image to PNG format\npng_image = jpg_image.convert(&quot;RGB&quot;)\n\n# Save the converted PNG image\npng_image.save(&quot;images\/resized_image.png&quot;)\nRESIZED_IMAGE = &quot;images\/resized_image.png&quot;\ndisp_image(RESIZED_IMAGE)<\/code><\/pre>\n<p>\u56fe\u50cf\u5904\u7406\u5b8c\u6210\u540e\uff0c\u6211\u4f7f\u7528\u81ea\u5df1\u5b9a\u4e49\u7684\u56fe\u50cf\u663e\u793a\u51fd\u6570  <code>disp_image()<\/code> \uff0c\u6765\u663e\u793a\u5c06\u8f93\u5165\u5230 Llama \u6a21\u578b\u7684\u7b2c\u4e00\u5f20\u56fe\u50cf\u3002\u8fd9\u662f\u4e00\u5f20\u5168\u7403\u7cd6\u5c3f\u75c5\u75c5\u60a3\u5206\u5e03\u8d8b\u52bf\u7684\u56fe\u50cf\u3002\u989c\u8272\u7684\u6df1\u6d45\u8868\u793a\u6240\u5728\u4e16\u754c\u56fd\u5bb6\u6216\u5730\u533a\u7684\u7cd6\u5c3f\u75c5\u60a3\u8005\u5728\u8be5\u533a\u57df\u5360\u6bd4\u7684\u7a0b\u5ea6\u3002\u989c\u8272\u8d8a\u6df1\uff0c\u75c5\u60a3\u60c5\u51b5\u5c31\u8d8a\u4e25\u91cd\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"742\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdfQN3\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=WIbMz9GdHEgMBmsy9Scz0A%3D%3D.Pl6YLqmJymP6ncJR6y1nqNsPpZTmW7vF236K8dQOZFbbcRqsWHhsbGekb%2BKnrB1w%2BLd%2Fp3Ep0nHq8xJMURDidXF5If0wTSjx9ObGrJ4%2BxEw%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/ourworldindata.org\/grapher\/diabetes-prevalence?trk=cn&#8230;<\/a><\/p>\n<h3>\u4e0e\u6a21\u578b\u4e92\u52a8<\/h3>\n<p>\u4e00\u5207\u51c6\u5907\u5c31\u7eea\uff0c\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528\u8c03\u6574\u540e\u7684\u56fe\u50cf\u4f5c\u4e3a\u8f93\u5165\uff0c\u63d0\u4f9b\u7ed9 Llama 3.2 90B Instruct \u6a21\u578b\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u5148\u4f7f\u7528 <code>boto3<\/code> \u4e3a Amazon Bedrock Runtime \u670d\u52a1\u521b\u5efa\u4e00\u4e2a\u5ba2\u6237\u7aef\u5bf9\u8c61\uff1a<\/p>\n<pre><code>bedrock_runtime = boto3.client(&quot;bedrock-runtime&quot;)<\/code><\/pre>\n<p>\u7136\u540e\uff0c\u4ee5\u4e8c\u8fdb\u5236\u8bfb\u53d6\u6a21\u5f0f (<code>&quot;rb&quot;<\/code>) \u6253\u5f00\u8c03\u6574\u540e\u7684\u56fe\u50cf\u6587\u4ef6\uff0c\u6587\u4ef6\u5185\u5bb9\u88ab\u8bfb\u5165 <code>image<\/code> \u53d8\u91cf\uff1a<\/p>\n<pre><code>with open(RESIZED_IMAGE, &quot;rb&quot;) as f:   \n    image = f.read()<\/code><\/pre>\n<p>\u63a5\u7740\u5b9a\u4e49\u4e00\u4e2a\u7528\u6237\u6d88\u606f\uff0c\u8981\u6c42\u6a21\u578b\u8bc6\u522b\u51fa\u5168\u7403\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u6700\u9ad8\u7684 10 \u4e2a\u56fd\u5bb6\uff1a<\/p>\n<pre><code>user_message = &quot;According to this chart, which are the top 10 countries with the highest prevalence of diabetes?&quot;<\/code><\/pre>\n<p>\u521b\u5efa\u4e00\u4e2a\u6d88\u606f\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u6761\u6d88\u606f\u3002\u6d88\u606f\u4e2d\u5305\u62ec\u7528\u6237\u7684\u89d2\u8272\u3001\u56fe\u50cf\u548c\u7528\u6237\u7684\u6d88\u606f\u5185\u5bb9\uff1a<\/p>\n<pre><code>messages = [   \n    {      \n        &quot;role&quot;: &quot;user&quot;,       \n        &quot;content&quot;: [         \n            {&quot;image&quot;: {&quot;format&quot;: &quot;png&quot;, &quot;source&quot;: {&quot;bytes&quot;: image}}},        \n            {&quot;text&quot;: user_message},     \n        ],  \n    }\n]<\/code><\/pre>\n<p>\u8c03\u7528 Amazon Bedrock Runtime \u5ba2\u6237\u7aef\u7684 <code>converse<\/code> \u51fd\u6570\uff0c\u4f20\u5165 <code>MODEL_ID<\/code> \u548c\u4ee5\u4e0a\u6d88\u606f\u5217\u8868\u3002\u6a21\u578b\u7684\u54cd\u5e94\u6d88\u606f\u5c06\u5b58\u50a8\u5728 <code>response<\/code> \u53d8\u91cf\u4e2d\uff1a<\/p>\n<pre><code>response = bedrock_runtime.converse( \n    modelId=MODEL_ID,   \n    messages=messages,\n)<\/code><\/pre>\n<p>\u4ece\u54cd\u5e94\u5bf9\u8c61\u4e2d\u63d0\u53d6\u54cd\u5e94\u6587\u672c\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728 <code>response_text<\/code> \u53d8\u91cf\u4e2d\u3002\u4e4b\u540e\uff0c\u5c06\u54cd\u5e94\u6587\u672c\u6253\u5370\u663e\u793a\u51fa\u6765\uff1a<\/p>\n<pre><code>response_text = response[&quot;output&quot;][&quot;message&quot;][&quot;content&quot;][0][&quot;text&quot;]\nprint(response_text)<\/code><\/pre>\n<p>\u6211\u81ea\u5df1\u83b7\u5f97\u7684\u6a21\u578b\u6d4b\u8bd5\u54cd\u5e94\u6587\u672c\u5982\u4e0b\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\uff1a<\/p>\n<p>According to the chart, the top 10 countries with the highest prevalence of diabetes are:<\/p>\n<ol>\n<li><strong>Saudi Arabia<\/strong>: 17.5%<\/li>\n<li><strong>Egypt<\/strong>: 17.5%<\/li>\n<li><strong>United Arab Emirates<\/strong>: 17.5%<\/li>\n<li><strong>Bahrain<\/strong>: 17.5%<\/li>\n<li><strong>Kuwait<\/strong>: 17.5%<\/li>\n<li><strong>Qatar<\/strong>: 17.5%<\/li>\n<li><strong>Oman<\/strong>: 17.5%<\/li>\n<li><strong>Yemen<\/strong>: 17.5%<\/li>\n<li><strong>Libya<\/strong>: 17.5%<\/li>\n<li><strong>Papua New Guinea<\/strong>: 17.5%<\/li>\n<\/ol>\n<p>These countries have the highest percentage of their population aged 20-79 with diabetes, according to the chart.<\/p>\n<p>\u5982\u679c\u4f60\u4ece\u4ee5\u4e0a\u793a\u4f8b\u4e2d\u5f97\u5230\u542f\u53d1\uff0c\u5e76\u5e0c\u671b\u8fdb\u4e00\u6b65\u63a2\u7d22\uff0c\u53ef\u53c2\u8003\u4ee5\u4e0b GitHub \u4ee3\u7801\u5e93\u67e5\u770b\u6211\u7684\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=pn3DndyqqMVJfmGxRb7UAQ%3D%3D.6MSsLSm%2BC%2BGcy6%2B80zPamB9ztjY0D0vkgfY9PwkFOQ%2FJzzaaDeskNLeQVSE8MVVsYl%2FgaYmJbRGx0dMzKivmsEOuiQxjmr1fiTLVwK2U1nKeJd1wVyui1o8HQRxLW7aelLVOqSSrh7Atv30ov0AMrw%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/github.com\/hanyun2019\/bedrock-in-practice\/blob\/main\/llama32-multimodal-diabetes-1.ipynb?trk=cndc-detail<\/a><\/p>\n<p>\u5728\u4ee5\u4e0a\u5b8c\u6574\u4ee3\u7801\u4e2d\uff0c\u6211\u8fd8\u4e0a\u4f20\u6d4b\u8bd5\u4e86\u7b2c\u4e8c\u5f20\u8f93\u5165\u7684\u56fe\u50cf\uff1a\u4e9a\u6d32\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u5206\u5e03\u60c5\u51b5\u56fe\uff0c\u4f9b Meta Llama 3.2 90B Instruct \u6a21\u578b\u8fdb\u884c\u8fdb\u4e00\u6b65\u5206\u6790\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"742\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdfQOd\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=8iS7YT%2FxkCzpfIdFfCur%2FQ%3D%3D.73NRtRcCboE%2Bqi9UWWoUAoFzuloR3v2FnhhOoLENQPjMJH0unN8quMfP1VVuFpwgFwMe2uQW0UokLPE%2FxwroPU%2BrkJ5q6FaYjeZkfOPHuts%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/ourworldindata.org\/grapher\/diabetes-prevalence?trk=cn&#8230;<\/a><\/p>\n<p>\u7ec6\u5fc3\u7684\u5f00\u53d1\u8005\u4e5f\u53ef\u4ee5\u627e\u5230\u4f60\u5750\u5728\u7684\u6d32\u9645\u6570\u636e\u56fe\u8868\uff0c\u4ee5\u8fdb\u4e00\u6b65\u63a2\u7d22\u8fd9\u4e2a\u8bdd\u9898\u3002<\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u6f14\u793a\u4e86\u5982\u4f55\u5229\u7528 Amazon Bedrock \u4e0a Meta Llama 3.2 90B Instruct \u6a21\u578b\u7684\u591a\u6a21\u6001\u80fd\u529b,\u6765\u6d1e\u5bdf\u5168\u7403\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u3002\u901a\u8fc7\u5229\u7528\u8fd9\u79cd\u5148\u8fdb\u7684\u5927\u578b\u591a\u6a21\u6001\u6a21\u578b\uff0c\u6211\u4eec\u80fd\u591f\u540c\u65f6\u5206\u6790\u6587\u672c\u6570\u636e\u548c\u53ef\u89c6\u5316\u6570\u636e\uff0c\u6839\u636e\u63d0\u4f9b\u7684\u56fe\u8868\u6765\u786e\u5b9a\u5168\u7403\u7cd6\u5c3f\u75c5\u60a3\u75c5\u7387\u6700\u9ad8\u7684\u524d 10 \u4e2a\u56fd\u5bb6\u6216\u5730\u533a\u3002<\/p>\n<p>Meta Llama 3.2 90B Instruct \u6a21\u578b\u5728\u5404\u79cd\u57fa\u51c6\u6d4b\u8bd5\u4e2d\u8868\u73b0\u5353\u8d8a\uff0c\u5c24\u5176\u5728\u56fe\u8868\u7406\u89e3\u7b49\u9886\u57df\uff0c\u975e\u5e38\u9002\u5408\u8fd9\u79cd\u591a\u6a21\u6001\u5206\u6790\u4efb\u52a1\u3002\u5728 Amazon Bedrock \u4e0a\u8fd0\u884c\u8be5\u6a21\u578b\uff0c\u8fd8\u80fd\u591f\u66f4\u9ad8\u6548\u5730\u5904\u7406\u6570\u636e\u5e76\u751f\u6210\u51c6\u786e\u7684\u6d1e\u89c1\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u5b9e\u9645\u6848\u4f8b\uff0c\u6211\u4eec\u5c55\u793a\u4e86\u5c06\u5148\u8fdb\u7684\u5927\u6a21\u578b\u4e0e\u591a\u6a21\u6001\u6570\u636e\u76f8\u7ed3\u5408\uff0c\u6765\u89e3\u51b3\u533b\u7597\u5206\u6790\u7b49\u9886\u57df\u590d\u6742\u73b0\u5b9e\u95ee\u9898\u7684\u6f5c\u529b\u3002\u968f\u7740\u5927\u6a21\u578b\u591a\u6a21\u6001\u80fd\u529b\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u4ece\u5404\u79cd\u6570\u636e\u6e90\u4e2d\u83b7\u53d6\u66f4\u6df1\u5165\u7684\u6d1e\u89c1\uff0c\u4e3a\u5404\u884c\u4e1a\u5e26\u6765\u5f71\u54cd\u6df1\u8fdc\u7684\u5168\u65b0\u89e3\u51b3\u65b9\u6848\uff0c\u5c06\u5b55\u80b2\u51fa\u66f4\u591a\u65b0\u7684\u5e02\u573a\u673a\u9047\u3002<\/p>\n<h3>\u53c2\u8003\u6587\u732e<\/h3>\n<ol>\n<li>The Llama 3 Herd of Models<\/li>\n<\/ol>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=jVUIHp9jV2mKJaVOxTNR8w%3D%3D.JHWdMj4tDCyjcQghKzzZzUGNq5AnU4UiS3YaWgAaKqZvhHLZoNmO62DTMHb4e48CP9RQfEZj7MyoUQQugvVCje7Tn8htjlXBGSAq9GhzWV%2BywdyU%2FNOZ6mzumhVoX0Kv\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/ai.meta.com\/research\/publications\/the-llama-3-herd-of&#8230;<\/a><\/p>\n<ol start=\"2\">\n<li>Introducing Llama 3.2 models from Meta in Amazon Bedrock<\/li>\n<\/ol>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=QJyZq6o0oy1uSgk%2FLKjNgg%3D%3D.Sj3ZdKD0bsfDomAVNktgQQZk5R%2Bqegeez4nmyDXEM%2Fx9aiWVMxH2eLvHSxh9bNvyn42%2BjUhiFodLBW%2BnCUyVN6LbTwYKYWor246jv8FWpMMowPlXj8x1zV8LVyo%2FFPapPgw8q%2BZnWj2rquIRyMA4mIdsUB0Crx2w4m6%2FOdDl019Wxl%2B6k4uWOlghYIJqWFu1Peugk4u9%2FXBFtqng6rk2oWMu1%2B4pxtVuJYsptC3owvo%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/aws.amazon.com\/blogs\/aws\/introducing-llama-3-2-models&#8230;<\/a><\/p>\n<ol start=\"3\">\n<li>Vision use cases with Llama 3.2 11B and 90B models from Meta<\/li>\n<\/ol>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=xyl7Lu7CSZ4foTGnGO0xjg%3D%3D.4p9QHPzCMXWcRV%2By3WpOwyrVtD6zvZBkXaX1ttXaZLsx1xOcx%2FiDGo8aCbEsqkBzz%2BPqWR%2BhtbU3mTasE0gOO%2B5ds5cMWit6lNjfAJlmDZK336Lv2wjbbgpYUqDCTadld0%2BVV4vZAJeIuKv%2BXE24GRRmGfujGjtSsaFR86h0Tng%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/aws.amazon.com\/blogs\/machine-learning\/vision-use-case&#8230;<\/a><\/p>\n<h3>\u8bf4\u660e<\/h3>\n<p>\u672c\u6587\u7684\u5c01\u9762\u56fe\u7247\u7531 Amazon Bedrock \u4e0a\u7684 SDXL 1.0 \u6a21\u578b\u751f\u6210\u3002\u7ed9\u5b9a\u7684\u8f93\u5165\u63d0\u793a\u8bcd\u662f\uff1a<\/p>\n<p>\u201cA developer with a laptop and a diabetes scientist, sitting in a caf\u00e9, developer with a laptop, excitedly discussing Leveraging generative AI for diabetes prevalence analysis, comic, graphic illustration, comic art, graphic novel art, vibrant, highly detailed, colored, 2d\u201d<\/p>\n<blockquote><p>*\u524d\u8ff0\u7279\u5b9a\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u751f\u6210\u5f0f\u4eba\u5de5\u667a\u80fd\u76f8\u5173\u7684\u670d\u52a1\u4ec5\u5728\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u6d77\u5916\u533a\u57df\u53ef\u7528\uff0c\u4e9a\u9a6c\u900a\u4e91\u79d1\u6280\u4e2d\u56fd\u4ec5\u4e3a\u5e2e\u52a9\u60a8\u4e86\u89e3\u884c\u4e1a\u524d\u6cbf\u6280\u672f\u548c\u53d1\u5c55\u6d77\u5916\u4e1a\u52a1\u9009\u62e9\u63a8\u4ecb\u8be5\u670d\u52a1\u3002<\/p><\/blockquote>\n<p>\u6587\u7ae0\u6765\u6e90\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=aVpIqDtTZzDrMSYrF7DFLg%3D%3D.fTPqk%2BdZMggEkkDaOsYgnDTje3YzNRkVMH3jegldY4TZeCcdMMWtawu16OYc1YOO%2FCRlnP3Dk3GFnDXMWSIsx1NbLNxFC5mn0PRslDDDHwxiRLsbGa%2FitIpDmVnHWmkdQHEKbVqtIY3UkA108J3FutRWCIw%2BHR91opVCdSkA5yVWzYUYx%2FoxnZ8wX1vcMBMg\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/dev.amazoncloud.cn\/column\/article\/676e9ac457ce58339e3&#8230;<\/a><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000045684581\">https:\/\/segmentfault.com\/a\/1190000045684581<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9ec4\u6d69\u6587 \u8d44\u6df1\u5f00\u53d1\u8005\u5e03\u9053\u5e08 \u4e9a\u9a6c\u900a\u4e91\u79d1\u6280 \u62e5\u6709\u7535\u4fe1\u3001\u4e92\u8054\u7f51\u4ee5\u53ca\u4e91\u8ba1\u7b97\u7b49\u884c\u4e1a\u8d85\u8fc7 20 \u5e74\u7684\u4e30\u5bcc\u7ecf\u9a8c\uff0c\u66fe\u4efb\u804c\u4e8e\u5fae\u8f6f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020559","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020559"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020559\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}