import{S as zs,i as Ps,s as xs,e as n,k as p,w as y,t as r,M as qs,c as s,d as o,m,a,x as k,h as i,b as d,G as e,g,y as C,q as w,o as T,B as M,v as Is,L as jn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Es}from"../../chunks/Tip-hf-doc-builder.js";import{D as ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Fn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as at}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Un}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bs(P){let c,b,_,u,v;return u=new Fn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENwbUFudE1vZGVsJTJDJTIwQ3BtQW50Q29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMENQTUFudCUyMGNwbS1hbnQtMTBiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMENwbUFudENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMGNwbS1hbnQtMTBiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBDcG1BbnRNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CpmAntModel, CpmAntConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CPMAnt cpm-ant-10b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CpmAntConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the cpm-ant-10b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=n("p"),b=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=s(l,"P",{});var f=a(c);b=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),C(u,l,f),v=!0},p:jn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){T(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function Js(P){let c,b,_,u,v;return{c(){c=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var f=a(c);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var I=a(_);u=i(I,"Module"),I.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,u),e(c,v)},d(l){l&&o(c)}}}function Ws(P){let c,b,_,u,v;return u=new Fn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDcG1BbnRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmJtYiUyRmNwbS1hbnQtMTBiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQ3BtQW50TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5ibWIlMkZjcG0tYW50LTEwYiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CpmAntModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntModel.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=n("p"),b=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=s(l,"P",{});var f=a(c);b=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),C(u,l,f),v=!0},p:jn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){T(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function Us(P){let c,b,_,u,v;return{c(){c=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=r("Module"),v=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var f=a(c);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var I=a(_);u=i(I,"Module"),I.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,u),e(c,v)},d(l){l&&o(c)}}}function js(P){let c,b,_,u,v;return u=new Fn({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENwbUFudEZvckNhdXNhbExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmJtYiUyRmNwbS1hbnQtMTBiJTIyKSUwQW1vZGVsJTIwJTNEJTIwQ3BtQW50Rm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5ibWIlMkZjcG0tYW50LTEwYiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CpmAntForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntForCausalLM.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=n("p"),b=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=s(l,"P",{});var f=a(c);b=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),C(u,l,f),v=!0},p:jn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){T(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function Fs(P){let c,b,_,u,v,l,f,I,Yt,At,U,D,rt,pe,Kt,it,eo,Et,me,to,he,oo,zt,Fe,no,Pt,B,so,ue,ao,ro,fe,io,lo,xt,Le,co,qt,Ne,ge,po,_e,mo,ho,It,j,Q,lt,ve,uo,dt,fo,Bt,A,be,go,F,_o,Se,vo,bo,ye,yo,ko,Co,L,wo,Ge,To,Mo,Ze,$o,Ao,Eo,H,Jt,N,X,ct,ke,zo,pt,Po,Wt,E,Ce,xo,mt,qo,Io,J,we,Bo,ht,Jo,Wo,ut,Te,Uo,ft,jo,Fo,Lo,Y,Me,No,$e,So,gt,Go,Zo,Ut,S,K,_t,Ae,Vo,vt,Oo,jt,z,Ee,Ro,ze,Do,Pe,Qo,Ho,Xo,G,Yo,Ve,Ko,en,Oe,tn,on,nn,x,xe,sn,Z,an,Re,rn,ln,bt,dn,cn,pn,ee,mn,te,Ft,V,oe,yt,qe,hn,kt,un,Lt,$,Ie,fn,Ct,gn,_n,Be,vn,Je,bn,yn,kn,O,Cn,De,wn,Tn,Qe,Mn,$n,An,q,We,En,R,zn,He,Pn,xn,wt,qn,In,Bn,ne,Jn,se,Nt;return l=new at({}),pe=new at({}),ve=new at({}),be=new ce({props:{name:"class transformers.CpmAntConfig",anchor:"transformers.CpmAntConfig",parameters:[{name:"vocab_size",val:": int = 30720"},{name:"hidden_size",val:": int = 4096"},{name:"num_attention_heads",val:": int = 32"},{name:"dim_head",val:": int = 128"},{name:"dim_ff",val:": int = 10240"},{name:"num_hidden_layers",val:": int = 48"},{name:"dropout_p",val:": int = 0.0"},{name:"position_bias_num_buckets",val:": int = 512"},{name:"position_bias_max_distance",val:": int = 2048"},{name:"eps",val:": int = 1e-06"},{name:"init_std",val:": float = 1.0"},{name:"prompt_types",val:": int = 32"},{name:"prompt_length",val:": int = 32"},{name:"segment_types",val:": int = 32"},{name:"use_cache",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30720) &#x2014;
Vocabulary size of the CPMAnt model. Defines the number of different tokens that can be represented by the
<code>input</code> passed when calling <a href="/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntModel">CpmAntModel</a>.`,name:"vocab_size"},{anchor:"transformers.CpmAntConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the encoder layers.`,name:"hidden_size"},{anchor:"transformers.CpmAntConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.CpmAntConfig.dim_head",description:`<strong>dim_head</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Dimension of attention heads for each attention layer in the Transformer encoder.`,name:"dim_head"},{anchor:"transformers.CpmAntConfig.dim_ff",description:`<strong>dim_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 10240) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"dim_ff"},{anchor:"transformers.CpmAntConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 48) &#x2014;
Number of layers of the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.CpmAntConfig.dropout_p",description:`<strong>dropout_p</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder.`,name:"dropout_p"},{anchor:"transformers.CpmAntConfig.position_bias_num_buckets",description:`<strong>position_bias_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The number of position_bias buckets.`,name:"position_bias_num_buckets"},{anchor:"transformers.CpmAntConfig.position_bias_max_distance",description:`<strong>position_bias_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"position_bias_max_distance"},{anchor:"transformers.CpmAntConfig.eps",description:`<strong>eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"eps"},{anchor:"transformers.CpmAntConfig.prompt_types",description:`<strong>prompt_types</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The type of prompt.`,name:"prompt_types"},{anchor:"transformers.CpmAntConfig.prompt_length",description:`<strong>prompt_length</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The length of prompt.`,name:"prompt_length"},{anchor:"transformers.CpmAntConfig.segment_types",description:`<strong>segment_types</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The type of segment.`,name:"segment_types"},{anchor:"transformers.CpmAntConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use cache.`,name:"use_cache"},{anchor:"transformers.CpmAntConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Initialize parameters with std = init_std.`,name:"init_std"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/configuration_cpmant.py#L29"}}),H=new Un({props:{anchor:"transformers.CpmAntConfig.example",$$slots:{default:[Bs]},$$scope:{ctx:P}}}),ke=new at({}),Ce=new ce({props:{name:"class transformers.CpmAntTokenizer",anchor:"transformers.CpmAntTokenizer",parameters:[{name:"vocab_file",val:""},{name:"bod_token",val:" = '<d>'"},{name:"eod_token",val:" = '</d>'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"unk_token",val:" = '<unk>'"},{name:"line_token",val:" = '</n>'"},{name:"space_token",val:" = '</_>'"},{name:"padding_side",val:" = 'left'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CpmAntTokenizer.bod_token",description:`<strong>bod_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;d&gt;&quot;</code>) &#x2014;
The beginning of document token.`,name:"bod_token"},{anchor:"transformers.CpmAntTokenizer.eod_token",description:`<strong>eod_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/d&gt;&quot;</code>) &#x2014;
The end of document token.`,name:"eod_token"},{anchor:"transformers.CpmAntTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CpmAntTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CpmAntTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding.`,name:"pad_token"},{anchor:"transformers.CpmAntTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token.`,name:"unk_token"},{anchor:"transformers.CpmAntTokenizer.line_token",description:`<strong>line_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/n&gt;&quot;</code>) &#x2014;
The line token.`,name:"line_token"},{anchor:"transformers.CpmAntTokenizer.space_token",description:`<strong>space_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/_&gt;&quot;</code>) &#x2014;
The space token.`,name:"space_token"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/tokenization_cpmant.py#L88"}}),we=new ce({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.List[int] = None"}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; The first tokenized sequence that special tokens will be added.",name:"token_ids_0"},{anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>) &#x2014; The optional second tokenized sequence that special tokens will be added.",name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/tokenization_cpmant.py#L235",returnDescription:`
<p>The model input with special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Me=new ce({props:{name:"get_special_tokens_mask",anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; List of IDs.",name:"token_ids_0"},{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014; Optional second list of IDs for sequence pairs.",name:"token_ids_1"},{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/tokenization_cpmant.py#L253",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ae=new at({}),Ee=new ce({props:{name:"class transformers.CpmAntModel",anchor:"transformers.CpmAntModel",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/modeling_cpmant.py#L603"}}),xe=new ce({props:{name:"forward",anchor:"transformers.CpmAntModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CpmAntModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.`,name:"past_key_values"},{anchor:"transformers.CpmAntModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CpmAntModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers.`,name:"output_attentions"},{anchor:"transformers.CpmAntModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers.`,name:"output_hidden_states"},{anchor:"transformers.CpmAntModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/modeling_cpmant.py#L641",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntConfig"
>CpmAntConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new Es({props:{$$slots:{default:[Js]},$$scope:{ctx:P}}}),te=new Un({props:{anchor:"transformers.CpmAntModel.forward.example",$$slots:{default:[Ws]},$$scope:{ctx:P}}}),qe=new at({}),Ie=new ce({props:{name:"class transformers.CpmAntForCausalLM",anchor:"transformers.CpmAntForCausalLM",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/modeling_cpmant.py#L750"}}),We=new ce({props:{name:"forward",anchor:"transformers.CpmAntForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Union[typing.List[typing.Tuple[torch.Tensor, torch.Tensor]], NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CpmAntForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.`,name:"past_key_values"},{anchor:"transformers.CpmAntForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CpmAntForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers.`,name:"output_attentions"},{anchor:"transformers.CpmAntForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers.`,name:"output_hidden_states"},{anchor:"transformers.CpmAntForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
input_ids (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>):
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>
past_key_values (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>):
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the
cross-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.
use_cache (<code>bool</code>, <em>optional</em>):
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding
(see <code>past_key_values</code>).
output_attentions (<code>bool</code>, <em>optional</em>):
Whether or not to return the attentions tensors of all attention layers.
output_hidden_states (<code>bool</code>, <em>optional</em>):
Whether or not to return the hidden states of all layers.
labels (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss.
return_dict (<code>bool</code>, <em>optional</em>):
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.
attention_mask (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
CPMAnt will process attention mask automatically, this parameter is a dummy parameter for
text-generation pipeline.</p>
<p>Example &#x2014;`,name:"return_dict"},{anchor:"transformers.CpmAntForCausalLM.forward.Text",description:"<strong>Text</strong> Generation with CpmAntForCausalLM. &#x2014;",name:"Text"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/cpmant/modeling_cpmant.py#L763",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntConfig"
>CpmAntConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Es({props:{$$slots:{default:[Us]},$$scope:{ctx:P}}}),se=new Un({props:{anchor:"transformers.CpmAntForCausalLM.forward.example",$$slots:{default:[js]},$$scope:{ctx:P}}}),{c(){c=n("meta"),b=p(),_=n("h1"),u=n("a"),v=n("span"),y(l.$$.fragment),f=p(),I=n("span"),Yt=r("CPMAnt"),At=p(),U=n("h2"),D=n("a"),rt=n("span"),y(pe.$$.fragment),Kt=p(),it=n("span"),eo=r("Overview"),Et=p(),me=n("p"),to=r("CPM-Ant is an open-source Chinese pre-trained language model (PLM) with 10B parameters. It is also the first milestone of the live training process of CPM-Live. The training process is cost-effective and environment-friendly. CPM-Ant also achieves promising results with delta tuning on the CUGE benchmark. Besides the full model, we also provide various compressed versions to meet the requirements of different hardware configurations. "),he=n("a"),oo=r("See more"),zt=p(),Fe=n("p"),no=r("Tips:"),Pt=p(),B=n("p"),so=r("This model was contributed by "),ue=n("a"),ao=r("OpenBMB"),ro=r(". The original code can be found "),fe=n("a"),io=r("here"),lo=r("."),xt=p(),Le=n("p"),co=r("\u2699\uFE0F Training & Inference"),qt=p(),Ne=n("ul"),ge=n("li"),po=r("A tutorial on "),_e=n("a"),mo=r("CPM-Live"),ho=r("."),It=p(),j=n("h2"),Q=n("a"),lt=n("span"),y(ve.$$.fragment),uo=p(),dt=n("span"),fo=r("CpmAntConfig"),Bt=p(),A=n("div"),y(be.$$.fragment),go=p(),F=n("p"),_o=r("This is the configuration class to store the configuration of a "),Se=n("a"),vo=r("CpmAntModel"),bo=r(`. It is used to instantiate an
CPMAnt model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the CPMAnt
`),ye=n("a"),yo=r("openbmb/cpm-ant-10b"),ko=r(" architecture."),Co=p(),L=n("p"),wo=r("Configuration objects inherit from "),Ge=n("a"),To=r("PretrainedConfig"),Mo=r(` and can be used to control the model outputs. Read the
documentation from `),Ze=n("a"),$o=r("PretrainedConfig"),Ao=r(" for more information."),Eo=p(),y(H.$$.fragment),Jt=p(),N=n("h2"),X=n("a"),ct=n("span"),y(ke.$$.fragment),zo=p(),pt=n("span"),Po=r("CpmAntTokenizer"),Wt=p(),E=n("div"),y(Ce.$$.fragment),xo=p(),mt=n("p"),qo=r("Construct a CPMAnt tokenizer. Based on byte-level Byte-Pair-Encoding."),Io=p(),J=n("div"),y(we.$$.fragment),Bo=p(),ht=n("p"),Jo=r(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CPMAnt sequence has the following format:`),Wo=p(),ut=n("ul"),Te=n("li"),Uo=r("single sequence: "),ft=n("code"),jo=r("[BOS] Sequence"),Fo=r("."),Lo=p(),Y=n("div"),y(Me.$$.fragment),No=p(),$e=n("p"),So=r(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),gt=n("code"),Go=r("prepare_for_model"),Zo=r(" method."),Ut=p(),S=n("h2"),K=n("a"),_t=n("span"),y(Ae.$$.fragment),Vo=p(),vt=n("span"),Oo=r("CpmAntModel"),jt=p(),z=n("div"),y(Ee.$$.fragment),Ro=p(),ze=n("p"),Do=r(`The bare CPMAnt Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Pe=n("a"),Qo=r("torch.nn.Module"),Ho=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xo=p(),G=n("p"),Yo=r(`Parameters
config (`),Ve=n("a"),Ko=r("~CpmAntConfig"),en=r(`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Oe=n("a"),tn=r("from_pretrained()"),on=r(" method to load the model weights."),nn=p(),x=n("div"),y(xe.$$.fragment),sn=p(),Z=n("p"),an=r("The "),Re=n("a"),rn=r("CpmAntModel"),ln=r(" forward method, overrides the "),bt=n("code"),dn=r("__call__"),cn=r(" special method."),pn=p(),y(ee.$$.fragment),mn=p(),y(te.$$.fragment),Ft=p(),V=n("h2"),oe=n("a"),yt=n("span"),y(qe.$$.fragment),hn=p(),kt=n("span"),un=r("CpmAntForCausalLM"),Lt=p(),$=n("div"),y(Ie.$$.fragment),fn=p(),Ct=n("p"),gn=r("The CPMAnt Model with a language modeling head on top (linear layer with weights tied to the input embeddings)."),_n=p(),Be=n("p"),vn=r("This model is a PyTorch "),Je=n("a"),bn=r("torch.nn.Module"),yn=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),kn=p(),O=n("p"),Cn=r(`Parameters
config (`),De=n("a"),wn=r("~CpmAntConfig"),Tn=r(`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Qe=n("a"),Mn=r("from_pretrained()"),$n=r(" method to load the model weights."),An=p(),q=n("div"),y(We.$$.fragment),En=p(),R=n("p"),zn=r("The "),He=n("a"),Pn=r("CpmAntForCausalLM"),xn=r(" forward method, overrides the "),wt=n("code"),qn=r("__call__"),In=r(" special method."),Bn=p(),y(ne.$$.fragment),Jn=p(),y(se.$$.fragment),this.h()},l(t){const h=qs('[data-svelte="svelte-1phssyn"]',document.head);c=s(h,"META",{name:!0,content:!0}),h.forEach(o),b=m(t),_=s(t,"H1",{class:!0});var Ue=a(_);u=s(Ue,"A",{id:!0,class:!0,href:!0});var Tt=a(u);v=s(Tt,"SPAN",{});var Mt=a(v);k(l.$$.fragment,Mt),Mt.forEach(o),Tt.forEach(o),f=m(Ue),I=s(Ue,"SPAN",{});var $t=a(I);Yt=i($t,"CPMAnt"),$t.forEach(o),Ue.forEach(o),At=m(t),U=s(t,"H2",{class:!0});var je=a(U);D=s(je,"A",{id:!0,class:!0,href:!0});var Ln=a(D);rt=s(Ln,"SPAN",{});var Nn=a(rt);k(pe.$$.fragment,Nn),Nn.forEach(o),Ln.forEach(o),Kt=m(je),it=s(je,"SPAN",{});var Sn=a(it);eo=i(Sn,"Overview"),Sn.forEach(o),je.forEach(o),Et=m(t),me=s(t,"P",{});var Wn=a(me);to=i(Wn,"CPM-Ant is an open-source Chinese pre-trained language model (PLM) with 10B parameters. It is also the first milestone of the live training process of CPM-Live. The training process is cost-effective and environment-friendly. CPM-Ant also achieves promising results with delta tuning on the CUGE benchmark. Besides the full model, we also provide various compressed versions to meet the requirements of different hardware configurations. "),he=s(Wn,"A",{href:!0,rel:!0});var Gn=a(he);oo=i(Gn,"See more"),Gn.forEach(o),Wn.forEach(o),zt=m(t),Fe=s(t,"P",{});var Zn=a(Fe);no=i(Zn,"Tips:"),Zn.forEach(o),Pt=m(t),B=s(t,"P",{});var Xe=a(B);so=i(Xe,"This model was contributed by "),ue=s(Xe,"A",{href:!0,rel:!0});var Vn=a(ue);ao=i(Vn,"OpenBMB"),Vn.forEach(o),ro=i(Xe,". The original code can be found "),fe=s(Xe,"A",{href:!0,rel:!0});var On=a(fe);io=i(On,"here"),On.forEach(o),lo=i(Xe,"."),Xe.forEach(o),xt=m(t),Le=s(t,"P",{});var Rn=a(Le);co=i(Rn,"\u2699\uFE0F Training & Inference"),Rn.forEach(o),qt=m(t),Ne=s(t,"UL",{});var Dn=a(Ne);ge=s(Dn,"LI",{});var St=a(ge);po=i(St,"A tutorial on "),_e=s(St,"A",{href:!0,rel:!0});var Qn=a(_e);mo=i(Qn,"CPM-Live"),Qn.forEach(o),ho=i(St,"."),St.forEach(o),Dn.forEach(o),It=m(t),j=s(t,"H2",{class:!0});var Gt=a(j);Q=s(Gt,"A",{id:!0,class:!0,href:!0});var Hn=a(Q);lt=s(Hn,"SPAN",{});var Xn=a(lt);k(ve.$$.fragment,Xn),Xn.forEach(o),Hn.forEach(o),uo=m(Gt),dt=s(Gt,"SPAN",{});var Yn=a(dt);fo=i(Yn,"CpmAntConfig"),Yn.forEach(o),Gt.forEach(o),Bt=m(t),A=s(t,"DIV",{class:!0});var ae=a(A);k(be.$$.fragment,ae),go=m(ae),F=s(ae,"P",{});var Ye=a(F);_o=i(Ye,"This is the configuration class to store the configuration of a "),Se=s(Ye,"A",{href:!0});var Kn=a(Se);vo=i(Kn,"CpmAntModel"),Kn.forEach(o),bo=i(Ye,`. It is used to instantiate an
CPMAnt model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the CPMAnt
`),ye=s(Ye,"A",{href:!0,rel:!0});var es=a(ye);yo=i(es,"openbmb/cpm-ant-10b"),es.forEach(o),ko=i(Ye," architecture."),Ye.forEach(o),Co=m(ae),L=s(ae,"P",{});var Ke=a(L);wo=i(Ke,"Configuration objects inherit from "),Ge=s(Ke,"A",{href:!0});var ts=a(Ge);To=i(ts,"PretrainedConfig"),ts.forEach(o),Mo=i(Ke,` and can be used to control the model outputs. Read the
documentation from `),Ze=s(Ke,"A",{href:!0});var os=a(Ze);$o=i(os,"PretrainedConfig"),os.forEach(o),Ao=i(Ke," for more information."),Ke.forEach(o),Eo=m(ae),k(H.$$.fragment,ae),ae.forEach(o),Jt=m(t),N=s(t,"H2",{class:!0});var Zt=a(N);X=s(Zt,"A",{id:!0,class:!0,href:!0});var ns=a(X);ct=s(ns,"SPAN",{});var ss=a(ct);k(ke.$$.fragment,ss),ss.forEach(o),ns.forEach(o),zo=m(Zt),pt=s(Zt,"SPAN",{});var as=a(pt);Po=i(as,"CpmAntTokenizer"),as.forEach(o),Zt.forEach(o),Wt=m(t),E=s(t,"DIV",{class:!0});var re=a(E);k(Ce.$$.fragment,re),xo=m(re),mt=s(re,"P",{});var rs=a(mt);qo=i(rs,"Construct a CPMAnt tokenizer. Based on byte-level Byte-Pair-Encoding."),rs.forEach(o),Io=m(re),J=s(re,"DIV",{class:!0});var et=a(J);k(we.$$.fragment,et),Bo=m(et),ht=s(et,"P",{});var is=a(ht);Jo=i(is,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CPMAnt sequence has the following format:`),is.forEach(o),Wo=m(et),ut=s(et,"UL",{});var ls=a(ut);Te=s(ls,"LI",{});var Vt=a(Te);Uo=i(Vt,"single sequence: "),ft=s(Vt,"CODE",{});var ds=a(ft);jo=i(ds,"[BOS] Sequence"),ds.forEach(o),Fo=i(Vt,"."),Vt.forEach(o),ls.forEach(o),et.forEach(o),Lo=m(re),Y=s(re,"DIV",{class:!0});var Ot=a(Y);k(Me.$$.fragment,Ot),No=m(Ot),$e=s(Ot,"P",{});var Rt=a($e);So=i(Rt,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),gt=s(Rt,"CODE",{});var cs=a(gt);Go=i(cs,"prepare_for_model"),cs.forEach(o),Zo=i(Rt," method."),Rt.forEach(o),Ot.forEach(o),re.forEach(o),Ut=m(t),S=s(t,"H2",{class:!0});var Dt=a(S);K=s(Dt,"A",{id:!0,class:!0,href:!0});var ps=a(K);_t=s(ps,"SPAN",{});var ms=a(_t);k(Ae.$$.fragment,ms),ms.forEach(o),ps.forEach(o),Vo=m(Dt),vt=s(Dt,"SPAN",{});var hs=a(vt);Oo=i(hs,"CpmAntModel"),hs.forEach(o),Dt.forEach(o),jt=m(t),z=s(t,"DIV",{class:!0});var ie=a(z);k(Ee.$$.fragment,ie),Ro=m(ie),ze=s(ie,"P",{});var Qt=a(ze);Do=i(Qt,`The bare CPMAnt Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Pe=s(Qt,"A",{href:!0,rel:!0});var us=a(Pe);Qo=i(us,"torch.nn.Module"),us.forEach(o),Ho=i(Qt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Qt.forEach(o),Xo=m(ie),G=s(ie,"P",{});var tt=a(G);Yo=i(tt,`Parameters
config (`),Ve=s(tt,"A",{href:!0});var fs=a(Ve);Ko=i(fs,"~CpmAntConfig"),fs.forEach(o),en=i(tt,`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Oe=s(tt,"A",{href:!0});var gs=a(Oe);tn=i(gs,"from_pretrained()"),gs.forEach(o),on=i(tt," method to load the model weights."),tt.forEach(o),nn=m(ie),x=s(ie,"DIV",{class:!0});var le=a(x);k(xe.$$.fragment,le),sn=m(le),Z=s(le,"P",{});var ot=a(Z);an=i(ot,"The "),Re=s(ot,"A",{href:!0});var _s=a(Re);rn=i(_s,"CpmAntModel"),_s.forEach(o),ln=i(ot," forward method, overrides the "),bt=s(ot,"CODE",{});var vs=a(bt);dn=i(vs,"__call__"),vs.forEach(o),cn=i(ot," special method."),ot.forEach(o),pn=m(le),k(ee.$$.fragment,le),mn=m(le),k(te.$$.fragment,le),le.forEach(o),ie.forEach(o),Ft=m(t),V=s(t,"H2",{class:!0});var Ht=a(V);oe=s(Ht,"A",{id:!0,class:!0,href:!0});var bs=a(oe);yt=s(bs,"SPAN",{});var ys=a(yt);k(qe.$$.fragment,ys),ys.forEach(o),bs.forEach(o),hn=m(Ht),kt=s(Ht,"SPAN",{});var ks=a(kt);un=i(ks,"CpmAntForCausalLM"),ks.forEach(o),Ht.forEach(o),Lt=m(t),$=s(t,"DIV",{class:!0});var W=a($);k(Ie.$$.fragment,W),fn=m(W),Ct=s(W,"P",{});var Cs=a(Ct);gn=i(Cs,"The CPMAnt Model with a language modeling head on top (linear layer with weights tied to the input embeddings)."),Cs.forEach(o),_n=m(W),Be=s(W,"P",{});var Xt=a(Be);vn=i(Xt,"This model is a PyTorch "),Je=s(Xt,"A",{href:!0,rel:!0});var ws=a(Je);bn=i(ws,"torch.nn.Module"),ws.forEach(o),yn=i(Xt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xt.forEach(o),kn=m(W),O=s(W,"P",{});var nt=a(O);Cn=i(nt,`Parameters
config (`),De=s(nt,"A",{href:!0});var Ts=a(De);wn=i(Ts,"~CpmAntConfig"),Ts.forEach(o),Tn=i(nt,`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Qe=s(nt,"A",{href:!0});var Ms=a(Qe);Mn=i(Ms,"from_pretrained()"),Ms.forEach(o),$n=i(nt," method to load the model weights."),nt.forEach(o),An=m(W),q=s(W,"DIV",{class:!0});var de=a(q);k(We.$$.fragment,de),En=m(de),R=s(de,"P",{});var st=a(R);zn=i(st,"The "),He=s(st,"A",{href:!0});var $s=a(He);Pn=i($s,"CpmAntForCausalLM"),$s.forEach(o),xn=i(st," forward method, overrides the "),wt=s(st,"CODE",{});var As=a(wt);qn=i(As,"__call__"),As.forEach(o),In=i(st," special method."),st.forEach(o),Bn=m(de),k(ne.$$.fragment,de),Jn=m(de),k(se.$$.fragment,de),de.forEach(o),W.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Ls)),d(u,"id","cpmant"),d(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(u,"href","#cpmant"),d(_,"class","relative group"),d(D,"id","overview"),d(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(D,"href","#overview"),d(U,"class","relative group"),d(he,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(he,"rel","nofollow"),d(ue,"href","https://huggingface.co/openbmb"),d(ue,"rel","nofollow"),d(fe,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(fe,"rel","nofollow"),d(_e,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(_e,"rel","nofollow"),d(Q,"id","transformers.CpmAntConfig"),d(Q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Q,"href","#transformers.CpmAntConfig"),d(j,"class","relative group"),d(Se,"href","/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntModel"),d(ye,"href","https://huggingface.co/openbmb/cpm-ant-10b"),d(ye,"rel","nofollow"),d(Ge,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ze,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"id","transformers.CpmAntTokenizer"),d(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(X,"href","#transformers.CpmAntTokenizer"),d(N,"class","relative group"),d(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(K,"id","transformers.CpmAntModel"),d(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(K,"href","#transformers.CpmAntModel"),d(S,"class","relative group"),d(Pe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Pe,"rel","nofollow"),d(Ve,"href","/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Oe,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(Re,"href","/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntModel"),d(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(oe,"id","transformers.CpmAntForCausalLM"),d(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(oe,"href","#transformers.CpmAntForCausalLM"),d(V,"class","relative group"),d(Je,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Je,"rel","nofollow"),d(De,"href","/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Qe,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(He,"href","/docs/transformers/v4.31.0/en/model_doc/cpmant#transformers.CpmAntForCausalLM"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($,"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,h){e(document.head,c),g(t,b,h),g(t,_,h),e(_,u),e(u,v),C(l,v,null),e(_,f),e(_,I),e(I,Yt),g(t,At,h),g(t,U,h),e(U,D),e(D,rt),C(pe,rt,null),e(U,Kt),e(U,it),e(it,eo),g(t,Et,h),g(t,me,h),e(me,to),e(me,he),e(he,oo),g(t,zt,h),g(t,Fe,h),e(Fe,no),g(t,Pt,h),g(t,B,h),e(B,so),e(B,ue),e(ue,ao),e(B,ro),e(B,fe),e(fe,io),e(B,lo),g(t,xt,h),g(t,Le,h),e(Le,co),g(t,qt,h),g(t,Ne,h),e(Ne,ge),e(ge,po),e(ge,_e),e(_e,mo),e(ge,ho),g(t,It,h),g(t,j,h),e(j,Q),e(Q,lt),C(ve,lt,null),e(j,uo),e(j,dt),e(dt,fo),g(t,Bt,h),g(t,A,h),C(be,A,null),e(A,go),e(A,F),e(F,_o),e(F,Se),e(Se,vo),e(F,bo),e(F,ye),e(ye,yo),e(F,ko),e(A,Co),e(A,L),e(L,wo),e(L,Ge),e(Ge,To),e(L,Mo),e(L,Ze),e(Ze,$o),e(L,Ao),e(A,Eo),C(H,A,null),g(t,Jt,h),g(t,N,h),e(N,X),e(X,ct),C(ke,ct,null),e(N,zo),e(N,pt),e(pt,Po),g(t,Wt,h),g(t,E,h),C(Ce,E,null),e(E,xo),e(E,mt),e(mt,qo),e(E,Io),e(E,J),C(we,J,null),e(J,Bo),e(J,ht),e(ht,Jo),e(J,Wo),e(J,ut),e(ut,Te),e(Te,Uo),e(Te,ft),e(ft,jo),e(Te,Fo),e(E,Lo),e(E,Y),C(Me,Y,null),e(Y,No),e(Y,$e),e($e,So),e($e,gt),e(gt,Go),e($e,Zo),g(t,Ut,h),g(t,S,h),e(S,K),e(K,_t),C(Ae,_t,null),e(S,Vo),e(S,vt),e(vt,Oo),g(t,jt,h),g(t,z,h),C(Ee,z,null),e(z,Ro),e(z,ze),e(ze,Do),e(ze,Pe),e(Pe,Qo),e(ze,Ho),e(z,Xo),e(z,G),e(G,Yo),e(G,Ve),e(Ve,Ko),e(G,en),e(G,Oe),e(Oe,tn),e(G,on),e(z,nn),e(z,x),C(xe,x,null),e(x,sn),e(x,Z),e(Z,an),e(Z,Re),e(Re,rn),e(Z,ln),e(Z,bt),e(bt,dn),e(Z,cn),e(x,pn),C(ee,x,null),e(x,mn),C(te,x,null),g(t,Ft,h),g(t,V,h),e(V,oe),e(oe,yt),C(qe,yt,null),e(V,hn),e(V,kt),e(kt,un),g(t,Lt,h),g(t,$,h),C(Ie,$,null),e($,fn),e($,Ct),e(Ct,gn),e($,_n),e($,Be),e(Be,vn),e(Be,Je),e(Je,bn),e(Be,yn),e($,kn),e($,O),e(O,Cn),e(O,De),e(De,wn),e(O,Tn),e(O,Qe),e(Qe,Mn),e(O,$n),e($,An),e($,q),C(We,q,null),e(q,En),e(q,R),e(R,zn),e(R,He),e(He,Pn),e(R,xn),e(R,wt),e(wt,qn),e(R,In),e(q,Bn),C(ne,q,null),e(q,Jn),C(se,q,null),Nt=!0},p(t,[h]){const Ue={};h&2&&(Ue.$$scope={dirty:h,ctx:t}),H.$set(Ue);const Tt={};h&2&&(Tt.$$scope={dirty:h,ctx:t}),ee.$set(Tt);const Mt={};h&2&&(Mt.$$scope={dirty:h,ctx:t}),te.$set(Mt);const $t={};h&2&&($t.$$scope={dirty:h,ctx:t}),ne.$set($t);const je={};h&2&&(je.$$scope={dirty:h,ctx:t}),se.$set(je)},i(t){Nt||(w(l.$$.fragment,t),w(pe.$$.fragment,t),w(ve.$$.fragment,t),w(be.$$.fragment,t),w(H.$$.fragment,t),w(ke.$$.fragment,t),w(Ce.$$.fragment,t),w(we.$$.fragment,t),w(Me.$$.fragment,t),w(Ae.$$.fragment,t),w(Ee.$$.fragment,t),w(xe.$$.fragment,t),w(ee.$$.fragment,t),w(te.$$.fragment,t),w(qe.$$.fragment,t),w(Ie.$$.fragment,t),w(We.$$.fragment,t),w(ne.$$.fragment,t),w(se.$$.fragment,t),Nt=!0)},o(t){T(l.$$.fragment,t),T(pe.$$.fragment,t),T(ve.$$.fragment,t),T(be.$$.fragment,t),T(H.$$.fragment,t),T(ke.$$.fragment,t),T(Ce.$$.fragment,t),T(we.$$.fragment,t),T(Me.$$.fragment,t),T(Ae.$$.fragment,t),T(Ee.$$.fragment,t),T(xe.$$.fragment,t),T(ee.$$.fragment,t),T(te.$$.fragment,t),T(qe.$$.fragment,t),T(Ie.$$.fragment,t),T(We.$$.fragment,t),T(ne.$$.fragment,t),T(se.$$.fragment,t),Nt=!1},d(t){o(c),t&&o(b),t&&o(_),M(l),t&&o(At),t&&o(U),M(pe),t&&o(Et),t&&o(me),t&&o(zt),t&&o(Fe),t&&o(Pt),t&&o(B),t&&o(xt),t&&o(Le),t&&o(qt),t&&o(Ne),t&&o(It),t&&o(j),M(ve),t&&o(Bt),t&&o(A),M(be),M(H),t&&o(Jt),t&&o(N),M(ke),t&&o(Wt),t&&o(E),M(Ce),M(we),M(Me),t&&o(Ut),t&&o(S),M(Ae),t&&o(jt),t&&o(z),M(Ee),M(xe),M(ee),M(te),t&&o(Ft),t&&o(V),M(qe),t&&o(Lt),t&&o($),M(Ie),M(We),M(ne),M(se)}}}const Ls={local:"cpmant",sections:[{local:"overview",title:"Overview"},{local:"transformers.CpmAntConfig",title:"CpmAntConfig"},{local:"transformers.CpmAntTokenizer",title:"CpmAntTokenizer"},{local:"transformers.CpmAntModel",title:"CpmAntModel"},{local:"transformers.CpmAntForCausalLM",title:"CpmAntForCausalLM"}],title:"CPMAnt"};function Ns(P){return Is(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ds extends zs{constructor(c){super();Ps(this,c,Ns,Fs,xs,{})}}export{Ds as default,Ls as metadata};
