import{s as Wt,o as Et,n as Nt}from"../chunks/scheduler.65852ee5.js";import{S as Vt,i as vt,g as M,s as a,r as j,A as Qt,h as p,f as t,c as n,j as kt,u as o,x as i,k as Xt,y as Ht,a as e,v as y,d as J,t as r,w as c}from"../chunks/index.aa74147d.js";import{T as _t}from"../chunks/Tip.bb8ccac8.js";import{D as Yt,C as w}from"../chunks/DocNotebookDropdown.1a7e6a42.js";import{H as U,E as Ft}from"../chunks/index.e2566494.js";function zt(El){let T,I=`<br/>
一旦推理 API 示例完成，下面的代码将会更新。`;return{c(){T=M("p"),T.innerHTML=I},l(m){T=p(m,"P",{"data-svelte-h":!0}),i(T)!=="svelte-ac7soq"&&(T.innerHTML=I)},m(m,Xl){e(m,T,Xl)},p:Nt,d(m){m&&t(T)}}}function $t(El){let T,I,m,Xl,h,Nl,u,Vl,b,Ds='<em>作者: <a href="https://huggingface.co/MoritzLaurer" rel="nofollow">Moritz Laurer</a></em>',vl,g,Ps="本 Notebook 展示了系统地评估大型语言模型（LLM）输出并创建 LLM 训练数据的工作流程。你可以通过使用本 Notebook 评估你最喜爱的 LLM 在没有任何微调的情况下在特定任务上的零样本性能。如果你希望提高性能，你可以轻松地重用此工作流程来创建训练数据。",Ql,C,Ks="<strong>示例用例：代码生成。</strong> 在本教程中，我们展示了如何为代码生成任务创建高质量的测试和训练数据。然而，相同的工作流程也可以适应其他与你特定用例相关的任务。",Hl,f,Os="<strong>在本 Notebook 中，我们将进行以下步骤：</strong>",_l,B,lt="<li>下载示例任务的数据。</li> <li>提示两个 LLM 对这些任务作出响应。这将生成“合成数据”以加速手动数据创建。</li> <li>在 HF Spaces 上创建一个 Argilla 标注界面，以比较和评估两个 LLM 的输出。</li> <li>将示例数据和零样本 LLM 的响应上传到 Argilla 标注界面。</li> <li>下载已标注的数据。</li>",Yl,A,st="你可以根据自己的需求调整本 Notebook，例如在步骤 (2) 使用不同的 LLM 和 API 提供商，或在步骤 (3) 调整标注任务。",Fl,G,zl,Z,$l,R,Sl,k,xl,X,tt='首先，我们下载一个包含 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> 模型。',ql,W,Ll,E,et="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",Dl,N,Pl,V,Kl,v,at='在将指令发送到 LLM API 之前，我们需要使用正确的 <code>chat_template</code> 格式化指令，以便对每个需要评估的模型进行适配。这实际上是指在指令周围加上特殊的标记。有关 <code>chat_template</code> 的详细信息，请参阅 <a href="https://huggingface.co/docs/transformers/main/en/chat_templating" rel="nofollow">文档</a>。',Ol,Q,ls,H,nt=`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>`,ss,_,ts,Y,Mt='现在，我们可以将指令发送到两个 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>。',es,F,as,z,pt='现在，我们可以向 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,d,Ms,$,ps,S,it=`---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.
`,is,x,js,q,jt="现在，我们可以将 LLM 的输出与原始指令一起存储在一个数据集中。",os,L,ys,D,Js,P,ot='我们使用 <a href="https://argilla.io/" rel="nofollow">Argilla</a>，这是一个为 AI 工程师和领域专家设计的协作工具，用于构建高质量的数据集以支持他们的项目。',rs,K,yt='我们通过 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,O,Jt='<img src="https://huggingface.co/datasets/huggingface/cookbook-images/resolve/main/argilla-login-screen.png" alt="Argilla 登录界面"/>',Ts,ll,Us,sl,rt="在我们定制数据集以适应特定任务并上传将在 UI 中显示的数据之前，我们需要先完成一些设置。",ws,tl,ct="<strong>将此 notebook 连接到 Argilla：</strong> 现在，我们可以将此 notebook 连接到 Argilla，以便程序化地配置你的数据集并上传/下载数据。",ms,el,ds,al,Is,nl,hs,Ml,Tt="为你的人工标注员编写良好的指南与编写高质量的训练代码一样重要（也是一项具有挑战性的任务）。良好的指南应满足以下标准：",us,pl,Ut="<li><strong>简洁明了</strong>：指南应简洁明了，以便那些对任务一无所知的人也能理解。在发布之前，最好请至少一位同事重新阅读指南，确保没有歧义。</li> <li><strong>可重复和明确</strong>：完成标注任务所需的所有信息应包含在指南中。一个常见的错误是，在与选定的标注员沟通时，未能正式解释指南的内容。未来的标注员将无法获取这些信息，如果没有在指南中明确说明，他们可能会以不同于预期的方式完成任务。</li> <li><strong>简短而全面</strong>：指南应尽可能简短，但包含所有必要的信息。标注员通常不会认真阅读冗长的指南，因此请尽量保持简洁，同时确保内容全面。</li>",bs,il,wt='请注意，编写标注指南是一个迭代过程。建议你自己先做几十个标注，并根据数据中学到的经验来完善指南，然后再将任务分配给他人。随着任务的演变，对指南进行版本管理也很有帮助。有关更多提示，请参见这篇 <a href="https://argilla.io/blog/annotation-guidelines-practices/" rel="nofollow">博客文章</a>。',gs,jl,Cs,ol,mt="<strong>累积评分 vs. Likert 量表：</strong> 注意，上述指南要求标注员通过为明确的标准加分来进行累积评分。另一种方法是使用 “Likert 量表”，在这种方法中，标注员被要求在一个连续的尺度上对响应进行评分，例如从 1（非常差）到 3（一般）再到 5（非常好）。我们通常推荐使用累积评分，因为它迫使你和标注员将质量标准明确化，而仅仅将响应评分为 “4”（好）是模糊的，不同的标注员可能会对其有不同的解释。",fs,yl,Bs,Jl,dt='现在，我们可以为特定任务创建自己的 <code>code-llm</code> 任务，定义标注所需的字段、问题和元数据。有关如何配置 Argilla 数据集的更多信息，请参阅 <a href="https://docs.argilla.io/latest/how_to_guides/dataset/#create-a-dataset" rel="nofollow">Argilla 文档</a>。',As,rl,Gs,cl,It="运行上述代码后，你将在 Argilla 中看到新的自定义 <code>code-llm</code> 数据集（以及之前可能创建的任何其他数据集）。",Zs,Tl,Rs,Ul,ht="此时，数据集仍然为空。让我们使用以下代码加载一些数据。",ks,wl,Xs,ml,ut="<strong>Argilla 的标注 UI</strong> 将类似于下图所示：",Ws,dl,bt='<img src="https://huggingface.co/datasets/huggingface/cookbook-images/resolve/main/argilla-code-llm.png" alt="Argilla UI"/>',Es,Il,Ns,hl,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,ul,Ct="<strong>重要提示</strong>：如果你在 HF Space 中使用 Argilla，请确保启用持久存储，以便你的数据安全存储，并且不会在一段时间后被自动删除。对于生产环境，确保在进行任何标注之前就启用持久存储，以避免数据丢失。",vs,bl,Qs,gl,ft='标注完成后，你可以从 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>）。',Hs,Cl,_s,fl,Ys,Bl,Fs,Al,Bt="就这样！你已经使用 HF 推理 API 创建了合成 LLM 数据，在 Argilla 中创建了数据集，将 LLM 数据上传到 Argilla，评估/修正了数据，并在标注后将数据以简单的表格格式下载，用于后续使用。",zs,Gl,At="我们特别设计了这个流程和界面来支持 <strong>两个主要用例</strong>：",$s,Zl,Gt='<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>',Ss,Rl,Zt='<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>，其中包含许多其他创意。',xs,kl,qs,Wl,Ls;return h=new Yt({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"}]}}),u=new U({props:{title:"数据标注与 Argilla Spaces",local:"数据标注与-argilla-spaces",headingTag:"h1"}}),G=new U({props:{title:"安装需要的包并连接到 HF Hub",local:"安装需要的包并连接到-hf-hub",headingTag:"h2"}}),Z=new w({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}}),R=new w({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}}),k=new U({props:{title:"下载示例任务数据",local:"下载示例任务数据",headingTag:"h2"}}),W=new w({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}}),N=new U({props:{title:"对示例任务提示两个 LLM 以获取它们的响应。",local:"对示例任务提示两个-llm-以获取它们的响应",headingTag:"h2"}}),V=new U({props:{title:"使用 chat_template 格式化指令",local:"使用-chattemplate-格式化指令",headingTag:"h4"}}),Q=new w({props:{code:"JTIzJTIwQXBwbHklMjBjb3JyZWN0JTIwY2hhdCUyMGZvcm1hdHRpbmclMjB0byUyMGluc3RydWN0aW9ucyUyMGZyb20lMjB0aGUlMjBkYXRhc2V0JTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbHNfdG9fY29tcGFyZSUyMCUzRCUyMCU1QiUyMm1pc3RyYWxhaSUyRk1peHRyYWwtOHg3Qi1JbnN0cnVjdC12MC4xJTIyJTJDJTIwJTIybWV0YS1sbGFtYSUyRk1ldGEtTGxhbWEtMy03MEItSW5zdHJ1Y3QlMjIlNUQlMEElMEElMEFkZWYlMjBmb3JtYXRfcHJvbXB0KHByb21wdCUyQyUyMHRva2VuaXplciklM0ElMEElMjAlMjAlMjAlMjBtZXNzYWdlcyUyMCUzRCUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMHByb21wdCU3RCU1RCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzX3Rva2VuaXplZCUyMCUzRCUyMHRva2VuaXplci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1lc3NhZ2VzJTJDJTIwdG9rZW5pemUlM0RGYWxzZSUyQyUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMG1lc3NhZ2VzX3Rva2VuaXplZCUwQSUwQSUwQXByb21wdHNfZm9ybWF0dGVkX2RpYyUyMCUzRCUyMCU3QiU3RCUwQWZvciUyMG1vZGVsJTI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U1QjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjIlNUNuJTVDbiUyMiUyQyUwQSk=",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(
<span class="hljs-meta">... </span>        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-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-meta">... </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>,
<span class="hljs-meta">... </span>    prompts_formatted_dic[models_to_compare[<span class="hljs-number">0</span>]][<span class="hljs-number">0</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;\\n\\n&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(
<span class="hljs-meta">... </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>,
<span class="hljs-meta">... </span>    prompts_formatted_dic[models_to_compare[<span class="hljs-number">1</span>]][<span class="hljs-number">0</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;\\n\\n&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),_=new U({props:{title:"将指令发送到 HF 推理 API",local:"将指令发送到-hf-推理-api",headingTag:"h4"}}),F=new w({props:{code:"Z2VuZXJhdGlvbl9wYXJhbXMlMjAlM0QlMjBkaWN0KCUwQSUyMCUyMCUyMCUyMCUyMyUyMHdlJTIwdXNlJTIwbG93JTIwdGVtcGVyYXR1cmUlMjBhbmQlMjB0b3BfcCUyMHRvJTIwcmVkdWNlJTIwY3JlYXRpdml0eSUyMGFuZCUyMGluY3JlYXNlJTIwbGlrZWxpaG9vZCUyMG9mJTIwaGlnaGx5JTIwcHJvYmFibGUlMjB0b2tlbnMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuMiUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC42MCUyQyUwQSUyMCUyMCUyMCUyMHRvcF9rJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHJlcGV0aXRpb25fcGVuYWx0eSUzRDEuMCUyQyUwQSUyMCUyMCUyMCUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDUxMiUyMColMjAyJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2Z1bGxfdGV4dCUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwc2VlZCUzRDQyJTJDJTBBJTIwJTIwJTIwJTIwJTIzJTIwZGV0YWlscyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjAlMjMlMjBzdG9wJTNEJTVCJTIyJTNDJTdDRU5EX09GX1RVUk5fVE9LRU4lN0MlM0UlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjMlMjBncmFtbWFyJTNEJTdCJTIydHlwZSUyMiUzQSUyMCUyMmpzb24lMjIlN0QlMEElMjAlMjAlMjAlMjBtYXhfdGltZSUzRE5vbmUlMkMlMEElMjAlMjAlMjAlMjBzdHJlYW0lM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHVzZV9jYWNoZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwd2FpdF9mb3JfbW9kZWwlM0RGYWxzZSUyQyUwQSk=",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}}),d=new _t({props:{warning:!1,$$slots:{default:[zt]},$$scope:{ctx:El}}}),$=new w({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHFkbS5hdXRvJTIwaW1wb3J0JTIwdHFkbSUwQSUwQSUwQSUyMyUyMEhpbnQlM0ElMjB1c2UlMjBhc3luY2hyb25vdXMlMjBBUEklMjBjYWxscyUyMChhbmQlMjBkZWRpY2F0ZWQlMjBlbmRwb2ludHMpJTIwdG8lMjBpbmNyZWFzZSUyMHNwZWVkJTBBZGVmJTIwcXVlcnkocGF5bG9hZCUzRE5vbmUlMkMlMjBhcGlfdXJsJTNETm9uZSklM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLnBvc3QoYXBpX3VybCUyQyUyMGhlYWRlcnMlM0RoZWFkZXJzJTJDJTIwanNvbiUzRHBheWxvYWQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzcG9uc2UuanNvbigpJTBBJTBBJTBBaGVhZGVycyUyMCUzRCUyMCU3QiUyMkF1dGhvcml6YXRpb24lMjIlM0ElMjBmJTIyQmVhcmVyJTIwJTdCaHVnZ2luZ2ZhY2VfaHViLmdldF90b2tlbigpJTdEJTIyJTdEJTBBJTBBb3V0cHV0X2RpYyUyMCUzRCUyMCU3QiU3RCUwQWZvciUyMG1vZGVsJTIwaW4lMjBtb2RlbHNfdG9fY29tcGFyZSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMENyZWF0ZSUyMEFQSSUyMHVybHMlMjBmb3IlMjBlYWNoJTIwbW9kZWwlMEElMjAlMjAlMjAlMjAlMjMlMjBXaGVuJTIwdXNpbmclMjBkZWRpY2F0ZWQlMjBlbmRwb2ludHMlMkMlMjB5b3UlMjBjYW4lMjByZXVzZSUyMHRoZSUyMHNhbWUl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VyYXRpb24lMjBvZiUyMCU3Qm1vZGVsc190b19jb21wYXJlJTVCMSU1RCU3RCUzQSU1Q24lN0JvdXRwdXRfZGljJTVCbW9kZWxzX3RvX2NvbXBhcmUlNUIxJTVEJTVEJTVCMCU1RCU3RCUyMik=",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(payload={<span class="hljs-string">&quot;inputs&quot;</span>: prompt, <span class="hljs-string">&quot;parameters&quot;</span>: {**generation_params}}, api_url=api_url)
<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}}),x=new U({props:{title:"将 LLM 输出存储在数据集中",local:"将-llm-输出存储在数据集中",headingTag:"h4"}}),L=new w({props:{code:"JTIzJTIwY3JlYXRlJTIwYSUyMEhGJTIwZGF0YXNldCUyMHdpdGglMjB0aGUlMjBpbnN0cnVjdGlvbnMlMjBhbmQlMjBtb2RlbCUyMG91dHB1dHMlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBEYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMERhdGFzZXQuZnJvbV9kaWN0KCUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmluc3RydWN0aW9ucyUyMiUzQSUyMGluc3RydWN0aW9uc19sc3QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXNwb25zZV9tb2RlbF8xJTIyJTNBJTIwb3V0cHV0X2RpYyU1Qm1vZGVsc190b19jb21wYXJlJTVCMCU1RCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJlc3BvbnNlX21vZGVsXzIlMjIlM0ElMjBvdXRwdXRfZGljJTVCbW9kZWxzX3RvX2NvbXBhcmUlNUIxJTVEJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTBBKSUwQSUwQWRhdGFzZXQ=",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}}),D=new U({props:{title:"创建并配置你的 Argilla 数据集",local:"创建并配置你的-argilla-数据集",headingTag:"h2"}}),ll=new U({props:{title:"程序化地与 Argilla 交互",local:"程序化地与-argilla-交互",headingTag:"h4"}}),el=new w({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}}),al=new w({props:{code:"dXNlciUyMCUzRCUyMGNsaWVudC5tZSUwQXVzZXI=",highlighted:`user = client.me
user`,wrap:!1}}),nl=new U({props:{title:"编写良好的标注指南",local:"编写良好的标注指南",headingTag:"h4"}}),jl=new w({props:{code:"YW5ub3RhdG9yX2d1aWRl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IwJTJCMiUyMHBvaW50cyUyQyUyMGlmJTIwdGhlJTIwY29kZSUyMGNvbnRhaW5zJTIwYSUyMGdvb2QlMjBleGFtcGxlJTIwZm9yJTIwdGVzdGluZy4lMjAlMEEtJTIwQWRkJTIwdXAlMjB0byUyMCUyQjMlMjBwb2ludHMlMkMlMjBpZiUyMHRoZSUyMGNvZGUlMjBydW5zJTIwYW5kJTIwd29ya3MlMjBjb3JyZWN0bHkuJTIwQ29weSUyMHRoZSUyMGNvZGUlMjBpbnRvJTIwYW4lMjBJREUlMjBhbmQlMjB0ZXN0JTIwaXQlMjB3aXRoJTIwYXQlMjBsZWFzdCUyMHR3byUyMGRpZmZlcmVudCUyMGlucHV0cy4lMjBBdHRyaWJ1dGUlMjBvbmUlMjBwb2ludCUyMGlmJTIwdGhlJTIwY29kZSUyMHdvcmtzJTIwbW9zdGx5JTIwY29ycmVjdGx5JTJDJTIwYnV0JTIwaGFzJTIwc29tZSUyMGlzc3Vlcy4lMjBBdHRyaWJ1dGUlMjB0aHJlZSUyMHBvaW50cyUyMGlmJTIwdGhlJTIwY29kZSUyMGlzJTIwZnVsbHklMjBjb3JyZWN0JTIwYW5kJTIwcm9idXN0JTIwYWdhaW5zdCUyMGRpZmZlcmVudCUyMHNjZW5hcmlvcy4lMjAlMEElMjIlMjIlMjI=",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}}),yl=new U({props:{title:"将你的 Argilla 数据集定制为特定任务",local:"将你的-argilla-数据集定制为特定任务",headingTag:"h4"}}),rl=new w({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 U({props:{title:"将数据加载到 Argilla",local:"将数据加载到-argilla",headingTag:"h4"}}),wl=new w({props:{code:"JTIzJTIwSXRlcmF0ZSUyMG92ZXIlMjB0aGUlMjBzYW1wbGVzJTIwaW4lMjB0aGUlMjBkYXRhc2V0JTBBcmVjb3JkcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMHJnLlJlY29yZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmaWVsZHMlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJpbnN0cnVjdGlvbiUyMiUzQSUyMGV4YW1wbGUlNUIlMjJpbnN0cnVjdGlvbnMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJnZW5lcmF0aW9uXzElMjIlM0ElMjBleGFtcGxlJTVCJTIycmVzcG9uc2VfbW9kZWxfMSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmdlbmVyYXR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V9yZXNwb25zZV8xJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdmFsdWUlM0RleGFtcGxlJTVCJTIybGxtX2p1ZGdlX3JhdGluZyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFnZW50JTNEJTIybGxhbWEtMy03MGItaW5zdHJ1Y3QlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjAlMjAlMjAlMjAlMjApJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMGZvciUyMGV4YW1wbGUlMjBpbiUyMGRhdGFzZXQlMEElNUQlMEElMEF0cnklM0ElMEElMjAlMjAlMjAlMjBkYXRhc2V0X2FyZ2lsbGEucmVjb3Jkcy5sb2cocmVjb3JkcyklMEFleGNlcHQlMjBFeGNlcHRpb24lMjBhcyUyMGUlM0ElMEElMjAlMjAlMjAlMjBwcmludCglMjJFeGNlcHRpb24lM0ElMjIlMkMlMjBlKQ==",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}}),Il=new U({props:{title:"标注",local:"标注",headingTag:"h2"}}),bl=new U({props:{title:"下载标注数据",local:"下载标注数据",headingTag:"h2"}}),Cl=new w({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}}),fl=new w({props:{code:"JTIzJTIwU3RvcmUlMjB0aGUlMjBkYXRhc2V0JTIwbG9jYWxseSUwQWhmX2RhdGFzZXQudG9fY3N2KCUyMmFyZ2lsbGEtZGF0YXNldC1sb2NhbC5jc3YlMjIpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwQ1NWJTBBJTIzJTIwaGZfZGF0YXNldC50b19qc29uKCUyMmFyZ2lsbGEtZGF0YXNldC1sb2NhbC5qc29uJTIyKSUyMCUyMCUyMyUyMFNhdmUlMjBhcyUyMEpTT04lMEElMjMlMjBoZl9kYXRhc2V0LnNhdmVfdG9fZGlzayglMjJhcmdpbGxhLWRhdGFzZXQtbG9jYWwlMjIpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwYSUyMCU2MGRhdGFzZXRzLkRhdGFzZXQlNjAlMjBpbiUyMHRoZSUyMGxvY2FsJTIwZmlsZXN5c3RlbSUwQSUyMyUyMGhmX2RhdGFzZXQudG9fcGFycXVldCgpJTIwJTIwJTIzJTIwU2F2ZSUyMGFzJTIwUGFycXVldA==",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}}),Bl=new U({props:{title:"下一步",local:"下一步",headingTag:"h2"}}),kl=new Ft({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/enterprise_cookbook_argilla.md"}}),{c(){T=M("meta"),I=a(),m=M("p"),Xl=a(),j(h.$$.fragment),Nl=a(),j(u.$$.fragment),Vl=a(),b=M("p"),b.innerHTML=Ds,vl=a(),g=M("p"),g.textContent=Ps,Ql=a(),C=M("p"),C.innerHTML=Ks,Hl=a(),f=M("p"),f.innerHTML=Os,_l=a(),B=M("ol"),B.innerHTML=lt,Yl=a(),A=M("p"),A.textContent=st,Fl=a(),j(G.$$.fragment),zl=a(),j(Z.$$.fragment),$l=a(),j(R.$$.fragment),Sl=a(),j(k.$$.fragment),xl=a(),X=M("p"),X.innerHTML=tt,ql=a(),j(W.$$.fragment),Ll=a(),E=M("pre"),E.textContent=et,Dl=a(),j(N.$$.fragment),Pl=a(),j(V.$$.fragment),Kl=a(),v=M("p"),v.innerHTML=at,Ol=a(),j(Q.$$.fragment),ls=a(),H=M("pre"),H.innerHTML=nt,ss=a(),j(_.$$.fragment),ts=a(),Y=M("p"),Y.innerHTML=Mt,es=a(),j(F.$$.fragment),as=a(),z=M("p"),z.innerHTML=pt,ns=a(),j(d.$$.fragment),Ms=a(),j($.$$.fragment),ps=a(),S=M("pre"),S.textContent=it,is=a(),j(x.$$.fragment),js=a(),q=M("p"),q.textContent=jt,os=a(),j(L.$$.fragment),ys=a(),j(D.$$.fragment),Js=a(),P=M("p"),P.innerHTML=ot,rs=a(),K=M("p"),K.innerHTML=yt,cs=a(),O=M("p"),O.innerHTML=Jt,Ts=a(),j(ll.$$.fragment),Us=a(),sl=M("p"),sl.textContent=rt,ws=a(),tl=M("p"),tl.innerHTML=ct,ms=a(),j(el.$$.fragment),ds=a(),j(al.$$.fragment),Is=a(),j(nl.$$.fragment),hs=a(),Ml=M("p"),Ml.textContent=Tt,us=a(),pl=M("ul"),pl.innerHTML=Ut,bs=a(),il=M("p"),il.innerHTML=wt,gs=a(),j(jl.$$.fragment),Cs=a(),ol=M("p"),ol.innerHTML=mt,fs=a(),j(yl.$$.fragment),Bs=a(),Jl=M("p"),Jl.innerHTML=dt,As=a(),j(rl.$$.fragment),Gs=a(),cl=M("p"),cl.innerHTML=It,Zs=a(),j(Tl.$$.fragment),Rs=a(),Ul=M("p"),Ul.textContent=ht,ks=a(),j(wl.$$.fragment),Xs=a(),ml=M("p"),ml.innerHTML=ut,Ws=a(),dl=M("p"),dl.innerHTML=bt,Es=a(),j(Il.$$.fragment),Ns=a(),hl=M("p"),hl.innerHTML=gt,Vs=a(),ul=M("p"),ul.innerHTML=Ct,vs=a(),j(bl.$$.fragment),Qs=a(),gl=M("p"),gl.innerHTML=ft,Hs=a(),j(Cl.$$.fragment),_s=a(),j(fl.$$.fragment),Ys=a(),j(Bl.$$.fragment),Fs=a(),Al=M("p"),Al.textContent=Bt,zs=a(),Gl=M("p"),Gl.innerHTML=At,$s=a(),Zl=M("ol"),Zl.innerHTML=Gt,Ss=a(),Rl=M("p"),Rl.innerHTML=Zt,xs=a(),j(kl.$$.fragment),qs=a(),Wl=M("p"),this.h()},l(l){const s=Qt("svelte-u9bgzb",document.head);T=p(s,"META",{name:!0,content:!0}),s.forEach(t),I=n(l),m=p(l,"P",{}),kt(m).forEach(t),Xl=n(l),o(h.$$.fragment,l),Nl=n(l),o(u.$$.fragment,l),Vl=n(l),b=p(l,"P",{"data-svelte-h":!0}),i(b)!=="svelte-3hq2ql"&&(b.innerHTML=Ds),vl=n(l),g=p(l,"P",{"data-svelte-h":!0}),i(g)!=="svelte-5bsxi4"&&(g.textContent=Ps),Ql=n(l),C=p(l,"P",{"data-svelte-h":!0}),i(C)!=="svelte-uewmey"&&(C.innerHTML=Ks),Hl=n(l),f=p(l,"P",{"data-svelte-h":!0}),i(f)!=="svelte-1s5xl1q"&&(f.innerHTML=Os),_l=n(l),B=p(l,"OL",{"data-svelte-h":!0}),i(B)!=="svelte-pq8e2z"&&(B.innerHTML=lt),Yl=n(l),A=p(l,"P",{"data-svelte-h":!0}),i(A)!=="svelte-z55tsm"&&(A.textContent=st),Fl=n(l),o(G.$$.fragment,l),zl=n(l),o(Z.$$.fragment,l),$l=n(l),o(R.$$.fragment,l),Sl=n(l),o(k.$$.fragment,l),xl=n(l),X=p(l,"P",{"data-svelte-h":!0}),i(X)!=="svelte-1ood0tp"&&(X.innerHTML=tt),ql=n(l),o(W.$$.fragment,l),Ll=n(l),E=p(l,"PRE",{"data-svelte-h":!0}),i(E)!=="svelte-ky4em7"&&(E.textContent=et),Dl=n(l),o(N.$$.fragment,l),Pl=n(l),o(V.$$.fragment,l),Kl=n(l),v=p(l,"P",{"data-svelte-h":!0}),i(v)!=="svelte-1gnpot2"&&(v.innerHTML=at),Ol=n(l),o(Q.$$.fragment,l),ls=n(l),H=p(l,"PRE",{"data-svelte-h":!0}),i(H)!=="svelte-dhulxx"&&(H.innerHTML=nt),ss=n(l),o(_.$$.fragment,l),ts=n(l),Y=p(l,"P",{"data-svelte-h":!0}),i(Y)!=="svelte-mbp9md"&&(Y.innerHTML=Mt),es=n(l),o(F.$$.fragment,l),as=n(l),z=p(l,"P",{"data-svelte-h":!0}),i(z)!=="svelte-109tm8b"&&(z.innerHTML=pt),ns=n(l),o(d.$$.fragment,l),Ms=n(l),o($.$$.fragment,l),ps=n(l),S=p(l,"PRE",{"data-svelte-h":!0}),i(S)!=="svelte-13ofkmd"&&(S.textContent=it),is=n(l),o(x.$$.fragment,l),js=n(l),q=p(l,"P",{"data-svelte-h":!0}),i(q)!=="svelte-b78kna"&&(q.textContent=jt),os=n(l),o(L.$$.fragment,l),ys=n(l),o(D.$$.fragment,l),Js=n(l),P=p(l,"P",{"data-svelte-h":!0}),i(P)!=="svelte-1esvh62"&&(P.innerHTML=ot),rs=n(l),K=p(l,"P",{"data-svelte-h":!0}),i(K)!=="svelte-1o2b49n"&&(K.innerHTML=yt),cs=n(l),O=p(l,"P",{"data-svelte-h":!0}),i(O)!=="svelte-1lfl07j"&&(O.innerHTML=Jt),Ts=n(l),o(ll.$$.fragment,l),Us=n(l),sl=p(l,"P",{"data-svelte-h":!0}),i(sl)!=="svelte-1jmksr9"&&(sl.textContent=rt),ws=n(l),tl=p(l,"P",{"data-svelte-h":!0}),i(tl)!=="svelte-tdn7u2"&&(tl.innerHTML=ct),ms=n(l),o(el.$$.fragment,l),ds=n(l),o(al.$$.fragment,l),Is=n(l),o(nl.$$.fragment,l),hs=n(l),Ml=p(l,"P",{"data-svelte-h":!0}),i(Ml)!=="svelte-1jr0k5l"&&(Ml.textContent=Tt),us=n(l),pl=p(l,"UL",{"data-svelte-h":!0}),i(pl)!=="svelte-ihrrq8"&&(pl.innerHTML=Ut),bs=n(l),il=p(l,"P",{"data-svelte-h":!0}),i(il)!=="svelte-124hl3m"&&(il.innerHTML=wt),gs=n(l),o(jl.$$.fragment,l),Cs=n(l),ol=p(l,"P",{"data-svelte-h":!0}),i(ol)!=="svelte-vw9s38"&&(ol.innerHTML=mt),fs=n(l),o(yl.$$.fragment,l),Bs=n(l),Jl=p(l,"P",{"data-svelte-h":!0}),i(Jl)!=="svelte-r6kix8"&&(Jl.innerHTML=dt),As=n(l),o(rl.$$.fragment,l),Gs=n(l),cl=p(l,"P",{"data-svelte-h":!0}),i(cl)!=="svelte-1913iw8"&&(cl.innerHTML=It),Zs=n(l),o(Tl.$$.fragment,l),Rs=n(l),Ul=p(l,"P",{"data-svelte-h":!0}),i(Ul)!=="svelte-g1s4dk"&&(Ul.textContent=ht),ks=n(l),o(wl.$$.fragment,l),Xs=n(l),ml=p(l,"P",{"data-svelte-h":!0}),i(ml)!=="svelte-8911g6"&&(ml.innerHTML=ut),Ws=n(l),dl=p(l,"P",{"data-svelte-h":!0}),i(dl)!=="svelte-1tsxy4g"&&(dl.innerHTML=bt),Es=n(l),o(Il.$$.fragment,l),Ns=n(l),hl=p(l,"P",{"data-svelte-h":!0}),i(hl)!=="svelte-g1zszt"&&(hl.innerHTML=gt),Vs=n(l),ul=p(l,"P",{"data-svelte-h":!0}),i(ul)!=="svelte-ntnlj4"&&(ul.innerHTML=Ct),vs=n(l),o(bl.$$.fragment,l),Qs=n(l),gl=p(l,"P",{"data-svelte-h":!0}),i(gl)!=="svelte-13nruxn"&&(gl.innerHTML=ft),Hs=n(l),o(Cl.$$.fragment,l),_s=n(l),o(fl.$$.fragment,l),Ys=n(l),o(Bl.$$.fragment,l),Fs=n(l),Al=p(l,"P",{"data-svelte-h":!0}),i(Al)!=="svelte-xwc7vz"&&(Al.textContent=Bt),zs=n(l),Gl=p(l,"P",{"data-svelte-h":!0}),i(Gl)!=="svelte-q0lwoe"&&(Gl.innerHTML=At),$s=n(l),Zl=p(l,"OL",{"data-svelte-h":!0}),i(Zl)!=="svelte-kci0kg"&&(Zl.innerHTML=Gt),Ss=n(l),Rl=p(l,"P",{"data-svelte-h":!0}),i(Rl)!=="svelte-lg8krs"&&(Rl.innerHTML=Zt),xs=n(l),o(kl.$$.fragment,l),qs=n(l),Wl=p(l,"P",{}),kt(Wl).forEach(t),this.h()},h(){Xt(T,"name","hf:doc:metadata"),Xt(T,"content",St)},m(l,s){Ht(document.head,T),e(l,I,s),e(l,m,s),e(l,Xl,s),y(h,l,s),e(l,Nl,s),y(u,l,s),e(l,Vl,s),e(l,b,s),e(l,vl,s),e(l,g,s),e(l,Ql,s),e(l,C,s),e(l,Hl,s),e(l,f,s),e(l,_l,s),e(l,B,s),e(l,Yl,s),e(l,A,s),e(l,Fl,s),y(G,l,s),e(l,zl,s),y(Z,l,s),e(l,$l,s),y(R,l,s),e(l,Sl,s),y(k,l,s),e(l,xl,s),e(l,X,s),e(l,ql,s),y(W,l,s),e(l,Ll,s),e(l,E,s),e(l,Dl,s),y(N,l,s),e(l,Pl,s),y(V,l,s),e(l,Kl,s),e(l,v,s),e(l,Ol,s),y(Q,l,s),e(l,ls,s),e(l,H,s),e(l,ss,s),y(_,l,s),e(l,ts,s),e(l,Y,s),e(l,es,s),y(F,l,s),e(l,as,s),e(l,z,s),e(l,ns,s),y(d,l,s),e(l,Ms,s),y($,l,s),e(l,ps,s),e(l,S,s),e(l,is,s),y(x,l,s),e(l,js,s),e(l,q,s),e(l,os,s),y(L,l,s),e(l,ys,s),y(D,l,s),e(l,Js,s),e(l,P,s),e(l,rs,s),e(l,K,s),e(l,cs,s),e(l,O,s),e(l,Ts,s),y(ll,l,s),e(l,Us,s),e(l,sl,s),e(l,ws,s),e(l,tl,s),e(l,ms,s),y(el,l,s),e(l,ds,s),y(al,l,s),e(l,Is,s),y(nl,l,s),e(l,hs,s),e(l,Ml,s),e(l,us,s),e(l,pl,s),e(l,bs,s),e(l,il,s),e(l,gs,s),y(jl,l,s),e(l,Cs,s),e(l,ol,s),e(l,fs,s),y(yl,l,s),e(l,Bs,s),e(l,Jl,s),e(l,As,s),y(rl,l,s),e(l,Gs,s),e(l,cl,s),e(l,Zs,s),y(Tl,l,s),e(l,Rs,s),e(l,Ul,s),e(l,ks,s),y(wl,l,s),e(l,Xs,s),e(l,ml,s),e(l,Ws,s),e(l,dl,s),e(l,Es,s),y(Il,l,s),e(l,Ns,s),e(l,hl,s),e(l,Vs,s),e(l,ul,s),e(l,vs,s),y(bl,l,s),e(l,Qs,s),e(l,gl,s),e(l,Hs,s),y(Cl,l,s),e(l,_s,s),y(fl,l,s),e(l,Ys,s),y(Bl,l,s),e(l,Fs,s),e(l,Al,s),e(l,zs,s),e(l,Gl,s),e(l,$s,s),e(l,Zl,s),e(l,Ss,s),e(l,Rl,s),e(l,xs,s),y(kl,l,s),e(l,qs,s),e(l,Wl,s),Ls=!0},p(l,[s]){const Rt={};s&2&&(Rt.$$scope={dirty:s,ctx:l}),d.$set(Rt)},i(l){Ls||(J(h.$$.fragment,l),J(u.$$.fragment,l),J(G.$$.fragment,l),J(Z.$$.fragment,l),J(R.$$.fragment,l),J(k.$$.fragment,l),J(W.$$.fragment,l),J(N.$$.fragment,l),J(V.$$.fragment,l),J(Q.$$.fragment,l),J(_.$$.fragment,l),J(F.$$.fragment,l),J(d.$$.fragment,l),J($.$$.fragment,l),J(x.$$.fragment,l),J(L.$$.fragment,l),J(D.$$.fragment,l),J(ll.$$.fragment,l),J(el.$$.fragment,l),J(al.$$.fragment,l),J(nl.$$.fragment,l),J(jl.$$.fragment,l),J(yl.$$.fragment,l),J(rl.$$.fragment,l),J(Tl.$$.fragment,l),J(wl.$$.fragment,l),J(Il.$$.fragment,l),J(bl.$$.fragment,l),J(Cl.$$.fragment,l),J(fl.$$.fragment,l),J(Bl.$$.fragment,l),J(kl.$$.fragment,l),Ls=!0)},o(l){r(h.$$.fragment,l),r(u.$$.fragment,l),r(G.$$.fragment,l),r(Z.$$.fragment,l),r(R.$$.fragment,l),r(k.$$.fragment,l),r(W.$$.fragment,l),r(N.$$.fragment,l),r(V.$$.fragment,l),r(Q.$$.fragment,l),r(_.$$.fragment,l),r(F.$$.fragment,l),r(d.$$.fragment,l),r($.$$.fragment,l),r(x.$$.fragment,l),r(L.$$.fragment,l),r(D.$$.fragment,l),r(ll.$$.fragment,l),r(el.$$.fragment,l),r(al.$$.fragment,l),r(nl.$$.fragment,l),r(jl.$$.fragment,l),r(yl.$$.fragment,l),r(rl.$$.fragment,l),r(Tl.$$.fragment,l),r(wl.$$.fragment,l),r(Il.$$.fragment,l),r(bl.$$.fragment,l),r(Cl.$$.fragment,l),r(fl.$$.fragment,l),r(Bl.$$.fragment,l),r(kl.$$.fragment,l),Ls=!1},d(l){l&&(t(I),t(m),t(Xl),t(Nl),t(Vl),t(b),t(vl),t(g),t(Ql),t(C),t(Hl),t(f),t(_l),t(B),t(Yl),t(A),t(Fl),t(zl),t($l),t(Sl),t(xl),t(X),t(ql),t(Ll),t(E),t(Dl),t(Pl),t(Kl),t(v),t(Ol),t(ls),t(H),t(ss),t(ts),t(Y),t(es),t(as),t(z),t(ns),t(Ms),t(ps),t(S),t(is),t(js),t(q),t(os),t(ys),t(Js),t(P),t(rs),t(K),t(cs),t(O),t(Ts),t(Us),t(sl),t(ws),t(tl),t(ms),t(ds),t(Is),t(hs),t(Ml),t(us),t(pl),t(bs),t(il),t(gs),t(Cs),t(ol),t(fs),t(Bs),t(Jl),t(As),t(Gs),t(cl),t(Zs),t(Rs),t(Ul),t(ks),t(Xs),t(ml),t(Ws),t(dl),t(Es),t(Ns),t(hl),t(Vs),t(ul),t(vs),t(Qs),t(gl),t(Hs),t(_s),t(Ys),t(Fs),t(Al),t(zs),t(Gl),t($s),t(Zl),t(Ss),t(Rl),t(xs),t(qs),t(Wl)),t(T),c(h,l),c(u,l),c(G,l),c(Z,l),c(R,l),c(k,l),c(W,l),c(N,l),c(V,l),c(Q,l),c(_,l),c(F,l),c(d,l),c($,l),c(x,l),c(L,l),c(D,l),c(ll,l),c(el,l),c(al,l),c(nl,l),c(jl,l),c(yl,l),c(rl,l),c(Tl,l),c(wl,l),c(Il,l),c(bl,l),c(Cl,l),c(fl,l),c(Bl,l),c(kl,l)}}}const St='{"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 xt(El){return Et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ot extends Vt{constructor(T){super(),vt(this,T,xt,$t,Wt,{})}}export{Ot as component};
