id: e223e39992a34f90bddc929ef98285a8
parent_id: 
item_type: 1
item_id: 0eee00b430ae49ba97907686c657f032
item_updated_time: 1764345505400
title_diff: "[{\"diffs\":[[1,\"Llama 3.2 本地部署教程 ，11B模型、支持视觉、图片识别功能！-零度博客\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":41}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>Llama 3.2 本地部署教程 ，11B模型、支持视觉、图片识别功能！-零度博客</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"32896\\\"></a>\\\r\\\n<h1>Llama 3.2 本地部署教程 ，11B模型、支持视觉、图片识别功能！-零度博客</h1>\\\r\\\n\\\r\\\n<div><span>\\\n  <div style=\\\"--en-clipped-content:article\\\"><div style=\\\"font-size: 16px; display:block; min-width: 100%; position: relative;\\\"> <div style=\\\"font-family:sans-serif;text-size-adjust:100%;box-sizing:border-box;font-size:10px;-webkit-tap-highlight-color:transparent;outline:0px;\\\"><div style=\\\"box-sizing:border-box;font-family:&quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size:14px;line-height:1.42857;color:rgb(78, 83, 88);background-color:rgb(245, 246, 247);outline:0px;\\\"><span style=\\\"box-sizing:border-box;outline:0px;\\\"><div style=\\\"box-sizing:border-box;outline:0px;\\\"><div style=\\\"box-sizing:border-box;outline:0px;\\\"><div style=\\\"box-sizing:border-box;transition:box-shadow 0.3s;box-shadow:rgba(116, 116, 116, 0.08) 0px 0px 10px 0px;background:rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box;border-radius:8px;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;outline:0px;\\\">\\\n                        <div style=\\\"box-sizing:border-box;margin-bottom:20px;line-height:2;font-size:16px;min-height:90px;outline:0px;\\\">\\\n            <h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\"><a style=\\\"background-color:transparent;box-sizing:border-box;text-decoration:none;color:rgb(240, 68, 148);transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\"><img src=\\\":/e669fe5015194ac39626c1f787050389\\\" type=\\\"image/webp\\\" data-filename=\\\"20240929145820-768x460.webp\\\" height=\\\"700\\\" style=\\\"border:0px;box-sizing:border-box;vertical-align:middle;max-height:100%;clear:both;height:auto;max-width:100%;display:table;margin:auto;outline:0px;\\\" width=\\\"1168\\\"/></a></h3>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\"></h3>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\"> Llama 3.2  11B 视觉模型下载方式</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">1、<span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\"><span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\"><span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\">Hugging Face下载：</span><span style=\\\"box-sizing:border-box;outline:0px;color:#000000;\\\">【</span><span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><a href=\\\"https://huggingface.co/meta-llama/Llama-3.2-11B-Vision\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\">点击前往</a></span><span style=\\\"box-sizing:border-box;outline:0px;color:#000000;\\\">】</span> <span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\">从</span></strong></span>模型库下载Llama 3.2 11B的模型文件。</span>模型文件可以通过API或者手动下载。</p>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\">2、</strong><span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\">其它打包下载</strong></span>：【<span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\"><a href=\\\"https://www.dongli7.com/thread-91-1-1.html\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\">点击前往</a></strong></span>】</p>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"> </p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">1. 安装Python和pip</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">首先，确保你已经安装了Python 3.8或以上版本。如果还没有，可以通过以下步骤安装。</p>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">下载Python：</h4>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">从<span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><a href=\\\"https://www.python.org/downloads/\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\" target=\\\"_new\\\">Python官网</a></span>下载适用于Windows的最新版本Python。安装时，确保勾选“Add Python to PATH”选项，以便命令行可以直接使用Python。</p>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">检查Python和pip是否安装成功：</h4>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">python --version</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">2.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">pip --version</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">如果成功，会显示Python和pip的版本号。</p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">2. 安装CUDA和PyTorch</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">比如使用 RTX 4090进行加速，需要安装支持CUDA的PyTorch版本。</p>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">安装CUDA</h4>\\\n<ol style=\\\"box-sizing:border-box;padding:0px;list-style:decimal;padding-left:15px;margin:10px 0px 20px 15px;outline:0px;\\\">\\\n<li style=\\\"box-sizing:border-box;margin-bottom:10px;outline:0px;\\\">下载并安装<span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><a href=\\\"https://developer.nvidia.com/cuda-downloads\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\" target=\\\"_new\\\">CUDA工具包</a></span>（确保与你的显卡型号兼容）。</li>\\\n<li style=\\\"box-sizing:border-box;margin-bottom:10px;outline:0px;\\\">安装NVIDIA cuDNN（CUDA的深度学习库）。</li>\\\n</ol>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">安装支持CUDA的PyTorch：</h4>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">打开命令提示符并运行以下命令，安装支持CUDA 11.8的PyTorch：</p>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">pip install torch torchvision torchaudio --index-url https:</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\">//download.pytorch.org/whl/cu118</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">这会安装带有GPU加速功能的PyTorch版本，确保充分利用RTX 4090的计算性能。</p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">3. 安装Llama 3.2 11B模型相关依赖</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">接下来，你需要安装Transformers库以及其他依赖项，用来加载Llama 3.2模型。</p>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">安装Transformers和其他依赖：</h4>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">pip install transformers</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">2.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">pip install sentencepiece  </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># Llama模型所需的分词工具</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">4. 下载和配置Llama 3.2 11B模型</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">1、<span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\">从<span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\"><a href=\\\"https://huggingface.co/meta-llama/Llama-3.2-11B-Vision\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\">Hugging Face</a></strong></span>模型库下载Llama 3.2 11B的模型文件。</span>模型文件可以通过API或者手动下载。</p>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"><span style=\\\"box-sizing:border-box;outline:0px;color:#ff0000;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\">2、网盘打包下载</strong></span>：【<span style=\\\"box-sizing:border-box;outline:0px;color:#0000ff;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\"><a href=\\\"https://www.dongli7.com/thread-91-1-1.html\\\" style=\\\"background-color:transparent;box-sizing:border-box;color:#0000ff;text-decoration:none;transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\">点击前往</a></strong></span>】</p>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">加载Llama 3.2 11B模型</h4>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">你可以使用以下代码下载并加载模型：</p>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">from transformers import LlamaTokenizer, LlamaForCausalLM</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">2.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">3.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 下载并加载Llama 3.2 11B模型</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">4.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">tokenizer = LlamaTokenizer.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">from_pretrained</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;path_to_llama_3_2_11b_model&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">5.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">model = LlamaForCausalLM.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">from_pretrained</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;path_to_llama_3_2_11b_model&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">to</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;cuda&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">请确保将<code style=\\\"font-size: 9pt; color: rgb(51, 51, 51); font-family: Monaco,Menlo,Consolas,Courier New,monospace,sans-serif\\\">path_to_llama_3_2_11b_model</code>替换为实际的模型路径或模型ID。</p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">5. 安装Gradio并创建UI</h3>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">安装Gradio</h4>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">pip install gradio</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<h4 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:16px;outline:0px;\\\">创建Gradio界面</h4>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">在Windows系统上，你可以创建一个Gradio界面，让用户可以通过浏览器与Llama 3.2 11B模型交互：</p>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">import gradio as gr</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">2.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">from transformers import LlamaTokenizer, LlamaForCausalLM</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">3.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">import torch</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">4.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">from PIL import Image</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">5.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">6.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 加载Llama 3.2 11B模型</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">7.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">tokenizer = LlamaTokenizer.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">from_pretrained</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;path_to_llama_3_2_11b_model&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">8.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">model = LlamaForCausalLM.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">from_pretrained</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;path_to_llama_3_2_11b_model&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">to</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;cuda&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">9.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">10.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 定义推理函数，处理图片和文本</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">11.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-weight:700;font-size:1.25em;outline:0px;\\\">def</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">llama_generate</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">image, text</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">:</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">12.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">    </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 假设处理图像功能在此</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">13.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">    </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 可以在这里加载图像模型并处理图片</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">14.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">    input_ids = </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">tokenizer</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">text, return_tensors=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;pt&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">input_ids</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">cuda</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">()</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">15.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">    output = model.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">generate</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">input_ids, max_length=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(189, 147, 249);font-size:1.25em;outline:0px;\\\">200</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">16.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">    </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-weight:700;font-size:1.25em;outline:0px;\\\">return</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"> tokenizer.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">decode</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">output, skip_special_tokens=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-weight:700;font-size:1.25em;outline:0px;\\\">True</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">17.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">18.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 使用Gradio构建UI，添加图片和文本输入</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">19.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">demo = gr.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">Interface</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">fn=llama_generate, </span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">20.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">                    inputs=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">[</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;image&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">, </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;text&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">]</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">, </span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">21.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">                    outputs=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;text&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">, </span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">22.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">                    title=</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;Llama 3.2 11B 模型（图片+文本）&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">23.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">24.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(98, 114, 164);font-size:1.25em;outline:0px;\\\"># 启动界面</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\"></span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">25.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">demo.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">launch</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">()</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"> </p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">6. 启动Gradio应用</h3>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">保存上面的脚本为 <code style=\\\"font-size: 9pt; color: rgb(51, 51, 51); font-family: Monaco,Menlo,Consolas,Courier New,monospace,sans-serif\\\">llama_gradio_app.py</code>，然后在命令提示符中运行以下命令：</p>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">python llama_gradio_app.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">py</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\">Gradio将在命令行中生成一个URL，你可以通过这个URL在浏览器中访问Gradio界面，并与Llama 3.2 11B模型进行交互。</p>\\\n<h3 style=\\\"box-sizing:border-box;font-family:inherit;line-height:1.1;color:inherit;margin:20px 0px;font-weight:700;font-size:18px;outline:0px;\\\">7. 可选优化</h3>\\\n<ul style=\\\"box-sizing:border-box;padding:0px;list-style:disc;padding-left:15px;margin:10px 0px 20px 15px;outline:0px;\\\">\\\n<li style=\\\"box-sizing:border-box;margin-bottom:0px;outline:0px;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\">GPU加速</strong>：确保模型在GPU上运行。你可以通过以下代码将模型加载到GPU中：</li>\\\n</ul>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"> </p>\\\n<div style=\\\"box-sizing:border-box;font-family:&quot;Source Code Pro&quot;, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, Courier, monospace;font-size:12px;line-height:1.35em;white-space:pre-wrap;overflow-wrap:break-word;margin:0px 0px 20px;padding:0px;position:relative;text-align:left;direction:ltr;display:block;background-color:rgb(40, 42, 54);outline:0px;\\\"><div style=\\\"box-sizing:border-box;overflow:hidden;outline:0px;\\\"><div style=\\\"box-sizing:border-box;scrollbar-width:thin;display:table;width:100%;border-collapse:collapse;border-spacing:0px;empty-cells:show;min-width:100%;font-size:1em;margin:0px;padding:0px;text-indent:0px;outline:0px;\\\"><div style=\\\"box-sizing:border-box;display:table-row;margin:0px;border:0px solid rgb(255, 255, 255);list-style:none;font-size:inherit;min-height:14px;padding:1px 5px 1px 14px;color:rgb(98, 114, 164);background-color:rgb(40, 42, 54);line-height:1.6em;padding-top:5px;padding-bottom:5px;outline:0px;\\\"><span style=\\\"list-style:none;font-size:1em;line-height:1.6em;color:rgb(98, 114, 164);white-space:nowrap;display:table-cell;width:45px;min-width:45px;text-align:right;padding-right:8px;\\\">1.</span><div style=\\\"box-sizing:border-box;display:table-cell;padding-left:10px;outline:0px;\\\"><span style=\\\"\\\"> </span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-size:1.25em;outline:0px;\\\">model = model.</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(139, 233, 253);font-size:1.25em;outline:0px;\\\">to</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">(</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(241, 250, 140);font-size:1.25em;outline:0px;\\\">&quot;cuda&quot;</span><span style=\\\"box-sizing:border-box;margin:0px;padding:0px;line-height:inherit;font-family:inherit;color:rgb(248, 248, 242);font-weight:700;font-size:1.25em;outline:0px;\\\">)</span></div><span style=\\\"list-style:none;font-size:inherit;line-height:1.6em;color:rgb(98, 114, 164);\\\"> </span></div></div></div></div>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"><strong style=\\\"font-weight:700;box-sizing:border-box;outline:0px;\\\">调优生成结果</strong>：可以通过修改<code style=\\\"font-size: 9pt; color: rgb(51, 51, 51); font-family: Monaco,Menlo,Consolas,Courier New,monospace,sans-serif\\\">generate</code>函数中的<code style=\\\"font-size: 9pt; color: rgb(51, 51, 51); font-family: Monaco,Menlo,Consolas,Courier New,monospace,sans-serif\\\">max_length</code>参数来控制生成文本的长度。</p>\\\n<p style=\\\"box-sizing:border-box;margin:0px 0px 10px;margin-bottom:20px;overflow-wrap:break-word;outline:0px;\\\"><a style=\\\"background-color:transparent;box-sizing:border-box;text-decoration:none;color:rgb(240, 68, 148);transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\"><img src=\\\":/24a59ed02ee94588811df42abb2d2ec9\\\" type=\\\"image/webp\\\" data-filename=\\\"20240929163734-768x432.webp\\\" height=\\\"1035\\\" style=\\\"border:0px;box-sizing:border-box;vertical-align:middle;max-height:100%;clear:both;height:auto;max-width:100%;display:table;margin:auto;outline:0px;\\\" width=\\\"1840\\\"/></a><br style=\\\"box-sizing:border-box;outline:0px;\\\"/>\\\n<a style=\\\"background-color:transparent;box-sizing:border-box;text-decoration:none;color:rgb(240, 68, 148);transition:color 0.2s, background 0.3s, opacity 0.3s, box-shadow 0.3s, transform 0.3s;cursor:pointer;outline:0px;\\\"><img src=\\\":/965b61cb07e6451ca08809798cba30ff\\\" type=\\\"image/webp\\\" data-filename=\\\"20240929163732-768x432.webp\\\" height=\\\"1035\\\" style=\\\"border:0px;box-sizing:border-box;vertical-align:middle;max-height:100%;clear:both;height:auto;max-width:100%;display:table;margin:auto;outline:0px;\\\" width=\\\"1840\\\"/></a></p>\\\n                    </div>\\\n        <div style=\\\"box-sizing:border-box;color:rgb(177, 177, 177);font-size:0.9em;outline:0px;\\\"><div style=\\\"box-sizing:border-box;outline:0px;\\\"><span style=\\\"box-sizing:border-box;outline:0px;\\\">©</span> 版权声明</div><div style=\\\"box-sizing:border-box;outline:0px;\\\">文章版权归作者所有，未经允许请勿转载。</div></div><div style=\\\"box-sizing:border-box;color:rgb(177, 177, 177);font-size:0.9em;margin-bottom:20px;padding:15px;display:flex;justify-content:center;align-items:center;text-align:center;outline:0px;\\\"><span style=\\\"text-align:center;color:rgb(177, 177, 177);font-size:0.9em;background:var(--main-border-color);max-width:20%;height:1px;margin:0px 1em;flex:1 1 0%;\\\"></span>THE END<span style=\\\"text-align:center;color:rgb(177, 177, 177);font-size:0.9em;background:var(--main-border-color);max-width:20%;height:1px;margin:0px 1em;flex:1 1 0%;\\\"></span></div><div style=\\\"box-sizing:border-box;margin-bottom:20px;outline:0px;\\\"><a href=\\\"https://www.freedidi.com/category/ai\\\" style=\\\"box-sizing:border-box;text-decoration:none;cursor:pointer;display:inline-block;border:0.666667px solid rgba(0, 0, 0, 0);vertical-align:middle;text-align:center;font-weight:400;box-shadow:none;background:rgba(41, 151, 247, 0.1) none repeat scroll 0% 0% / auto padding-box border-box;text-shadow:0px 0px 0px;line-height:1.44;transition:0.15s;color:rgb(41, 151, 247);border-radius:50px;padding:0.3em 1em;font-size:12px;margin:3px;outline:0px;\\\" title=\\\"查看更多分类文章\\\"><i style=\\\"box-sizing:border-box;display:inline-block;font-style:normal;font-variant:normal;font-size-adjust:none;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-weight:normal;font-stretch:normal;line-height:1;font-family:FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;margin-right:0.25em;outline:0px;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>AI</a><a href=\\\"https://www.freedidi.com/category/%e5%85%8d%e8%b4%b9%e8%b5%84%e6%ba%90\\\" style=\\\"box-sizing:border-box;text-decoration:none;cursor:pointer;display:inline-block;border:0.666667px solid rgba(0, 0, 0, 0);vertical-align:middle;text-align:center;font-weight:400;box-shadow:none;background:rgba(255, 111, 6, 0.1) none repeat scroll 0% 0% / auto padding-box border-box;text-shadow:0px 0px 0px;line-height:1.44;transition:0.15s;color:rgb(255, 111, 6);border-radius:50px;padding:0.3em 1em;font-size:12px;margin:3px;outline:0px;\\\" title=\\\"查看更多分类文章\\\"><i style=\\\"box-sizing:border-box;display:inline-block;font-style:normal;font-variant:normal;font-size-adjust:none;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-weight:normal;font-stretch:normal;line-height:1;font-family:FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;margin-right:0.25em;outline:0px;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>免费资源</a><br style=\\\"box-sizing:border-box;outline:0px;\\\"/></div>    </div></div></div></div></span></div></div></div></div>\\\n</span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":72164}]"
metadata_diff: {"new":{"id":"0eee00b430ae49ba97907686c657f032","parent_id":"061de1401cfc4cfaadf6e74e015970e9","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764345732853,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T16:12:46.384Z
created_time: 2025-11-28T16:12:46.384Z
type_: 13