Buckets:

rtrm's picture
download
raw
11.6 kB
import{s as ht,o as ct,n as ut}from"../chunks/scheduler.ddb4e551.js";import{S as $t,i as bt,g as r,s as l,r as g,B as wt,h as o,f as n,c as a,j as mt,u as f,x as u,k as pt,y as yt,a as i,v as m,d as p,t as h,w as c}from"../chunks/index.e16e4efa.js";import{T as vt}from"../chunks/Tip.20abb04f.js";import{H as q,E as kt}from"../chunks/index.e108c5ed.js";import{I as Tt}from"../chunks/InferenceSnippet.8df18a84.js";function _t(N){let s,b='For more details about the <code>token-classification</code> task, check out its <a href="https://huggingface.co/tasks/token-classification" rel="nofollow">dedicated page</a>! You will find examples and related materials.';return{c(){s=r("p"),s.innerHTML=b},l(d){s=o(d,"P",{"data-svelte-h":!0}),u(s)!=="svelte-xosqv4"&&(s.innerHTML=b)},m(d,S){i(d,s,S)},p:ut,d(d){d&&n(s)}}}function xt(N){let s,b,d,S,w,B,y,it="Token classification is a task in which a label is assigned to some tokens in a text. Some popular token classification subtasks are Named Entity Recognition (NER) and Part-of-Speech (PoS) tagging.",j,$,F,v,U,k,lt='<li><a href="https://huggingface.co/dslim/bert-base-NER" rel="nofollow">dslim/bert-base-NER</a>: A robust performance model to identify people, locations, organizations and names of miscellaneous entities.</li> <li><a href="https://huggingface.co/FacebookAI/xlm-roberta-large-finetuned-conll03-english" rel="nofollow">FacebookAI/xlm-roberta-large-finetuned-conll03-english</a>: A strong model to identify people, locations, organizations and names in multiple languages.</li> <li><a href="https://huggingface.co/blaze999/Medical-NER" rel="nofollow">blaze999/Medical-NER</a>: A token classification model specialized on medical entity recognition.</li> <li><a href="https://huggingface.co/flair/ner-english" rel="nofollow">flair/ner-english</a>: Flair models are typically the state of the art in named entity recognition tasks.</li>',D,T,at='Explore all available models and find the one that suits you best <a href="https://huggingface.co/models?inference=warm&amp;pipeline_tag=token-classification&amp;sort=trending" rel="nofollow">here</a>.',O,_,G,x,Y,P,J,M,K,I,st='<thead><tr><th align="left">Payload</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>inputs*</strong></td> <td align="left"><em>string</em></td> <td align="left">The input text data</td></tr> <tr><td align="left"><strong>parameters</strong></td> <td align="left"><em>object</em></td> <td align="left"></td></tr> <tr><td align="left"><strong>        ignore_labels</strong></td> <td align="left"><em>string[]</em></td> <td align="left">A list of labels to ignore</td></tr> <tr><td align="left"><strong>        stride</strong></td> <td align="left"><em>integer</em></td> <td align="left">The number of overlapping tokens between chunks when splitting the input text.</td></tr> <tr><td align="left"><strong>        aggregation_strategy</strong></td> <td align="left"><em>string</em></td> <td align="left">One of the following:</td></tr> <tr><td align="left"><strong>                 (#1)</strong></td> <td align="left"><em>’none’</em></td> <td align="left">Do not aggregate tokens</td></tr> <tr><td align="left"><strong>                 (#2)</strong></td> <td align="left"><em>’simple’</em></td> <td align="left">Group consecutive tokens with the same label in a single entity.</td></tr> <tr><td align="left"><strong>                 (#3)</strong></td> <td align="left"><em>’first’</em></td> <td align="left">Similar to “simple”, also preserves word integrity (use the label predicted for the first token in a word).</td></tr> <tr><td align="left"><strong>                 (#4)</strong></td> <td align="left"><em>’average’</em></td> <td align="left">Similar to “simple”, also preserves word integrity (uses the label with the highest score, averaged across the word’s tokens).</td></tr> <tr><td align="left"><strong>                 (#5)</strong></td> <td align="left"><em>’max’</em></td> <td align="left">Similar to “simple”, also preserves word integrity (uses the label with the highest score across the word’s tokens).</td></tr></tbody>',Q,A,rt="Some options can be configured by passing headers to the Inference API. Here are the available headers:",V,H,ot='<thead><tr><th align="left">Headers</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>authorization</strong></td> <td align="left"><em>string</em></td> <td align="left">Authentication header in the form <code>&#39;Bearer: hf_****&#39;</code> when <code>hf_****</code> is a personal user access token with Inference API permission. You can generate one from <a href="https://huggingface.co/settings/tokens" rel="nofollow">your settings page</a>.</td></tr> <tr><td align="left"><strong>x-use-cache</strong></td> <td align="left"><em>boolean, default to <code>true</code></em></td> <td align="left">There is a cache layer on the inference API to speed up requests we have already seen. Most models can use those results as they are deterministic (meaning the outputs will be the same anyway). However, if you use a nondeterministic model, you can set this parameter to prevent the caching mechanism from being used, resulting in a real new query. Read more about caching <a href="../parameters#caching%5D">here</a>.</td></tr> <tr><td align="left"><strong>x-wait-for-model</strong></td> <td align="left"><em>boolean, default to <code>false</code></em></td> <td align="left">If the model is not ready, wait for it instead of receiving 503. It limits the number of requests required to get your inference done. It is advised to only set this flag to true after receiving a 503 error, as it will limit hanging in your application to known places. Read more about model availability <a href="../overview#eligibility%5D">here</a>.</td></tr></tbody>',W,L,dt='For more information about Inference API headers, check out the parameters <a href="../parameters">guide</a>.',X,E,Z,R,gt='<thead><tr><th align="left">Body</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>(array)</strong></td> <td align="left"><em>object[]</em></td> <td align="left">Output is an array of objects.</td></tr> <tr><td align="left"><strong>        entity_group</strong></td> <td align="left"><em>string</em></td> <td align="left">The predicted label for a group of one or more tokens</td></tr> <tr><td align="left"><strong>        entity</strong></td> <td align="left"><em>string</em></td> <td align="left">The predicted label for a single token</td></tr> <tr><td align="left"><strong>        score</strong></td> <td align="left"><em>number</em></td> <td align="left">The associated score / probability</td></tr> <tr><td align="left"><strong>        word</strong></td> <td align="left"><em>string</em></td> <td align="left">The corresponding text</td></tr> <tr><td align="left"><strong>        start</strong></td> <td align="left"><em>integer</em></td> <td align="left">The character position in the input where this group begins.</td></tr> <tr><td align="left"><strong>        end</strong></td> <td align="left"><em>integer</em></td> <td align="left">The character position in the input where this group ends.</td></tr></tbody>',tt,C,et,z,nt;return w=new q({props:{title:"Token Classification",local:"token-classification",headingTag:"h2"}}),$=new vt({props:{$$slots:{default:[_t]},$$scope:{ctx:N}}}),v=new q({props:{title:"Recommended models",local:"recommended-models",headingTag:"h3"}}),_=new q({props:{title:"Using the API",local:"using-the-api",headingTag:"h3"}}),x=new Tt({props:{pipeline:"token-classification",providersMapping:{"hf-inference":{modelId:"dslim/bert-base-NER",providerModelId:"dslim/bert-base-NER"}}}}),P=new q({props:{title:"API specification",local:"api-specification",headingTag:"h3"}}),M=new q({props:{title:"Request",local:"request",headingTag:"h4"}}),E=new q({props:{title:"Response",local:"response",headingTag:"h4"}}),C=new kt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/tasks/token-classification.md"}}),{c(){s=r("meta"),b=l(),d=r("p"),S=l(),g(w.$$.fragment),B=l(),y=r("p"),y.textContent=it,j=l(),g($.$$.fragment),F=l(),g(v.$$.fragment),U=l(),k=r("ul"),k.innerHTML=lt,D=l(),T=r("p"),T.innerHTML=at,O=l(),g(_.$$.fragment),G=l(),g(x.$$.fragment),Y=l(),g(P.$$.fragment),J=l(),g(M.$$.fragment),K=l(),I=r("table"),I.innerHTML=st,Q=l(),A=r("p"),A.textContent=rt,V=l(),H=r("table"),H.innerHTML=ot,W=l(),L=r("p"),L.innerHTML=dt,X=l(),g(E.$$.fragment),Z=l(),R=r("table"),R.innerHTML=gt,tt=l(),g(C.$$.fragment),et=l(),z=r("p"),this.h()},l(t){const e=wt("svelte-u9bgzb",document.head);s=o(e,"META",{name:!0,content:!0}),e.forEach(n),b=a(t),d=o(t,"P",{}),mt(d).forEach(n),S=a(t),f(w.$$.fragment,t),B=a(t),y=o(t,"P",{"data-svelte-h":!0}),u(y)!=="svelte-gykbzu"&&(y.textContent=it),j=a(t),f($.$$.fragment,t),F=a(t),f(v.$$.fragment,t),U=a(t),k=o(t,"UL",{"data-svelte-h":!0}),u(k)!=="svelte-93enhi"&&(k.innerHTML=lt),D=a(t),T=o(t,"P",{"data-svelte-h":!0}),u(T)!=="svelte-tpfnlj"&&(T.innerHTML=at),O=a(t),f(_.$$.fragment,t),G=a(t),f(x.$$.fragment,t),Y=a(t),f(P.$$.fragment,t),J=a(t),f(M.$$.fragment,t),K=a(t),I=o(t,"TABLE",{"data-svelte-h":!0}),u(I)!=="svelte-107xp03"&&(I.innerHTML=st),Q=a(t),A=o(t,"P",{"data-svelte-h":!0}),u(A)!=="svelte-xa4wks"&&(A.textContent=rt),V=a(t),H=o(t,"TABLE",{"data-svelte-h":!0}),u(H)!=="svelte-2rfiu7"&&(H.innerHTML=ot),W=a(t),L=o(t,"P",{"data-svelte-h":!0}),u(L)!=="svelte-1ps9cb1"&&(L.innerHTML=dt),X=a(t),f(E.$$.fragment,t),Z=a(t),R=o(t,"TABLE",{"data-svelte-h":!0}),u(R)!=="svelte-1mtyyyz"&&(R.innerHTML=gt),tt=a(t),f(C.$$.fragment,t),et=a(t),z=o(t,"P",{}),mt(z).forEach(n),this.h()},h(){pt(s,"name","hf:doc:metadata"),pt(s,"content",Pt)},m(t,e){yt(document.head,s),i(t,b,e),i(t,d,e),i(t,S,e),m(w,t,e),i(t,B,e),i(t,y,e),i(t,j,e),m($,t,e),i(t,F,e),m(v,t,e),i(t,U,e),i(t,k,e),i(t,D,e),i(t,T,e),i(t,O,e),m(_,t,e),i(t,G,e),m(x,t,e),i(t,Y,e),m(P,t,e),i(t,J,e),m(M,t,e),i(t,K,e),i(t,I,e),i(t,Q,e),i(t,A,e),i(t,V,e),i(t,H,e),i(t,W,e),i(t,L,e),i(t,X,e),m(E,t,e),i(t,Z,e),i(t,R,e),i(t,tt,e),m(C,t,e),i(t,et,e),i(t,z,e),nt=!0},p(t,[e]){const ft={};e&2&&(ft.$$scope={dirty:e,ctx:t}),$.$set(ft)},i(t){nt||(p(w.$$.fragment,t),p($.$$.fragment,t),p(v.$$.fragment,t),p(_.$$.fragment,t),p(x.$$.fragment,t),p(P.$$.fragment,t),p(M.$$.fragment,t),p(E.$$.fragment,t),p(C.$$.fragment,t),nt=!0)},o(t){h(w.$$.fragment,t),h($.$$.fragment,t),h(v.$$.fragment,t),h(_.$$.fragment,t),h(x.$$.fragment,t),h(P.$$.fragment,t),h(M.$$.fragment,t),h(E.$$.fragment,t),h(C.$$.fragment,t),nt=!1},d(t){t&&(n(b),n(d),n(S),n(B),n(y),n(j),n(F),n(U),n(k),n(D),n(T),n(O),n(G),n(Y),n(J),n(K),n(I),n(Q),n(A),n(V),n(H),n(W),n(L),n(X),n(Z),n(R),n(tt),n(et),n(z)),n(s),c(w,t),c($,t),c(v,t),c(_,t),c(x,t),c(P,t),c(M,t),c(E,t),c(C,t)}}}const Pt='{"title":"Token Classification","local":"token-classification","sections":[{"title":"Recommended models","local":"recommended-models","sections":[],"depth":3},{"title":"Using the API","local":"using-the-api","sections":[],"depth":3},{"title":"API specification","local":"api-specification","sections":[{"title":"Request","local":"request","sections":[],"depth":4},{"title":"Response","local":"response","sections":[],"depth":4}],"depth":3}],"depth":2}';function Mt(N){return ct(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rt extends $t{constructor(s){super(),bt(this,s,Mt,xt,ht,{})}}export{Rt as component};

Xet Storage Details

Size:
11.6 kB
·
Xet hash:
61a0a6b13d50ca4e27713a906b670f095311e4c99c0972ad5a16a68bb4b82519

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.