import{s as Z,o as L,n as S}from"../chunks/scheduler.5f3e6389.js";import{S as z,i as A,e as $,s as c,c as J,h as Y,a as w,d as s,b as p,f as N,g as T,j as X,k as H,l as P,m as o,n as y,t as x,o as I,p as j}from"../chunks/index.62df735e.js";import{C as O,H as R,E as K}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e306bd5b.js";import{D as tt}from"../chunks/Docstring.88e8f8ba.js";import{C as et}from"../chunks/CodeBlock.dc1e8be0.js";import{E as at}from"../chunks/ExampleCodeBlock.7e3fcb1f.js";function st(C){let n,_="Example:",d,r,l;return r=new et({props:{code:"cHVzaF90b19odWIoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlM0QlMjJodWdnaW5nZmFjZSUyRmdwdDItd2lraXRleHQyJTIyJTJDJTBBJTIwJTIwJTIwJTIwbWV0cmljX3ZhbHVlJTNEMC41JTBBJTIwJTIwJTIwJTIwbWV0cmljX3R5cGUlM0QlMjJibGV1JTIyJTJDJTBBJTIwJTIwJTIwJTIwbWV0cmljX25hbWUlM0QlMjJCTEVVJTIyJTJDJTBBJTIwJTIwJTIwJTIwZGF0YXNldF9uYW1lJTNEJTIyV2lraVRleHQlMjIlMkMlMEElMjAlMjAlMjAlMjBkYXRhc2V0X3R5cGUlM0QlMjJ3aWtpdGV4dCUyMiUyQyUwQSUyMCUyMCUyMCUyMGRhdGFzZXRfc3BsaXQlM0QlMjJ0ZXN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdGFza190eXBlJTNEJTIydGV4dC1nZW5lcmF0aW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGFza19uYW1lJTNEJTIyVGV4dCUyMEdlbmVyYXRpb24lMjIlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub(
<span class="hljs-meta">... </span>    model_id=<span class="hljs-string">&quot;huggingface/gpt2-wikitext2&quot;</span>,
<span class="hljs-meta">... </span>    metric_value=<span class="hljs-number">0.5</span>
<span class="hljs-meta">... </span>    metric_type=<span class="hljs-string">&quot;bleu&quot;</span>,
<span class="hljs-meta">... </span>    metric_name=<span class="hljs-string">&quot;BLEU&quot;</span>,
<span class="hljs-meta">... </span>    dataset_name=<span class="hljs-string">&quot;WikiText&quot;</span>,
<span class="hljs-meta">... </span>    dataset_type=<span class="hljs-string">&quot;wikitext&quot;</span>,
<span class="hljs-meta">... </span>    dataset_split=<span class="hljs-string">&quot;test&quot;</span>,
<span class="hljs-meta">... </span>    task_type=<span class="hljs-string">&quot;text-generation&quot;</span>,
<span class="hljs-meta">... </span>    task_name=<span class="hljs-string">&quot;Text Generation&quot;</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),{c(){n=$("p"),n.textContent=_,d=c(),J(r.$$.fragment)},l(a){n=w(a,"P",{"data-svelte-h":!0}),X(n)!=="svelte-11lpom8"&&(n.textContent=_),d=p(a),T(r.$$.fragment,a)},m(a,i){o(a,n,i),o(a,d,i),y(r,a,i),l=!0},p:S,i(a){l||(x(r.$$.fragment,a),l=!0)},o(a){I(r.$$.fragment,a),l=!1},d(a){a&&(s(n),s(d)),j(r,a)}}}function nt(C){let n,_,d,r,l,a,i,E,g,F="Methods for using the Hugging Face Hub:",B,f,q,m,v,U,M,Q="Pushes the result of a metric to the metadata of a model repository in the Hub.",D,h,V,b,W,k,G;return l=new O({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),i=new R({props:{title:"Hub methods",local:"hub-methods",headingTag:"h1"}}),f=new R({props:{title:"Push to hub",local:"evaluate.push_to_hub",headingTag:"h2"}}),v=new tt({props:{name:"evaluate.push_to_hub",anchor:"evaluate.push_to_hub",parameters:[{name:"model_id",val:": str"},{name:"task_type",val:": str"},{name:"dataset_type",val:": str"},{name:"dataset_name",val:": str"},{name:"metric_type",val:": str"},{name:"metric_name",val:": str"},{name:"metric_value",val:": float"},{name:"task_name",val:": str = None"},{name:"dataset_config",val:": str = None"},{name:"dataset_split",val:": str = None"},{name:"dataset_revision",val:": str = None"},{name:"dataset_args",val:": typing.Dict[str, int] = None"},{name:"metric_config",val:": str = None"},{name:"metric_args",val:": typing.Dict[str, int] = None"},{name:"overwrite",val:": bool = False"}],parametersDescription:[{anchor:"evaluate.push_to_hub.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
Model id from <a href="https://hf.co/models" rel="nofollow">https://hf.co/models</a>.`,name:"model_id"},{anchor:"evaluate.push_to_hub.task_type",description:`<strong>task_type</strong> (<code>str</code>) &#x2014;
Task id, refer to the <a href="https://github.com/huggingface/evaluate/blob/main/src/evaluate/config.py#L154" rel="nofollow">Hub allowed tasks</a> for allowed values.`,name:"task_type"},{anchor:"evaluate.push_to_hub.dataset_type",description:`<strong>dataset_type</strong> (<code>str</code>) &#x2014;
Dataset id from <a href="https://hf.co/datasets" rel="nofollow">https://hf.co/datasets</a>.`,name:"dataset_type"},{anchor:"evaluate.push_to_hub.dataset_name",description:`<strong>dataset_name</strong> (<code>str</code>) &#x2014;
Pretty name for the dataset.`,name:"dataset_name"},{anchor:"evaluate.push_to_hub.metric_type",description:`<strong>metric_type</strong> (<code>str</code>) &#x2014;
Metric id from <a href="https://hf.co/metrics" rel="nofollow">https://hf.co/metrics</a>.`,name:"metric_type"},{anchor:"evaluate.push_to_hub.metric_name",description:`<strong>metric_name</strong> (<code>str</code>) &#x2014;
Pretty name for the metric.`,name:"metric_name"},{anchor:"evaluate.push_to_hub.metric_value",description:`<strong>metric_value</strong> (<code>float</code>) &#x2014;
Computed metric value.`,name:"metric_value"},{anchor:"evaluate.push_to_hub.task_name",description:`<strong>task_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pretty name for the task.`,name:"task_name"},{anchor:"evaluate.push_to_hub.dataset_config",description:`<strong>dataset_config</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Dataset configuration used in <a href="https://huggingface.co/docs/datasets/main/en/package_reference/loading_methods#datasets.load_dataset" rel="nofollow">load_dataset</a>.
See <a href="https://huggingface.co/docs/datasets/main/en/package_reference/loading_methods#datasets.load_dataset" rel="nofollow">load_dataset</a> for more info.`,name:"dataset_config"},{anchor:"evaluate.push_to_hub.dataset_split",description:`<strong>dataset_split</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of split used for metric computation.`,name:"dataset_split"},{anchor:"evaluate.push_to_hub.dataset_revision",description:`<strong>dataset_revision</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Git hash for the specific version of the dataset.`,name:"dataset_revision"},{anchor:"evaluate.push_to_hub.dataset_args",description:`<strong>dataset_args</strong> (<code>dict[str, int]</code>, <em>optional</em>) &#x2014;
Additional arguments passed to <a href="https://huggingface.co/docs/datasets/main/en/package_reference/loading_methods#datasets.load_dataset" rel="nofollow">load_dataset</a>.`,name:"dataset_args"},{anchor:"evaluate.push_to_hub.metric_config",description:`<strong>metric_config</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Configuration for the metric (e.g. the GLUE metric has a configuration for each subset).`,name:"metric_config"},{anchor:"evaluate.push_to_hub.metric_args",description:`<strong>metric_args</strong> (<code>dict[str, int]</code>, <em>optional</em>) &#x2014;
Arguments passed during <a href="/docs/evaluate/main/en/package_reference/main_classes#evaluate.EvaluationModule.compute">compute()</a>.`,name:"metric_args"},{anchor:"evaluate.push_to_hub.overwrite",description:`<strong>overwrite</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code> an existing metric field can be overwritten, otherwise
attempting to overwrite any existing fields will cause an error.`,name:"overwrite"}],source:"https://github.com/huggingface/evaluate/blob/main/src/evaluate/hub.py#L14"}}),h=new at({props:{anchor:"evaluate.push_to_hub.example",$$slots:{default:[st]},$$scope:{ctx:C}}}),b=new K({props:{source:"https://github.com/huggingface/evaluate/blob/main/docs/source/package_reference/hub_methods.mdx"}}),{c(){n=$("meta"),_=c(),d=$("p"),r=c(),J(l.$$.fragment),a=c(),J(i.$$.fragment),E=c(),g=$("p"),g.textContent=F,B=c(),J(f.$$.fragment),q=c(),m=$("div"),J(v.$$.fragment),U=c(),M=$("p"),M.textContent=Q,D=c(),J(h.$$.fragment),V=c(),J(b.$$.fragment),W=c(),k=$("p"),this.h()},l(t){const e=Y("svelte-u9bgzb",document.head);n=w(e,"META",{name:!0,content:!0}),e.forEach(s),_=p(t),d=w(t,"P",{}),N(d).forEach(s),r=p(t),T(l.$$.fragment,t),a=p(t),T(i.$$.fragment,t),E=p(t),g=w(t,"P",{"data-svelte-h":!0}),X(g)!=="svelte-11qexm1"&&(g.textContent=F),B=p(t),T(f.$$.fragment,t),q=p(t),m=w(t,"DIV",{class:!0});var u=N(m);T(v.$$.fragment,u),U=p(u),M=w(u,"P",{"data-svelte-h":!0}),X(M)!=="svelte-gnsh13"&&(M.textContent=Q),D=p(u),T(h.$$.fragment,u),u.forEach(s),V=p(t),T(b.$$.fragment,t),W=p(t),k=w(t,"P",{}),N(k).forEach(s),this.h()},h(){H(n,"name","hf:doc:metadata"),H(n,"content",ot),H(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,e){P(document.head,n),o(t,_,e),o(t,d,e),o(t,r,e),y(l,t,e),o(t,a,e),y(i,t,e),o(t,E,e),o(t,g,e),o(t,B,e),y(f,t,e),o(t,q,e),o(t,m,e),y(v,m,null),P(m,U),P(m,M),P(m,D),y(h,m,null),o(t,V,e),y(b,t,e),o(t,W,e),o(t,k,e),G=!0},p(t,[e]){const u={};e&2&&(u.$$scope={dirty:e,ctx:t}),h.$set(u)},i(t){G||(x(l.$$.fragment,t),x(i.$$.fragment,t),x(f.$$.fragment,t),x(v.$$.fragment,t),x(h.$$.fragment,t),x(b.$$.fragment,t),G=!0)},o(t){I(l.$$.fragment,t),I(i.$$.fragment,t),I(f.$$.fragment,t),I(v.$$.fragment,t),I(h.$$.fragment,t),I(b.$$.fragment,t),G=!1},d(t){t&&(s(_),s(d),s(r),s(a),s(E),s(g),s(B),s(q),s(m),s(V),s(W),s(k)),s(n),j(l,t),j(i,t),j(f,t),j(v),j(h),j(b,t)}}}const ot='{"title":"Hub methods","local":"hub-methods","sections":[{"title":"Push to hub","local":"evaluate.push_to_hub","sections":[],"depth":2}],"depth":1}';function rt(C){return L(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ut extends z{constructor(n){super(),A(this,n,rt,nt,Z,{})}}export{ut as component};
