import{s as Nt,n as Vt,o as vt}from"../chunks/scheduler.1f027d5a.js";import{S as Ht,i as Qt,e as n,s as a,c as j,h as Yt,a as p,d as t,b as M,f as Et,g as J,j as i,k as Ps,l as _t,m as e,n as o,t as y,o as r,p as T}from"../chunks/index.6117a65d.js";import{C as zt}from"../chunks/CopyLLMTxtMenu.0ff8411a.js";import{D as Ft,C as U}from"../chunks/DocNotebookDropdown.316c3715.js";import{H as c,E as St}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0eecd2bb.js";function $t(Ks){let w,Wl,kl,El,d,Nl,I,Vl,h,vl,u,Os='<em>作者: <a href="https://huggingface.co/MoritzLaurer" rel="nofollow">Moritz Laurer</a></em>',Hl,b,lt="本 Notebook 展示了系统地评估大型语言模型（LLM）输出并创建 LLM 训练数据的工作流程。你可以通过使用本 Notebook 评估你最喜爱的 LLM 在没有任何微调的情况下在特定任务上的零样本性能。如果你希望提高性能，你可以轻松地重用此工作流程来创建训练数据。",Ql,g,st="<strong>示例用例：代码生成。</strong> 在本教程中，我们展示了如何为代码生成任务创建高质量的测试和训练数据。然而，相同的工作流程也可以适应其他与你特定用例相关的任务。",Yl,C,tt="<strong>在本 Notebook 中，我们将进行以下步骤：</strong>",_l,A,et="<li>下载示例任务的数据。</li> <li>提示两个 LLM 对这些任务作出响应。这将生成“合成数据”以加速手动数据创建。</li> <li>在 HF Spaces 上创建一个 Argilla 标注界面，以比较和评估两个 LLM 的输出。</li> <li>将示例数据和零样本 LLM 的响应上传到 Argilla 标注界面。</li> <li>下载已标注的数据。</li>",zl,f,at="你可以根据自己的需求调整本 Notebook，例如在步骤 (2) 使用不同的 LLM 和 API 提供商，或在步骤 (3) 调整标注任务。",Fl,G,Sl,B,$l,Z,xl,R,ql,k,Mt='首先，我们下载一个包含 LLM 代码生成任务的示例数据集。我们希望评估两个不同的 LLM 在这些代码生成任务上的表现。我们使用来自 <a href="https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k" rel="nofollow">bigcode/self-oss-instruct-sc2-exec-filter-50k</a> 数据集的指令，该数据集用于训练 <a href="https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1" rel="nofollow">StarCoder2-Instruct</a> 模型。',Ll,X,Dl,W,nt="Dataset structure:\n Dataset(&#123;\n    features: ['fingerprint', 'sha1', 'seed', 'response', 'concepts', 'prompt', 'instruction', 'id'],\n    num_rows: 3\n}) \n\nExample instructions:\n ['Write a Python function named `get_value` that takes a matrix (represented by a list of lists) and a tuple of indices, and returns the value at that index in the matrix. The function should handle index out of range errors by returning None.', 'Write a Python function `check_collision` that takes a list of `rectangles` as input and checks if there are any collisions between any two rectangles. A rectangle is represented as a tuple (x, y, w, h) where (x, y) is the top-left corner of the rectangle, `w` is the width, and `h` is the height.\\n\\nThe function should return True if any pair of rectangles collide, and False otherwise. Use an iterative approach and check for collisions based on the bounding box collision detection algorithm. If a collision is found, return True immediately without checking for more collisions.']\n",Pl,E,Kl,N,Ol,V,pt='在将指令发送到 LLM API 之前，我们需要使用正确的 <code>chat_template</code> 格式化指令，以便对每个需要评估的模型进行适配。这实际上是指在指令周围加上特殊的标记。有关 <code>chat_template</code> 的详细信息，请参阅 <a href="https://huggingface.co/docs/transformers/main/en/chat_templating" rel="nofollow">文档</a>。',ls,v,ss,H,it=`First prompt formatted for mistralai/Mixtral-8x7B-Instruct-v0.1:

 <s>[INST] Write a Python function named \`get_value\` that takes a matrix (represented by a list of lists) and a tuple of indices, and returns the value at that index in the matrix. The function should handle index out of range errors by returning None. [/INST] 


First prompt formatted for meta-llama/Meta-Llama-3-70B-Instruct:

 &lt;|begin_of_text|&gt;&lt;|start_header_id|&gt;user&lt;|end_header_id|&gt;

Write a Python function named \`get_value\` that takes a matrix (represented by a list of lists) and a tuple of indices, and returns the value at that index in the matrix. The function should handle index out of range errors by returning None.&lt;|eot_id|&gt;&lt;|start_header_id|&gt;assistant&lt;|end_header_id|&gt;
</s>`,ts,Q,es,Y,jt='现在，我们可以将指令发送到两个 LLM 的 API，以获取可以评估的输出。首先，我们需要定义一些参数，以确保正确生成响应。Hugging Face 的 LLM API 由 <a href="https://huggingface.co/docs/text-generation-inference/index" rel="nofollow">文本生成推理 (TGI)</a> 容器提供支持。有关 TGI OpenAPI 规范，请参见 <a href="https://huggingface.github.io/text-generation-inference/#/Text%20Generation%20Inference/generate" rel="nofollow">此处</a>，并可参考 Transformers 生成参数的详细说明 <a href="https://huggingface.co/docs/transformers/v4.30.0/main_classes/text_generation#transformers.GenerationConfig" rel="nofollow">文档</a>。',as,_,Ms,z,Jt='现在，我们可以向 Serverless 推理 API 发出标准的 API 请求 (<a href="https://huggingface.co/docs/api-inference/index" rel="nofollow">文档</a>)。需要注意的是，Serverless 推理 API 主要用于测试，并且有速率限制。如果需要在没有速率限制的情况下进行测试，可以通过 Hugging Face 专用端点创建自己的 API (<a href="https://huggingface.co/docs/inference-endpoints/index" rel="nofollow">文档</a>)。另外，你还可以参考我们的相关教程，了解更多关于推理 API 的使用，详见 <a href="https://huggingface.co/learn/cookbook/index" rel="nofollow">开源 AI 指南</a>。',ns,m,ot=`<p><br/>
一旦推理 API 示例完成，下面的代码将会更新。</p>`,ps,F,is,S,yt=`---First generation of mistralai/Mixtral-8x7B-Instruct-v0.1:
Here's a Python function that meets your requirements:

\`\`\`python
def get_value(matrix, indices):
    try:
        return matrix[indices[0]][indices[1]]
    except IndexError:
        return None
\`\`\`

This function takes a matrix (represented by a list of lists) and a tuple of indices as input. It first tries to access the value at the given indices in the matrix. If the indices are out of range, it catches the \`IndexError\` exception and returns \`None\`.


---First generation of meta-llama/Meta-Llama-3-70B-Instruct:
Here is a Python function that does what you described:
\`\`\`
def get_value(matrix, indices):
    try:
        row, col = indices
        return matrix[row][col]
    except IndexError:
        return None
\`\`\`
Here's an explanation of how the function works:

1. The function takes two arguments: \`matrix\` (a list of lists) and \`indices\` (a tuple of two integers, representing the row and column indices).
2. The function tries to access the value at the specified indices using \`matrix[row][col]\`.
3. If the indices are out of range (i.e., \`row\` or \`col\` is greater than the length of the corresponding dimension of the matrix), an \`IndexError\` exception is raised.
4. The \`except\` block catches the \`IndexError\` exception and returns \`None\` instead of raising an error.

Here's an example usage of the function:
\`\`\`
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

print(get_value(matrix, (0, 0)))  # prints 1
print(get_value(matrix, (1, 1)))  # prints 5
print(get_value(matrix, (3, 0)))  # prints None (out of range)
print(get_value(matrix, (0, 3)))  # prints None (out of range)
\`\`\`
I hope this helps! Let me know if you have any questions.
`,js,$,Js,x,rt="现在，我们可以将 LLM 的输出与原始指令一起存储在一个数据集中。",os,q,ys,L,rs,D,Tt='我们使用 <a href="https://argilla.io/" rel="nofollow">Argilla</a>，这是一个为 AI 工程师和领域专家设计的协作工具，用于构建高质量的数据集以支持他们的项目。',Ts,P,ct='我们通过 HF Space 运行 Argilla，你可以通过几次点击便能设置好，无需进行本地配置。你可以按照 <a href="https://docs.argilla.io/latest/getting_started/quickstart/" rel="nofollow">这些指引</a> 创建 HF Argilla Space。有关 HF Argilla Spaces 的更多配置，请参阅详细的 <a href="https://docs.argilla.io/latest/getting_started/how-to-configure-argilla-on-huggingface/" rel="nofollow">文档</a>。如果你希望，也可以通过 Argilla 的 Docker 容器在本地运行 Argilla（参见 <a href="https://docs.argilla.io/latest/getting_started/how-to-deploy-argilla-with-docker/" rel="nofollow">Argilla 文档</a>)。',cs,K,Ut='<img src="https://huggingface.co/datasets/huggingface/cookbook-images/resolve/main/argilla-login-screen.png" alt="Argilla 登录界面"/>',Us,O,ws,ll,wt="在我们定制数据集以适应特定任务并上传将在 UI 中显示的数据之前，我们需要先完成一些设置。",ms,sl,mt="<strong>将此 notebook 连接到 Argilla：</strong> 现在，我们可以将此 notebook 连接到 Argilla，以便程序化地配置你的数据集并上传/下载数据。",ds,tl,Is,el,hs,al,us,Ml,dt="为你的人工标注员编写良好的指南与编写高质量的训练代码一样重要（也是一项具有挑战性的任务）。良好的指南应满足以下标准：",bs,nl,It="<li><strong>简洁明了</strong>：指南应简洁明了，以便那些对任务一无所知的人也能理解。在发布之前，最好请至少一位同事重新阅读指南，确保没有歧义。</li> <li><strong>可重复和明确</strong>：完成标注任务所需的所有信息应包含在指南中。一个常见的错误是，在与选定的标注员沟通时，未能正式解释指南的内容。未来的标注员将无法获取这些信息，如果没有在指南中明确说明，他们可能会以不同于预期的方式完成任务。</li> <li><strong>简短而全面</strong>：指南应尽可能简短，但包含所有必要的信息。标注员通常不会认真阅读冗长的指南，因此请尽量保持简洁，同时确保内容全面。</li>",gs,pl,ht='请注意，编写标注指南是一个迭代过程。建议你自己先做几十个标注，并根据数据中学到的经验来完善指南，然后再将任务分配给他人。随着任务的演变，对指南进行版本管理也很有帮助。有关更多提示，请参见这篇 <a href="https://argilla.io/blog/annotation-guidelines-practices/" rel="nofollow">博客文章</a>。',Cs,il,As,jl,ut="<strong>累积评分 vs. Likert 量表：</strong> 注意，上述指南要求标注员通过为明确的标准加分来进行累积评分。另一种方法是使用 “Likert 量表”，在这种方法中，标注员被要求在一个连续的尺度上对响应进行评分，例如从 1（非常差）到 3（一般）再到 5（非常好）。我们通常推荐使用累积评分，因为它迫使你和标注员将质量标准明确化，而仅仅将响应评分为 “4”（好）是模糊的，不同的标注员可能会对其有不同的解释。",fs,Jl,Gs,ol,bt='现在，我们可以为特定任务创建自己的 <code>code-llm</code> 任务，定义标注所需的字段、问题和元数据。有关如何配置 Argilla 数据集的更多信息，请参阅 <a href="https://docs.argilla.io/latest/how_to_guides/dataset/#create-a-dataset" rel="nofollow">Argilla 文档</a>。',Bs,yl,Zs,rl,gt="运行上述代码后，你将在 Argilla 中看到新的自定义 <code>code-llm</code> 数据集（以及之前可能创建的任何其他数据集）。",Rs,Tl,ks,cl,Ct="此时，数据集仍然为空。让我们使用以下代码加载一些数据。",Xs,Ul,Ws,wl,At="<strong>Argilla 的标注 UI</strong> 将类似于下图所示：",Es,ml,ft='<img src="https://huggingface.co/datasets/huggingface/cookbook-images/resolve/main/argilla-code-llm.png" alt="Argilla UI"/>',Ns,dl,Vs,Il,Gt='就是这样，我们已经创建了 Argilla 数据集，现在可以开始在 UI 中进行标注了！默认情况下，记录会在完成 1 次标注后标记为已完成。查看以下指南，了解如何 <a href="https://docs.argilla.io/latest/how_to_guides/distribution/" rel="nofollow">自动分配标注任务</a> 和 <a href="https://docs.argilla.io/latest/how_to_guides/annotate/" rel="nofollow">在 Argilla 中进行标注</a>。',vs,hl,Bt="<strong>重要提示</strong>：如果你在 HF Space 中使用 Argilla，请确保启用持久存储，以便你的数据安全存储，并且不会在一段时间后被自动删除。对于生产环境，确保在进行任何标注之前就启用持久存储，以避免数据丢失。",Hs,ul,Qs,bl,Zt='标注完成后，你可以从 Argilla 中提取数据，并以任何表格格式在本地存储和处理（详见 <a href="https://docs.argilla.io/latest/how_to_guides/import_export/" rel="nofollow">文档</a>）。你还可以下载数据集的过滤版本（详见 <a href="https://docs.argilla.io/latest/how_to_guides/query/" rel="nofollow">文档</a>）。',Ys,gl,_s,Cl,zs,Al,Fs,fl,Rt="就这样！你已经使用 HF 推理 API 创建了合成 LLM 数据，在 Argilla 中创建了数据集，将 LLM 数据上传到 Argilla，评估/修正了数据，并在标注后将数据以简单的表格格式下载，用于后续使用。",Ss,Gl,kt="我们特别设计了这个流程和界面来支持 <strong>两个主要用例</strong>：",$s,Bl,Xt='<li><strong>评估</strong>：你现在可以简单地使用 <code>score_response_1</code> 和 <code>score_response_2</code> 列中的数值分数来计算哪一个模型整体表现更好。你还可以检查评分非常低或非常高的响应，以进行详细的错误分析。在测试或训练不同模型时，你可以重复使用这个流程，并跟踪不同模型随时间的改进。</li> <li><strong>训练</strong>：在标注足够数据后，你可以从数据中创建训练-测试集，并微调你自己的模型。你可以使用高度评价的响应文本进行监督式微调，利用 <a href="https://huggingface.co/docs/trl/en/sft_trainer" rel="nofollow">TRL SFTTrainer</a>，或者直接使用评分来进行偏好微调技术，如 DPO，使用 <a href="https://huggingface.co/docs/trl/en/dpo_trainer" rel="nofollow">TRL DPOTrainer</a>。有关不同 LLM 微调技术的优缺点，请参见 <a href="https://huggingface.co/docs/trl/en/index" rel="nofollow">TRL 文档</a>。</li>',xs,Zl,Wt='<strong>调整和改进</strong>：许多方面可以进行改进，以便将此流程定制为适应你的特定用例。例如，你可以提示一个 LLM 来评估两个 LLM 输出的结果，指令与人类标注员指南非常相似（“LLM 作为评审” 方法）。这可以帮助进一步加速你的评估流程。请参见我们的 <a href="https://huggingface.co/learn/cookbook/llm_judge" rel="nofollow">LLM 作为评审的示例实现</a> 和我们的整体 <a href="https://huggingface.co/learn/cookbook/index" rel="nofollow">开源 AI 指南</a>，其中包含许多其他创意。',qs,Rl,Ls,Xl,Ds;return d=new Ft({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/zh-CN/enterprise_cookbook_argilla.ipynb"}]}}),I=new zt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),h=new c({props:{title:"数据标注与 Argilla Spaces",local:"数据标注与-argilla-spaces",headingTag:"h1"}}),G=new c({props:{title:"安装需要的包并连接到 HF Hub",local:"安装需要的包并连接到-hf-hub",headingTag:"h2"}}),B=new U({props:{code:"IXBpcCUyMGluc3RhbGwlMjBhcmdpbGxhfiUzRDIuMC4wJTBBIXBpcCUyMGluc3RhbGwlMjB0cmFuc2Zvcm1lcnN+JTNENC40MC4wJTBBIXBpcCUyMGluc3RhbGwlMjBkYXRhc2V0c34lM0QyLjE5LjAlMEEhcGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1Yn4lM0QwLjIzLjI=",highlighted:`!pip install argilla~=<span class="hljs-number">2.0</span><span class="hljs-number">.0</span>
!pip install transformers~=<span class="hljs-number">4.40</span><span class="hljs-number">.0</span>
!pip install datasets~=<span class="hljs-number">2.19</span><span class="hljs-number">.0</span>
!pip install huggingface_hub~=<span class="hljs-number">0.23</span><span class="hljs-number">.2</span>`,wrap:!1}}),Z=new U({props:{code:"JTIzJTIwTG9naW4lMjB0byUyMHRoZSUyMEhGJTIwSHViLiUyMFdlJTIwcmVjb21tZW5kJTIwdXNpbmclMjB0aGlzJTIwbG9naW4lMjBtZXRob2QlMjAlMEElMjMlMjB0byUyMGF2b2lkJTIwdGhlJTIwbmVlZCUyMHRvJTIwZXhwbGljaXRseSUyMHN0b3JlJTIweW91ciUyMEhGJTIwdG9rZW4lMjBpbiUyMHZhcmlhYmxlcyUyMCUwQWltcG9ydCUyMGh1Z2dpbmdmYWNlX2h1YiUwQSFnaXQlMjBjb25maWclMjAtLWdsb2JhbCUyMGNyZWRlbnRpYWwuaGVscGVyJTIwc3RvcmUlMEFodWdnaW5nZmFjZV9odWIubG9naW4oYWRkX3RvX2dpdF9jcmVkZW50aWFsJTNEVHJ1ZSk=",highlighted:`<span class="hljs-comment"># Login to the HF Hub. We recommend using this login method </span>
<span class="hljs-comment"># to avoid the need to explicitly store your HF token in variables </span>
<span class="hljs-keyword">import</span> huggingface_hub
!git config --<span class="hljs-keyword">global</span> credential.helper store
huggingface_hub.login(add_to_git_credential=<span class="hljs-literal">True</span>)`,wrap:!1}}),R=new c({props:{title:"下载示例任务数据",local:"下载示例任务数据",headingTag:"h2"}}),X=new U({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBJTIzJTIwU21hbGwlMjBzYW1wbGUlMjBmb3IlMjBmYXN0ZXIlMjB0ZXN0aW5nJTBBZGF0YXNldF9jb2RldGFzayUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJiaWdjb2RlJTJGc2VsZi1vc3MtaW5zdHJ1Y3Qtc2MyLWV4ZWMtZmlsdGVyLTUwayUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lNUIlM0EzJTVEJTIyKSUwQXByaW50KCUyMkRhdGFzZXQlMjBzdHJ1Y3R1cmUlM0ElNUNuJTIyJTJDJTIwZGF0YXNldF9jb2RldGFzayUyQyUyMCUyMiU1Q24lMjIpJTBBJTBBJTIzJTIwV2UlMjBhcmUlMjBvbmx5JTIwaW50ZXJlc3RlZCUyMGluJTIwdGhlJTIwaW5zdHJ1Y3Rpb25zJTJGcHJvbXB0cyUyMHByb3ZpZGVkJTIwaW4lMjB0aGUlMjBkYXRhc2V0JTBBaW5zdHJ1Y3Rpb25zX2xzdCUyMCUzRCUyMGRhdGFzZXRfY29kZXRhc2slNUIlMjJpbnN0cnVjdGlvbiUyMiU1RCUwQXByaW50KCUyMkV4YW1wbGUlMjBpbnN0cnVjdGlvbnMlM0ElNUNuJTIyJTJDJTIwaW5zdHJ1Y3Rpb25zX2xzdCU1QiUzQTIlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Small sample for faster testing</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset_codetask = load_dataset(<span class="hljs-string">&quot;bigcode/self-oss-instruct-sc2-exec-filter-50k&quot;</span>, split=<span class="hljs-string">&quot;train[:3]&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Dataset structure:\\n&quot;</span>, dataset_codetask, <span class="hljs-string">&quot;\\n&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We are only interested in the instructions/prompts provided in the dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>instructions_lst = dataset_codetask[<span class="hljs-string">&quot;instruction&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Example instructions:\\n&quot;</span>, instructions_lst[:<span class="hljs-number">2</span>])`,wrap:!1}}),E=new c({props:{title:"对示例任务提示两个 LLM 以获取它们的响应。",local:"对示例任务提示两个-llm-以获取它们的响应",headingTag:"h2"}}),N=new c({props:{title:"使用 ch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ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsKSUwQSUwQSUyMCUyMCUyMCUyMHByb21wdF9mb3JtYXR0ZWQlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjBmb3IlMjBpbnN0cnVjdGlvbiUyMGluJTIwaW5zdHJ1Y3Rpb25zX2xzdCUzQSUyMCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb21wdF9mb3JtYXR0ZWQuYXBwZW5kKGZvcm1hdF9wcm9tcHQoaW5zdHJ1Y3Rpb24lMkMlMjB0b2tlbml6ZXIpKSUwQSUyMCUyMCUyMCUyMHByb21wdHNfZm9ybWF0dGVkX2RpYy51cGRhdGUoJTdCbW9kZWwlM0ElMjBwcm9tcHRfZm9ybWF0dGVkJTdEKSUwQSUwQSUwQXByaW50KGYlMjIlNUNuRmlyc3QlMjBwcm9tcHQlMjBmb3JtYXR0ZWQlMjBmb3IlMjAlN0Jtb2RlbHNfdG9fY29tcGFyZSU1QjAlNUQlN0QlM0ElNUNuJTVDbiUyMiUyQyUyMHByb21wdHNfZm9ybWF0dGVkX2RpYyU1Qm1vZGVsc190b19jb21wYXJlJTVCMCU1RCU1RCU1QjAlNUQlMkMlMjAlMjIlNUNuJTVDbiUyMiklMEFwcmludChmJTIyRmlyc3QlMjBwcm9tcHQlMjBmb3JtYXR0ZWQlMjBmb3IlMjAlN0Jtb2RlbHNfdG9fY29tcGFyZSU1QjElNUQlN0QlM0ElNUNuJTVDbiUyMiUyQyUyMHByb21wdHNfZm9ybWF0dGVkX2RpYyU1Qm1vZGVsc190b19jb21wYXJlJTVCMSU1RCU1RCU1QjAlNUQlMkMlMjAlMjIlNUNuJTVDbiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Apply correct chat formatting to instructions from the dataset </span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>models_to_compare = [<span class="hljs-string">&quot;mistralai/Mixtral-8x7B-Instruct-v0.1&quot;</span>, <span class="hljs-string">&quot;meta-llama/Meta-Llama-3-70B-Instruct&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">format_prompt</span>(<span class="hljs-params">prompt, tokenizer</span>):
<span class="hljs-meta">... </span>    messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: prompt}]
<span class="hljs-meta">... </span>    messages_tokenized = tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>, add_generation_prompt=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> messages_tokenized


<span class="hljs-meta">&gt;&gt;&gt; </span>prompts_formatted_dic = {}
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> model <span class="hljs-keyword">in</span> models_to_compare:
<span class="hljs-meta">... </span>    tokenizer = AutoTokenizer.from_pretrained(model)

<span class="hljs-meta">... </span>    prompt_formatted = []
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> instruction <span class="hljs-keyword">in</span> instructions_lst: 
<span class="hljs-meta">... </span>        prompt_formatted.append(format_prompt(instruction, tokenizer))
        
<span class="hljs-meta">... </span>    prompts_formatted_dic.update({model: prompt_formatted})


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;\\nFirst prompt formatted for <span class="hljs-subst">{models_to_compare[<span class="hljs-number">0</span>]}</span>:\\n\\n&quot;</span>, prompts_formatted_dic[models_to_compare[<span class="hljs-number">0</span>]][<span class="hljs-number">0</span>], <span class="hljs-string">&quot;\\n\\n&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;First prompt formatted for <span class="hljs-subst">{models_to_compare[<span class="hljs-number">1</span>]}</span>:\\n\\n&quot;</span>, prompts_formatted_dic[models_to_compare[<span class="hljs-number">1</span>]][<span class="hljs-number">0</span>], <span class="hljs-string">&quot;\\n\\n&quot;</span>)`,wrap:!1}}),Q=new c({props:{title:"将指令发送到 HF 推理 API",local:"将指令发送到-hf-推理-api",headingTag:"h4"}}),_=new U({props:{code:"Z2VuZXJhdGlvbl9wYXJhbXMlMjAlM0QlMjBkaWN0KCUwQSUyMCUyMCUyMCUyMCUyMyUyMHdlJTIwdXNlJTIwbG93JTIwdGVtcGVyYXR1cmUlMjBhbmQlMjB0b3BfcCUyMHRvJTIwcmVkdWNlJTIwY3JlYXRpdml0eSUyMGFuZCUyMGluY3JlYXNlJTIwbGlrZWxpaG9vZCUyMG9mJTIwaGlnaGx5JTIwcHJvYmFibGUlMjB0b2tlbnMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuMiUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC42MCUyQyUwQSUyMCUyMCUyMCUyMHRvcF9rJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHJlcGV0aXRpb25fcGVuYWx0eSUzRDEuMCUyQyUwQSUyMCUyMCUyMCUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDUxMioyJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2Z1bGxfdGV4dCUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwc2VlZCUzRDQyJTJDJTBBJTIwJTIwJTIwJTIwJTIzZGV0YWlscyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjAlMjNzdG9wJTNEJTVCJTIyJTNDJTdDRU5EX09GX1RVUk5fVE9LRU4lN0MlM0UlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjNncmFtbWFyJTNEJTdCJTIydHlwZSUyMiUzQSUyMCUyMmpzb24lMjIlN0QlMEElMjAlMjAlMjAlMjBtYXhfdGltZSUzRE5vbmUlMkMlMjAlMEElMjAlMjAlMjAlMjBzdHJlYW0lM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHVzZV9jYWNoZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwd2FpdF9mb3JfbW9kZWwlM0RGYWxzZSUyQyUwQSk=",highlighted:`generation_params = <span class="hljs-built_in">dict</span>(
    <span class="hljs-comment"># we use low temperature and top_p to reduce creativity and increase likelihood of highly probable tokens</span>
    temperature=<span class="hljs-number">0.2</span>,
    top_p=<span class="hljs-number">0.60</span>,
    top_k=<span class="hljs-literal">None</span>,
    repetition_penalty=<span class="hljs-number">1.0</span>,
    do_sample=<span class="hljs-literal">True</span>,
    max_new_tokens=<span class="hljs-number">512</span>*<span class="hljs-number">2</span>,
    return_full_text=<span class="hljs-literal">False</span>,
    seed=<span class="hljs-number">42</span>,
    <span class="hljs-comment">#details=True,</span>
    <span class="hljs-comment">#stop=[&quot;&lt;|END_OF_TURN_TOKEN|&gt;&quot;],</span>
    <span class="hljs-comment">#grammar={&quot;type&quot;: &quot;json&quot;}</span>
    max_time=<span class="hljs-literal">None</span>, 
    stream=<span class="hljs-literal">False</span>,
    use_cache=<span class="hljs-literal">False</span>,
    wait_for_model=<span class="hljs-literal">False</span>,
)`,wrap:!1}}),F=new U({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHFkbS5hdXRvJTIwaW1wb3J0JTIwdHFkbSUwQSUwQSUyMyUyMEhpbnQlM0ElMjB1c2UlMjBhc3luY2hyb25vdXMlMjBBUEklMjBjYWxscyUyMChhbmQlMjBkZWRpY2F0ZWQlMjBlbmRwb2ludHMpJTIwdG8lMjBpbmNyZWFzZSUyMHNwZWVkJTBBZGVmJTIwcXVlcnkocGF5bG9hZCUzRE5vbmUlMkMlMjBhcGlfdXJsJTNETm9uZSklM0ElMEElMjAlMjAlMjAlM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JTVCMCU1RCU3RCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tqdm.auto <span class="hljs-keyword">import</span> tqdm

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Hint: use asynchronous API calls (and dedicated endpoints) to increase speed</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">query</span>(<span class="hljs-params">payload=<span class="hljs-literal">None</span>, api_url=<span class="hljs-literal">None</span></span>):
<span class="hljs-meta">... </span>    response = requests.post(api_url, headers=headers, json=payload)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> response.json()

<span class="hljs-meta">&gt;&gt;&gt; </span>headers = {<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">f&quot;Bearer <span class="hljs-subst">{huggingface_hub.get_token()}</span>&quot;</span>}

<span class="hljs-meta">&gt;&gt;&gt; </span>output_dic = {}
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> model <span class="hljs-keyword">in</span> models_to_compare:
<span class="hljs-meta">... </span>    <span class="hljs-comment"># Create API urls for each model</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># When using dedicated endpoints, you can reuse the same code and simply replace this URL</span>
<span class="hljs-meta">... </span>    api_url = <span class="hljs-string">&quot;https://api-inference.huggingface.co/models/&quot;</span> + model
    
<span class="hljs-meta">... </span>    <span class="hljs-comment"># send requests to API </span>
<span class="hljs-meta">... </span>    output_lst = []
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> prompt <span class="hljs-keyword">in</span> tqdm(prompt_formatted):
<span class="hljs-meta">... </span>        output = query(
<span class="hljs-meta">... </span>            payload={
<span class="hljs-meta">... </span>                <span class="hljs-string">&quot;inputs&quot;</span>: prompt,
<span class="hljs-meta">... </span>                <span class="hljs-string">&quot;parameters&quot;</span>: {**generation_params}
<span class="hljs-meta">... </span>            },
<span class="hljs-meta">... </span>            api_url=api_url 
<span class="hljs-meta">... </span>        )
<span class="hljs-meta">... </span>        output_lst.append(output[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;generated_text&quot;</span>])
    
<span class="hljs-meta">... </span>    output_dic.update({model: output_lst})

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;---First generation of <span class="hljs-subst">{models_to_compare[<span class="hljs-number">0</span>]}</span>:\\n<span class="hljs-subst">{output_dic[models_to_compare[<span class="hljs-number">0</span>]][<span class="hljs-number">0</span>]}</span>\\n\\n&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;---First generation of <span class="hljs-subst">{models_to_compare[<span class="hljs-number">1</span>]}</span>:\\n<span class="hljs-subst">{output_dic[models_to_compare[<span class="hljs-number">1</span>]][<span class="hljs-number">0</span>]}</span>&quot;</span>)`,wrap:!1}}),$=new c({props:{title:"将 LLM 输出存储在数据集中",local:"将-llm-输出存储在数据集中",headingTag:"h4"}}),q=new U({props:{code:"JTIzJTIwY3JlYXRlJTIwYSUyMEhGJTIwZGF0YXNldCUyMHdpdGglMjB0aGUlMjBpbnN0cnVjdGlvbnMlMjBhbmQlMjBtb2RlbCUyMG91dHB1dHMlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBEYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMERhdGFzZXQuZnJvbV9kaWN0KCU3QiUwQSUyMCUyMCUyMCUyMCUyMmluc3RydWN0aW9ucyUyMiUzQSUyMGluc3RydWN0aW9uc19sc3QlMkMlMEElMjAlMjAlMjAlMjAlMjJyZXNwb25zZV9tb2RlbF8xJTIyJTNBJTIwb3V0cHV0X2RpYyU1Qm1vZGVsc190b19jb21wYXJlJTVCMCU1RCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMnJlc3BvbnNlX21vZGVsXzIlMjIlM0ElMjBvdXRwdXRfZGljJTVCbW9kZWxzX3RvX2NvbXBhcmUlNUIxJTVEJTVEJTBBJTdEKSUwQSUwQWRhdGFzZXQ=",highlighted:`<span class="hljs-comment"># create a HF dataset with the instructions and model outputs</span>
<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset

dataset = Dataset.from_dict({
    <span class="hljs-string">&quot;instructions&quot;</span>: instructions_lst,
    <span class="hljs-string">&quot;response_model_1&quot;</span>: output_dic[models_to_compare[<span class="hljs-number">0</span>]],
    <span class="hljs-string">&quot;response_model_2&quot;</span>: output_dic[models_to_compare[<span class="hljs-number">1</span>]]
})

dataset`,wrap:!1}}),L=new c({props:{title:"创建并配置你的 Argilla 数据集",local:"创建并配置你的-argilla-数据集",headingTag:"h2"}}),O=new c({props:{title:"程序化地与 Argilla 交互",local:"程序化地与-argilla-交互",headingTag:"h4"}}),tl=new U({props:{code:"JTIzJTIwQWZ0ZXIlMjBzdGFydGluZyUyMHRoZSUyMEFyZ2lsbGElMjBTcGFjZSUyMChvciUyMGxvY2FsJTIwZG9ja2VyJTIwY29udGFpbmVyKSUyMHlvdSUyMGNhbiUyMGNvbm5lY3QlMjB0byUyMHRoZSUyMFNwYWNlJTIwd2l0aCUyMHRoZSUyMGNvZGUlMjBiZWxvdy4lMEFpbXBvcnQlMjBhcmdpbGxhJTIwYXMlMjByZyUwQSUwQWNsaWVudCUyMCUzRCUyMHJnLkFyZ2lsbGEoJTBBJTIwJTIwJTIwJTIwYXBpX3VybCUzRCUyMmh0dHBzJTNBJTJGJTJGdXNlcm5hbWUtc3BhY2VuYW1lLmhmLnNwYWNlJTIyJTJDJTIwJTIwJTIzJTIwTG9jYWxseSUzQSUyMCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E2OTAwJTIyJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRCUyMnlvdXItYXBpa2V5JTIyJTJDJTIwJTIwJTIzJTIwWW91J2xsJTIwZmluZCUyMGl0JTIwaW4lMjB0aGUlMjBVSSUyMCUyMk15JTIwU2V0dGluZ3MlMjAlM0UlMjBBUEklMjBrZXklMjIlMEElMjAlMjAlMjAlMjAlMjMlMjBUbyUyMHVzZSUyMGElMjBwcml2YXRlJTIwSEYlMjBBcmdpbGxhJTIwU3BhY2UlMkMlMjBhbHNvJTIwcGFzcyUyMHlvdXIlMjBIRiUyMHRva2VuJTBBJTIwJTIwJTIwJTIwaGVhZGVycyUzRCU3QiUyMkF1dGhvcml6YXRpb24lMjIlM0ElMjBmJTIyQmVhcmVyJTIwJTdCaHVnZ2luZ2ZhY2VfaHViLmdldF90b2tlbigpJTdEJTIyJTdEJTJDJTBBKQ==",highlighted:`<span class="hljs-comment"># After starting the Argilla Space (or local docker container) you can connect to the Space with the code below.</span>
<span class="hljs-keyword">import</span> argilla <span class="hljs-keyword">as</span> rg

client = rg.Argilla(
    api_url=<span class="hljs-string">&quot;https://username-spacename.hf.space&quot;</span>,  <span class="hljs-comment"># Locally: &quot;http://localhost:6900&quot;</span>
    api_key=<span class="hljs-string">&quot;your-apikey&quot;</span>,  <span class="hljs-comment"># You&#x27;ll find it in the UI &quot;My Settings &gt; API key&quot;</span>
    <span class="hljs-comment"># To use a private HF Argilla Space, also pass your HF token</span>
    headers={<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">f&quot;Bearer <span class="hljs-subst">{huggingface_hub.get_token()}</span>&quot;</span>},
)`,wrap:!1}}),el=new U({props:{code:"dXNlciUyMCUzRCUyMGNsaWVudC5tZSUwQXVzZXI=",highlighted:`user = client.me
user`,wrap:!1}}),al=new c({props:{title:"编写良好的标注指南",local:"编写良好的标注指南",headingTag:"h4"}}),il=new U({props:{code:"YW5ub3RhdG9yX2d1aWRlbGluZXMlMjAlM0QlMjAlMjIlMjIlMjIlNUMlMEFZb3VyJTIwdGFzayUyMGlzJTIwdG8lMjBldmFsdWF0ZSUyMHRoZSUyMHJlc3BvbnNlcyUyMG9mJTIwd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EEtJTIwQWRkJTIwdXAlMjB0byUyMCUyQjMlMjBwb2ludHMlMkMlMjBpZiUyMHRoZSUyMGNvZGUlMjBydW5zJTIwYW5kJTIwd29ya3MlMjBjb3JyZWN0bHkuJTIwQ29weSUyMHRoZSUyMGNvZGUlMjBpbnRvJTIwYW4lMjBJREUlMjBhbmQlMjB0ZXN0JTIwaXQlMjB3aXRoJTIwYXQlMjBsZWFzdCUyMHR3byUyMGRpZmZlcmVudCUyMGlucHV0cy4lMjBBdHRyaWJ1dGUlMjBvbmUlMjBwb2ludCUyMGlmJTIwdGhlJTIwY29kZSUyMHdvcmtzJTIwbW9zdGx5JTIwY29ycmVjdGx5JTJDJTIwYnV0JTIwaGFzJTIwc29tZSUyMGlzc3Vlcy4lMjBBdHRyaWJ1dGUlMjB0aHJlZSUyMHBvaW50cyUyMGlmJTIwdGhlJTIwY29kZSUyMGlzJTIwZnVsbHklMjBjb3JyZWN0JTIwYW5kJTIwcm9idXN0JTIwYWdhaW5zdCUyMGRpZmZlcmVudCUyMHNjZW5hcmlvcy4lMjAlMEElMjIlMjIlMjI=",highlighted:`annotator_guidelines = <span class="hljs-string">&quot;&quot;&quot;\\
Your task is to evaluate the responses of two LLMs to code generation tasks. 

First, you need to score each response on a scale from 0 to 7. You add points to your final score based on the following criteria:
- Add up to +2 points, if the code is properly commented, with inline comments and doc strings for functions.
- Add up to +2 points, if the code contains a good example for testing. 
- Add up to +3 points, if the code runs and works correctly. Copy the code into an IDE and test it with at least two different inputs. Attribute one point if the code is overall correct, but has some issues. Attribute three points if the code is fully correct and robust against different scenarios. 
Your resulting final score can be any value between 0 to 7. 

If both responses have a final score of &lt;= 4, select one response and correct it manually in the text field. 
The corrected response must fulfill all criteria from above. 
&quot;&quot;&quot;</span>

rating_tooltip = <span class="hljs-string">&quot;&quot;&quot;\\
- Add up to +2 points, if the code is properly commented, with inline comments and doc strings for functions.
- Add up to +2 points, if the code contains a good example for testing. 
- Add up to +3 points, if the code runs and works correctly. Copy the code into an IDE and test it with at least two different inputs. Attribute one point if the code works mostly correctly, but has some issues. Attribute three points if the code is fully correct and robust against different scenarios. 
&quot;&quot;&quot;</span>`,wrap:!1}}),Jl=new c({props:{title:"将你的 Argilla 数据集定制为特定任务",local:"将你的-argilla-数据集定制为特定任务",headingTag:"h4"}}),yl=new U({props:{code:" ",highlighted:`dataset_argilla_name = <span class="hljs-string">&quot;code-llm&quot;</span>
workspace_name = <span class="hljs-string">&quot;argilla&quot;</span>
reuse_existing_dataset = <span class="hljs-literal">False</span>  <span class="hljs-comment"># for easier iterative testing</span>

<span class="hljs-comment"># Configure your dataset settings</span>
settings = rg.Settings(
    <span class="hljs-comment"># The overall annotation guidelines, which human annotators can refer back to inside of the interface</span>
    guidelines=<span class="hljs-string">&quot;my guidelines&quot;</span>,
    fields=[
        rg.TextField(
            name=<span class="hljs-string">&quot;instruction&quot;</span>, title=<span class="hljs-string">&quot;Instruction:&quot;</span>, use_markdown=<span class="hljs-literal">True</span>, required=<span class="hljs-literal">True</span>
        ),
        rg.TextField(
            name=<span class="hljs-string">&quot;generation_1&quot;</span>,
            title=<span class="hljs-string">&quot;Response model 1:&quot;</span>,
            use_markdown=<span class="hljs-literal">True</span>,
            required=<span class="hljs-literal">True</span>,
        ),
        rg.TextField(
            name=<span class="hljs-string">&quot;generation_2&quot;</span>,
            title=<span class="hljs-string">&quot;Response model 2:&quot;</span>,
            use_markdown=<span class="hljs-literal">True</span>,
            required=<span class="hljs-literal">True</span>,
        ),
    ],
    <span class="hljs-comment"># These are the questions we ask annotators about the fields in the dataset</span>
    questions=[
        rg.RatingQuestion(
            name=<span class="hljs-string">&quot;score_response_1&quot;</span>,
            title=<span class="hljs-string">&quot;Your score for the response of model 1:&quot;</span>,
            description=<span class="hljs-string">&quot;0=very bad, 7=very good&quot;</span>,
            values=[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>],
            required=<span class="hljs-literal">True</span>,
        ),
        rg.RatingQuestion(
            name=<span class="hljs-string">&quot;score_response_2&quot;</span>,
            title=<span class="hljs-string">&quot;Your score for the response of model 2:&quot;</span>,
            description=<span class="hljs-string">&quot;0=very bad, 7=very good&quot;</span>,
            values=[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>],
            required=<span class="hljs-literal">True</span>,
        ),
        rg.LabelQuestion(
            name=<span class="hljs-string">&quot;which_response_corrected&quot;</span>,
            title=<span class="hljs-string">&quot;If both responses score below 4, select a response to correct:&quot;</span>,
            description=<span class="hljs-string">&quot;Select the response you will correct in the text field below.&quot;</span>,
            labels=[<span class="hljs-string">&quot;Response 1&quot;</span>, <span class="hljs-string">&quot;Response 2&quot;</span>, <span class="hljs-string">&quot;Combination of both&quot;</span>, <span class="hljs-string">&quot;Neither&quot;</span>],
            required=<span class="hljs-literal">False</span>,
        ),
        rg.TextQuestion(
            name=<span class="hljs-string">&quot;correction&quot;</span>,
            title=<span class="hljs-string">&quot;Paste the selected response below and correct it manually:&quot;</span>,
            description=<span class="hljs-string">&quot;Your corrected response must fulfill all criteria from the annotation guidelines.&quot;</span>,
            use_markdown=<span class="hljs-literal">True</span>,
            required=<span class="hljs-literal">False</span>,
        ),
        rg.TextQuestion(
            name=<span class="hljs-string">&quot;comments&quot;</span>,
            title=<span class="hljs-string">&quot;Annotator Comments&quot;</span>,
            description=<span class="hljs-string">&quot;Add any additional comments here. E.g.: edge cases, issues with the interface etc.&quot;</span>,
            use_markdown=<span class="hljs-literal">True</span>,
            required=<span class="hljs-literal">False</span>,
        ),
    ],
    metadata=[
        rg.TermsMetadataProperty(
            name=<span class="hljs-string">&quot;source-dataset&quot;</span>,
            title=<span class="hljs-string">&quot;Original dataset source&quot;</span>,
        ),
    ],
    allow_extra_metadata=<span class="hljs-literal">False</span>,
)

<span class="hljs-keyword">if</span> reuse_existing_dataset:
    dataset_argilla = client.datasets(dataset_argilla_name, workspace=workspace_name)
<span class="hljs-keyword">else</span>:
    dataset_argilla = rg.Dataset(
        name=dataset_argilla_name,
        settings=settings,
        workspace=workspace_name,
    )
    <span class="hljs-keyword">if</span> client.datasets(dataset_argilla_name, workspace=workspace_name) <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        client.datasets(dataset_argilla_name, workspace=workspace_name).delete()
    dataset_argilla = dataset_argilla.create()

dataset_argilla`,wrap:!1}}),Tl=new c({props:{title:"将数据加载到 Argilla",local:"将数据加载到-argilla",headingTag:"h4"}}),Ul=new U({props:{code:"JTIzJTIwSXRlcmF0ZSUyMG92ZXIlMjB0aGUlMjBzYW1wbGVzJTIwaW4lMjB0aGUlMjBkYXRhc2V0JTBBcmVjb3JkcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMHJnLlJlY29yZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmaWVsZHMlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJpbnN0cnVjdGlvbiUyMiUzQSUyMGV4YW1wbGUlNUIlMjJpbnN0cnVjdGlvbnMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJnZW5lcmF0aW9uXzElMjIlM0ElMjBleGFtcGxlJTVCJTIycmVzcG9uc2VfbW9kZWxfMSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmdlbmVyYXRpb25fMiUyMiUzQSUyMGV4YW1wbGUlNUIlMjJyZXNwb25zZV9tb2RlbF8yJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJ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RleGFtcGxlJTVCJTIybGxtX2p1ZGdlX3JhdGluZyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFnZW50JTNEJTIybGxhbWEtMy03MGItaW5zdHJ1Y3QlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjAlMjAlMjAlMjAlMjApJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMGZvciUyMGV4YW1wbGUlMjBpbiUyMGRhdGFzZXQlMEElNUQlMEElMEF0cnklM0ElMEElMjAlMjAlMjAlMjBkYXRhc2V0X2FyZ2lsbGEucmVjb3Jkcy5sb2cocmVjb3JkcyklMEFleGNlcHQlMjBFeGNlcHRpb24lMjBhcyUyMGUlM0ElMEElMjAlMjAlMjAlMjBwcmludCglMjJFeGNlcHRpb24lM0ElMjIlMkMlMjBlKQ==",highlighted:`<span class="hljs-comment"># Iterate over the samples in the dataset</span>
records = [
    rg.Record(
        fields={
            <span class="hljs-string">&quot;instruction&quot;</span>: example[<span class="hljs-string">&quot;instructions&quot;</span>],
            <span class="hljs-string">&quot;generation_1&quot;</span>: example[<span class="hljs-string">&quot;response_model_1&quot;</span>],
            <span class="hljs-string">&quot;generation_2&quot;</span>: example[<span class="hljs-string">&quot;response_model_2&quot;</span>],
        },
        metadata={
            <span class="hljs-string">&quot;source-dataset&quot;</span>: <span class="hljs-string">&quot;bigcode/self-oss-instruct-sc2-exec-filter-50k&quot;</span>,
        },
        <span class="hljs-comment"># Optional: add suggestions from an LLM-as-a-judge system</span>
        <span class="hljs-comment"># They will be indicated with a sparkle icon and shown as pre-filled responses</span>
        <span class="hljs-comment"># It will speed up manual annotation</span>
        <span class="hljs-comment"># suggestions=[</span>
        <span class="hljs-comment">#     rg.Suggestion(</span>
        <span class="hljs-comment">#         question_name=&quot;score_response_1&quot;,</span>
        <span class="hljs-comment">#         value=example[&quot;llm_judge_rating&quot;],</span>
        <span class="hljs-comment">#         agent=&quot;llama-3-70b-instruct&quot;,</span>
        <span class="hljs-comment">#     ),</span>
        <span class="hljs-comment"># ],</span>
    )
    <span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> dataset
]

<span class="hljs-keyword">try</span>:
    dataset_argilla.records.log(records)
<span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Exception:&quot;</span>, e)`,wrap:!1}}),dl=new c({props:{title:"标注",local:"标注",headingTag:"h2"}}),ul=new c({props:{title:"下载标注数据",local:"下载标注数据",headingTag:"h2"}}),gl=new U({props:{code:"YW5ub3RhdGVkX2RhdGFzZXQlMjAlM0QlMjBjbGllbnQuZGF0YXNldHMoZGF0YXNldF9hcmdpbGxhX25hbWUlMkMlMjB3b3Jrc3BhY2UlM0R3b3Jrc3BhY2VfbmFtZSklMEElMEFoZl9kYXRhc2V0JTIwJTNEJTIwYW5ub3RhdGVkX2RhdGFzZXQucmVjb3Jkcy50b19kYXRhc2V0cygpJTBBJTBBJTIzJTIwVGhpcyUyMEhGJTIwZGF0YXNldCUyMGNhbiUyMHRoZW4lMjBiZSUyMGZvcm1hdHRlZCUyQyUyMHN0b3JlZCUyMGFuZCUyMHByb2Nlc3NlZCUyMGludG8lMjBhbnklMjB0YWJ1bGFyJTIwZGF0YSUyMGZvcm1hdCUwQWhmX2RhdGFzZXQudG9fcGFuZGFzKCk=",highlighted:`annotated_dataset = client.datasets(dataset_argilla_name, workspace=workspace_name)

hf_dataset = annotated_dataset.records.to_datasets()

<span class="hljs-comment"># This HF dataset can then be formatted, stored and processed into any tabular data format</span>
hf_dataset.to_pandas()`,wrap:!1}}),Cl=new U({props:{code:"JTIzJTIwU3RvcmUlMjB0aGUlMjBkYXRhc2V0JTIwbG9jYWxseSUwQWhmX2RhdGFzZXQudG9fY3N2KCUyMmFyZ2lsbGEtZGF0YXNldC1sb2NhbC5jc3YlMjIpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwQ1NWJTBBJTIzaGZfZGF0YXNldC50b19qc29uKCUyMmFyZ2lsbGEtZGF0YXNldC1sb2NhbC5qc29uJTIyKSUyMCUyMCUyMyUyMFNhdmUlMjBhcyUyMEpTT04lMEElMjNoZl9kYXRhc2V0LnNhdmVfdG9fZGlzayglMjJhcmdpbGxhLWRhdGFzZXQtbG9jYWwlMjIpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwYSUyMCU2MGRhdGFzZXRzLkRhdGFzZXQlNjAlMjBpbiUyMHRoZSUyMGxvY2FsJTIwZmlsZXN5c3RlbSUwQSUyM2hmX2RhdGFzZXQudG9fcGFycXVldCgpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwUGFycXVldA==",highlighted:`<span class="hljs-comment"># Store the dataset locally</span>
hf_dataset.to_csv(<span class="hljs-string">&quot;argilla-dataset-local.csv&quot;</span>)  <span class="hljs-comment"># Save as CSV</span>
<span class="hljs-comment">#hf_dataset.to_json(&quot;argilla-dataset-local.json&quot;)  # Save as JSON</span>
<span class="hljs-comment">#hf_dataset.save_to_disk(&quot;argilla-dataset-local&quot;)  # Save as a \`datasets.Dataset\` in the local filesystem</span>
<span class="hljs-comment">#hf_dataset.to_parquet()  # Save as Parquet</span>`,wrap:!1}}),Al=new c({props:{title:"下一步",local:"下一步",headingTag:"h2"}}),Rl=new St({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/enterprise_cookbook_argilla.md"}}),{c(){w=n("meta"),Wl=a(),kl=n("p"),El=a(),j(d.$$.fragment),Nl=a(),j(I.$$.fragment),Vl=a(),j(h.$$.fragment),vl=a(),u=n("p"),u.innerHTML=Os,Hl=a(),b=n("p"),b.textContent=lt,Ql=a(),g=n("p"),g.innerHTML=st,Yl=a(),C=n("p"),C.innerHTML=tt,_l=a(),A=n("ol"),A.innerHTML=et,zl=a(),f=n("p"),f.textContent=at,Fl=a(),j(G.$$.fragment),Sl=a(),j(B.$$.fragment),$l=a(),j(Z.$$.fragment),xl=a(),j(R.$$.fragment),ql=a(),k=n("p"),k.innerHTML=Mt,Ll=a(),j(X.$$.fragment),Dl=a(),W=n("pre"),W.textContent=nt,Pl=a(),j(E.$$.fragment),Kl=a(),j(N.$$.fragment),Ol=a(),V=n("p"),V.innerHTML=pt,ls=a(),j(v.$$.fragment),ss=a(),H=n("pre"),H.innerHTML=it,ts=a(),j(Q.$$.fragment),es=a(),Y=n("p"),Y.innerHTML=jt,as=a(),j(_.$$.fragment),Ms=a(),z=n("p"),z.innerHTML=Jt,ns=a(),m=n("blockquote"),m.innerHTML=ot,ps=a(),j(F.$$.fragment),is=a(),S=n("pre"),S.textContent=yt,js=a(),j($.$$.fragment),Js=a(),x=n("p"),x.textContent=rt,os=a(),j(q.$$.fragment),ys=a(),j(L.$$.fragment),rs=a(),D=n("p"),D.innerHTML=Tt,Ts=a(),P=n("p"),P.innerHTML=ct,cs=a(),K=n("p"),K.innerHTML=Ut,Us=a(),j(O.$$.fragment),ws=a(),ll=n("p"),ll.textContent=wt,ms=a(),sl=n("p"),sl.innerHTML=mt,ds=a(),j(tl.$$.fragment),Is=a(),j(el.$$.fragment),hs=a(),j(al.$$.fragment),us=a(),Ml=n("p"),Ml.textContent=dt,bs=a(),nl=n("ul"),nl.innerHTML=It,gs=a(),pl=n("p"),pl.innerHTML=ht,Cs=a(),j(il.$$.fragment),As=a(),jl=n("p"),jl.innerHTML=ut,fs=a(),j(Jl.$$.fragment),Gs=a(),ol=n("p"),ol.innerHTML=bt,Bs=a(),j(yl.$$.fragment),Zs=a(),rl=n("p"),rl.innerHTML=gt,Rs=a(),j(Tl.$$.fragment),ks=a(),cl=n("p"),cl.textContent=Ct,Xs=a(),j(Ul.$$.fragment),Ws=a(),wl=n("p"),wl.innerHTML=At,Es=a(),ml=n("p"),ml.innerHTML=ft,Ns=a(),j(dl.$$.fragment),Vs=a(),Il=n("p"),Il.innerHTML=Gt,vs=a(),hl=n("p"),hl.innerHTML=Bt,Hs=a(),j(ul.$$.fragment),Qs=a(),bl=n("p"),bl.innerHTML=Zt,Ys=a(),j(gl.$$.fragment),_s=a(),j(Cl.$$.fragment),zs=a(),j(Al.$$.fragment),Fs=a(),fl=n("p"),fl.textContent=Rt,Ss=a(),Gl=n("p"),Gl.innerHTML=kt,$s=a(),Bl=n("ol"),Bl.innerHTML=Xt,xs=a(),Zl=n("p"),Zl.innerHTML=Wt,qs=a(),j(Rl.$$.fragment),Ls=a(),Xl=n("p"),this.h()},l(l){const s=Yt("svelte-u9bgzb",document.head);w=p(s,"META",{name:!0,content:!0}),s.forEach(t),Wl=M(l),kl=p(l,"P",{}),Et(kl).forEach(t),El=M(l),J(d.$$.fragment,l),Nl=M(l),J(I.$$.fragment,l),Vl=M(l),J(h.$$.fragment,l),vl=M(l),u=p(l,"P",{"data-svelte-h":!0}),i(u)!=="svelte-3hq2ql"&&(u.innerHTML=Os),Hl=M(l),b=p(l,"P",{"data-svelte-h":!0}),i(b)!=="svelte-5bsxi4"&&(b.textContent=lt),Ql=M(l),g=p(l,"P",{"data-svelte-h":!0}),i(g)!=="svelte-uewmey"&&(g.innerHTML=st),Yl=M(l),C=p(l,"P",{"data-svelte-h":!0}),i(C)!=="svelte-1s5xl1q"&&(C.innerHTML=tt),_l=M(l),A=p(l,"OL",{"data-svelte-h":!0}),i(A)!=="svelte-pq8e2z"&&(A.innerHTML=et),zl=M(l),f=p(l,"P",{"data-svelte-h":!0}),i(f)!=="svelte-z55tsm"&&(f.textContent=at),Fl=M(l),J(G.$$.fragment,l),Sl=M(l),J(B.$$.fragment,l),$l=M(l),J(Z.$$.fragment,l),xl=M(l),J(R.$$.fragment,l),ql=M(l),k=p(l,"P",{"data-svelte-h":!0}),i(k)!=="svelte-1ood0tp"&&(k.innerHTML=Mt),Ll=M(l),J(X.$$.fragment,l),Dl=M(l),W=p(l,"PRE",{"data-svelte-h":!0}),i(W)!=="svelte-ky4em7"&&(W.textContent=nt),Pl=M(l),J(E.$$.fragment,l),Kl=M(l),J(N.$$.fragment,l),Ol=M(l),V=p(l,"P",{"data-svelte-h":!0}),i(V)!=="svelte-1gnpot2"&&(V.innerHTML=pt),ls=M(l),J(v.$$.fragment,l),ss=M(l),H=p(l,"PRE",{"data-svelte-h":!0}),i(H)!=="svelte-dhulxx"&&(H.innerHTML=it),ts=M(l),J(Q.$$.fragment,l),es=M(l),Y=p(l,"P",{"data-svelte-h":!0}),i(Y)!=="svelte-mbp9md"&&(Y.innerHTML=jt),as=M(l),J(_.$$.fragment,l),Ms=M(l),z=p(l,"P",{"data-svelte-h":!0}),i(z)!=="svelte-109tm8b"&&(z.innerHTML=Jt),ns=M(l),m=p(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),i(m)!=="svelte-b2pwaj"&&(m.innerHTML=ot),ps=M(l),J(F.$$.fragment,l),is=M(l),S=p(l,"PRE",{"data-svelte-h":!0}),i(S)!=="svelte-13ofkmd"&&(S.textContent=yt),js=M(l),J($.$$.fragment,l),Js=M(l),x=p(l,"P",{"data-svelte-h":!0}),i(x)!=="svelte-b78kna"&&(x.textContent=rt),os=M(l),J(q.$$.fragment,l),ys=M(l),J(L.$$.fragment,l),rs=M(l),D=p(l,"P",{"data-svelte-h":!0}),i(D)!=="svelte-1esvh62"&&(D.innerHTML=Tt),Ts=M(l),P=p(l,"P",{"data-svelte-h":!0}),i(P)!=="svelte-1o2b49n"&&(P.innerHTML=ct),cs=M(l),K=p(l,"P",{"data-svelte-h":!0}),i(K)!=="svelte-1lfl07j"&&(K.innerHTML=Ut),Us=M(l),J(O.$$.fragment,l),ws=M(l),ll=p(l,"P",{"data-svelte-h":!0}),i(ll)!=="svelte-1jmksr9"&&(ll.textContent=wt),ms=M(l),sl=p(l,"P",{"data-svelte-h":!0}),i(sl)!=="svelte-tdn7u2"&&(sl.innerHTML=mt),ds=M(l),J(tl.$$.fragment,l),Is=M(l),J(el.$$.fragment,l),hs=M(l),J(al.$$.fragment,l),us=M(l),Ml=p(l,"P",{"data-svelte-h":!0}),i(Ml)!=="svelte-1jr0k5l"&&(Ml.textContent=dt),bs=M(l),nl=p(l,"UL",{"data-svelte-h":!0}),i(nl)!=="svelte-ihrrq8"&&(nl.innerHTML=It),gs=M(l),pl=p(l,"P",{"data-svelte-h":!0}),i(pl)!=="svelte-124hl3m"&&(pl.innerHTML=ht),Cs=M(l),J(il.$$.fragment,l),As=M(l),jl=p(l,"P",{"data-svelte-h":!0}),i(jl)!=="svelte-vw9s38"&&(jl.innerHTML=ut),fs=M(l),J(Jl.$$.fragment,l),Gs=M(l),ol=p(l,"P",{"data-svelte-h":!0}),i(ol)!=="svelte-r6kix8"&&(ol.innerHTML=bt),Bs=M(l),J(yl.$$.fragment,l),Zs=M(l),rl=p(l,"P",{"data-svelte-h":!0}),i(rl)!=="svelte-1913iw8"&&(rl.innerHTML=gt),Rs=M(l),J(Tl.$$.fragment,l),ks=M(l),cl=p(l,"P",{"data-svelte-h":!0}),i(cl)!=="svelte-g1s4dk"&&(cl.textContent=Ct),Xs=M(l),J(Ul.$$.fragment,l),Ws=M(l),wl=p(l,"P",{"data-svelte-h":!0}),i(wl)!=="svelte-8911g6"&&(wl.innerHTML=At),Es=M(l),ml=p(l,"P",{"data-svelte-h":!0}),i(ml)!=="svelte-1tsxy4g"&&(ml.innerHTML=ft),Ns=M(l),J(dl.$$.fragment,l),Vs=M(l),Il=p(l,"P",{"data-svelte-h":!0}),i(Il)!=="svelte-g1zszt"&&(Il.innerHTML=Gt),vs=M(l),hl=p(l,"P",{"data-svelte-h":!0}),i(hl)!=="svelte-ntnlj4"&&(hl.innerHTML=Bt),Hs=M(l),J(ul.$$.fragment,l),Qs=M(l),bl=p(l,"P",{"data-svelte-h":!0}),i(bl)!=="svelte-13nruxn"&&(bl.innerHTML=Zt),Ys=M(l),J(gl.$$.fragment,l),_s=M(l),J(Cl.$$.fragment,l),zs=M(l),J(Al.$$.fragment,l),Fs=M(l),fl=p(l,"P",{"data-svelte-h":!0}),i(fl)!=="svelte-xwc7vz"&&(fl.textContent=Rt),Ss=M(l),Gl=p(l,"P",{"data-svelte-h":!0}),i(Gl)!=="svelte-q0lwoe"&&(Gl.innerHTML=kt),$s=M(l),Bl=p(l,"OL",{"data-svelte-h":!0}),i(Bl)!=="svelte-kci0kg"&&(Bl.innerHTML=Xt),xs=M(l),Zl=p(l,"P",{"data-svelte-h":!0}),i(Zl)!=="svelte-lg8krs"&&(Zl.innerHTML=Wt),qs=M(l),J(Rl.$$.fragment,l),Ls=M(l),Xl=p(l,"P",{}),Et(Xl).forEach(t),this.h()},h(){Ps(w,"name","hf:doc:metadata"),Ps(w,"content",xt),Ps(m,"class","tip")},m(l,s){_t(document.head,w),e(l,Wl,s),e(l,kl,s),e(l,El,s),o(d,l,s),e(l,Nl,s),o(I,l,s),e(l,Vl,s),o(h,l,s),e(l,vl,s),e(l,u,s),e(l,Hl,s),e(l,b,s),e(l,Ql,s),e(l,g,s),e(l,Yl,s),e(l,C,s),e(l,_l,s),e(l,A,s),e(l,zl,s),e(l,f,s),e(l,Fl,s),o(G,l,s),e(l,Sl,s),o(B,l,s),e(l,$l,s),o(Z,l,s),e(l,xl,s),o(R,l,s),e(l,ql,s),e(l,k,s),e(l,Ll,s),o(X,l,s),e(l,Dl,s),e(l,W,s),e(l,Pl,s),o(E,l,s),e(l,Kl,s),o(N,l,s),e(l,Ol,s),e(l,V,s),e(l,ls,s),o(v,l,s),e(l,ss,s),e(l,H,s),e(l,ts,s),o(Q,l,s),e(l,es,s),e(l,Y,s),e(l,as,s),o(_,l,s),e(l,Ms,s),e(l,z,s),e(l,ns,s),e(l,m,s),e(l,ps,s),o(F,l,s),e(l,is,s),e(l,S,s),e(l,js,s),o($,l,s),e(l,Js,s),e(l,x,s),e(l,os,s),o(q,l,s),e(l,ys,s),o(L,l,s),e(l,rs,s),e(l,D,s),e(l,Ts,s),e(l,P,s),e(l,cs,s),e(l,K,s),e(l,Us,s),o(O,l,s),e(l,ws,s),e(l,ll,s),e(l,ms,s),e(l,sl,s),e(l,ds,s),o(tl,l,s),e(l,Is,s),o(el,l,s),e(l,hs,s),o(al,l,s),e(l,us,s),e(l,Ml,s),e(l,bs,s),e(l,nl,s),e(l,gs,s),e(l,pl,s),e(l,Cs,s),o(il,l,s),e(l,As,s),e(l,jl,s),e(l,fs,s),o(Jl,l,s),e(l,Gs,s),e(l,ol,s),e(l,Bs,s),o(yl,l,s),e(l,Zs,s),e(l,rl,s),e(l,Rs,s),o(Tl,l,s),e(l,ks,s),e(l,cl,s),e(l,Xs,s),o(Ul,l,s),e(l,Ws,s),e(l,wl,s),e(l,Es,s),e(l,ml,s),e(l,Ns,s),o(dl,l,s),e(l,Vs,s),e(l,Il,s),e(l,vs,s),e(l,hl,s),e(l,Hs,s),o(ul,l,s),e(l,Qs,s),e(l,bl,s),e(l,Ys,s),o(gl,l,s),e(l,_s,s),o(Cl,l,s),e(l,zs,s),o(Al,l,s),e(l,Fs,s),e(l,fl,s),e(l,Ss,s),e(l,Gl,s),e(l,$s,s),e(l,Bl,s),e(l,xs,s),e(l,Zl,s),e(l,qs,s),o(Rl,l,s),e(l,Ls,s),e(l,Xl,s),Ds=!0},p:Vt,i(l){Ds||(y(d.$$.fragment,l),y(I.$$.fragment,l),y(h.$$.fragment,l),y(G.$$.fragment,l),y(B.$$.fragment,l),y(Z.$$.fragment,l),y(R.$$.fragment,l),y(X.$$.fragment,l),y(E.$$.fragment,l),y(N.$$.fragment,l),y(v.$$.fragment,l),y(Q.$$.fragment,l),y(_.$$.fragment,l),y(F.$$.fragment,l),y($.$$.fragment,l),y(q.$$.fragment,l),y(L.$$.fragment,l),y(O.$$.fragment,l),y(tl.$$.fragment,l),y(el.$$.fragment,l),y(al.$$.fragment,l),y(il.$$.fragment,l),y(Jl.$$.fragment,l),y(yl.$$.fragment,l),y(Tl.$$.fragment,l),y(Ul.$$.fragment,l),y(dl.$$.fragment,l),y(ul.$$.fragment,l),y(gl.$$.fragment,l),y(Cl.$$.fragment,l),y(Al.$$.fragment,l),y(Rl.$$.fragment,l),Ds=!0)},o(l){r(d.$$.fragment,l),r(I.$$.fragment,l),r(h.$$.fragment,l),r(G.$$.fragment,l),r(B.$$.fragment,l),r(Z.$$.fragment,l),r(R.$$.fragment,l),r(X.$$.fragment,l),r(E.$$.fragment,l),r(N.$$.fragment,l),r(v.$$.fragment,l),r(Q.$$.fragment,l),r(_.$$.fragment,l),r(F.$$.fragment,l),r($.$$.fragment,l),r(q.$$.fragment,l),r(L.$$.fragment,l),r(O.$$.fragment,l),r(tl.$$.fragment,l),r(el.$$.fragment,l),r(al.$$.fragment,l),r(il.$$.fragment,l),r(Jl.$$.fragment,l),r(yl.$$.fragment,l),r(Tl.$$.fragment,l),r(Ul.$$.fragment,l),r(dl.$$.fragment,l),r(ul.$$.fragment,l),r(gl.$$.fragment,l),r(Cl.$$.fragment,l),r(Al.$$.fragment,l),r(Rl.$$.fragment,l),Ds=!1},d(l){l&&(t(Wl),t(kl),t(El),t(Nl),t(Vl),t(vl),t(u),t(Hl),t(b),t(Ql),t(g),t(Yl),t(C),t(_l),t(A),t(zl),t(f),t(Fl),t(Sl),t($l),t(xl),t(ql),t(k),t(Ll),t(Dl),t(W),t(Pl),t(Kl),t(Ol),t(V),t(ls),t(ss),t(H),t(ts),t(es),t(Y),t(as),t(Ms),t(z),t(ns),t(m),t(ps),t(is),t(S),t(js),t(Js),t(x),t(os),t(ys),t(rs),t(D),t(Ts),t(P),t(cs),t(K),t(Us),t(ws),t(ll),t(ms),t(sl),t(ds),t(Is),t(hs),t(us),t(Ml),t(bs),t(nl),t(gs),t(pl),t(Cs),t(As),t(jl),t(fs),t(Gs),t(ol),t(Bs),t(Zs),t(rl),t(Rs),t(ks),t(cl),t(Xs),t(Ws),t(wl),t(Es),t(ml),t(Ns),t(Vs),t(Il),t(vs),t(hl),t(Hs),t(Qs),t(bl),t(Ys),t(_s),t(zs),t(Fs),t(fl),t(Ss),t(Gl),t($s),t(Bl),t(xs),t(Zl),t(qs),t(Ls),t(Xl)),t(w),T(d,l),T(I,l),T(h,l),T(G,l),T(B,l),T(Z,l),T(R,l),T(X,l),T(E,l),T(N,l),T(v,l),T(Q,l),T(_,l),T(F,l),T($,l),T(q,l),T(L,l),T(O,l),T(tl,l),T(el,l),T(al,l),T(il,l),T(Jl,l),T(yl,l),T(Tl,l),T(Ul,l),T(dl,l),T(ul,l),T(gl,l),T(Cl,l),T(Al,l),T(Rl,l)}}}const xt='{"title":"数据标注与 Argilla Spaces","local":"数据标注与-argilla-spaces","sections":[{"title":"安装需要的包并连接到 HF Hub","local":"安装需要的包并连接到-hf-hub","sections":[],"depth":2},{"title":"下载示例任务数据","local":"下载示例任务数据","sections":[],"depth":2},{"title":"对示例任务提示两个 LLM 以获取它们的响应。","local":"对示例任务提示两个-llm-以获取它们的响应","sections":[{"title":"使用 chat_template 格式化指令","local":"使用-chattemplate-格式化指令","sections":[],"depth":4},{"title":"将指令发送到 HF 推理 API","local":"将指令发送到-hf-推理-api","sections":[],"depth":4},{"title":"将 LLM 输出存储在数据集中","local":"将-llm-输出存储在数据集中","sections":[],"depth":4}],"depth":2},{"title":"创建并配置你的 Argilla 数据集","local":"创建并配置你的-argilla-数据集","sections":[{"title":"程序化地与 Argilla 交互","local":"程序化地与-argilla-交互","sections":[],"depth":4},{"title":"编写良好的标注指南","local":"编写良好的标注指南","sections":[],"depth":4},{"title":"将你的 Argilla 数据集定制为特定任务","local":"将你的-argilla-数据集定制为特定任务","sections":[],"depth":4},{"title":"将数据加载到 Argilla","local":"将数据加载到-argilla","sections":[],"depth":4}],"depth":2},{"title":"标注","local":"标注","sections":[],"depth":2},{"title":"下载标注数据","local":"下载标注数据","sections":[],"depth":2},{"title":"下一步","local":"下一步","sections":[],"depth":2}],"depth":1}';function qt(Ks){return vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class le extends Ht{constructor(w){super(),Qt(this,w,qt,$t,Nt,{})}}export{le as component};
