import{S as za,i as Pa,s as xa,e as n,k as p,w as y,t as r,M as qa,c as a,d as o,m,a as s,x as k,h as i,b as d,G as e,g,y as w,q as C,o as T,B as M,v as Ia,L as Un}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ea}from"../../chunks/Tip-hf-doc-builder.js";import{D as ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as jn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as st}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Wn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ba(P){let c,v,_,u,b;return u=new jn({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"),v=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=a(l,"P",{});var f=s(c);v=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,v),g(l,_,f),w(u,l,f),b=!0},p:Un,i(l){b||(C(u.$$.fragment,l),b=!0)},o(l){T(u.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function Ja(P){let c,v,_,u,b;return{c(){c=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=r("Module"),b=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=a(l,"P",{});var f=s(c);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var I=s(_);u=i(I,"Module"),I.forEach(o),b=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,v),e(c,_),e(_,u),e(c,b)},d(l){l&&o(c)}}}function Fa(P){let c,v,_,u,b;return u=new jn({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"),v=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=a(l,"P",{});var f=s(c);v=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,v),g(l,_,f),w(u,l,f),b=!0},p:Un,i(l){b||(C(u.$$.fragment,l),b=!0)},o(l){T(u.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function Wa(P){let c,v,_,u,b;return{c(){c=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=r("Module"),b=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=a(l,"P",{});var f=s(c);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var I=s(_);u=i(I,"Module"),I.forEach(o),b=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,v),e(c,_),e(_,u),e(c,b)},d(l){l&&o(c)}}}function Ua(P){let c,v,_,u,b;return u=new jn({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"),v=r("Example:"),_=p(),y(u.$$.fragment)},l(l){c=a(l,"P",{});var f=s(c);v=i(f,"Example:"),f.forEach(o),_=m(l),k(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,v),g(l,_,f),w(u,l,f),b=!0},p:Un,i(l){b||(C(u.$$.fragment,l),b=!0)},o(l){T(u.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),M(u,l)}}}function ja(P){let c,v,_,u,b,l,f,I,Yt,At,W,D,rt,pe,Kt,it,eo,Et,me,to,he,oo,zt,je,no,Pt,B,ao,ue,so,ro,fe,io,lo,xt,Le,co,qt,Ne,ge,po,_e,mo,ho,It,U,Q,lt,be,uo,dt,fo,Bt,A,ve,go,j,_o,Se,bo,vo,ye,yo,ko,wo,L,Co,Ge,To,Mo,Ze,$o,Ao,Eo,H,Jt,N,X,ct,ke,zo,pt,Po,Ft,E,we,xo,mt,qo,Io,J,Ce,Bo,ht,Jo,Fo,ut,Te,Wo,ft,Uo,jo,Lo,Y,Me,No,$e,So,gt,Go,Zo,Wt,S,K,_t,Ae,Vo,bt,Oo,Ut,z,Ee,Ro,ze,Do,Pe,Qo,Ho,Xo,G,Yo,Ve,Ko,en,Oe,tn,on,nn,x,xe,an,Z,sn,Re,rn,ln,vt,dn,cn,pn,ee,mn,te,jt,V,oe,yt,qe,hn,kt,un,Lt,$,Ie,fn,wt,gn,_n,Be,bn,Je,vn,yn,kn,O,wn,De,Cn,Tn,Qe,Mn,$n,An,q,Fe,En,R,zn,He,Pn,xn,Ct,qn,In,Bn,ne,Jn,ae,Nt;return l=new st({}),pe=new st({}),be=new st({}),ve=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/main/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/main/src/transformers/models/cpmant/configuration_cpmant.py#L29"}}),H=new Wn({props:{anchor:"transformers.CpmAntConfig.example",$$slots:{default:[Ba]},$$scope:{ctx:P}}}),ke=new st({}),we=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/main/src/transformers/models/cpmant/tokenization_cpmant.py#L88"}}),Ce=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/main/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/main/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 st({}),Ee=new ce({props:{name:"class transformers.CpmAntModel",anchor:"transformers.CpmAntModel",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/main/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/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/cpmant/modeling_cpmant.py#L641",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new Ea({props:{$$slots:{default:[Ja]},$$scope:{ctx:P}}}),te=new Wn({props:{anchor:"transformers.CpmAntModel.forward.example",$$slots:{default:[Fa]},$$scope:{ctx:P}}}),qe=new st({}),Ie=new ce({props:{name:"class transformers.CpmAntForCausalLM",anchor:"transformers.CpmAntForCausalLM",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/cpmant/modeling_cpmant.py#L750"}}),Fe=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/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/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/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/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/main/src/transformers/models/cpmant/modeling_cpmant.py#L763",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Ea({props:{$$slots:{default:[Wa]},$$scope:{ctx:P}}}),ae=new Wn({props:{anchor:"transformers.CpmAntForCausalLM.forward.example",$$slots:{default:[Ua]},$$scope:{ctx:P}}}),{c(){c=n("meta"),v=p(),_=n("h1"),u=n("a"),b=n("span"),y(l.$$.fragment),f=p(),I=n("span"),Yt=r("CPMAnt"),At=p(),W=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(),je=n("p"),no=r("Tips:"),Pt=p(),B=n("p"),ao=r("This model was contributed by "),ue=n("a"),so=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(),U=n("h2"),Q=n("a"),lt=n("span"),y(be.$$.fragment),uo=p(),dt=n("span"),fo=r("CpmAntConfig"),Bt=p(),A=n("div"),y(ve.$$.fragment),go=p(),j=n("p"),_o=r("This is the configuration class to store the configuration of a "),Se=n("a"),bo=r("CpmAntModel"),vo=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."),wo=p(),L=n("p"),Co=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"),Ft=p(),E=n("div"),y(we.$$.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(Ce.$$.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:`),Fo=p(),ut=n("ul"),Te=n("li"),Wo=r("single sequence: "),ft=n("code"),Uo=r("[BOS] Sequence"),jo=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."),Wt=p(),S=n("h2"),K=n("a"),_t=n("span"),y(Ae.$$.fragment),Vo=p(),bt=n("span"),Oo=r("CpmAntModel"),Ut=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),an=p(),Z=n("p"),sn=r("The "),Re=n("a"),rn=r("CpmAntModel"),ln=r(" forward method, overrides the "),vt=n("code"),dn=r("__call__"),cn=r(" special method."),pn=p(),y(ee.$$.fragment),mn=p(),y(te.$$.fragment),jt=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(),wt=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"),bn=r("This model is a PyTorch "),Je=n("a"),vn=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"),wn=r(`Parameters
config (`),De=n("a"),Cn=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(Fe.$$.fragment),En=p(),R=n("p"),zn=r("The "),He=n("a"),Pn=r("CpmAntForCausalLM"),xn=r(" forward method, overrides the "),Ct=n("code"),qn=r("__call__"),In=r(" special method."),Bn=p(),y(ne.$$.fragment),Jn=p(),y(ae.$$.fragment),this.h()},l(t){const h=qa('[data-svelte="svelte-1phssyn"]',document.head);c=a(h,"META",{name:!0,content:!0}),h.forEach(o),v=m(t),_=a(t,"H1",{class:!0});var We=s(_);u=a(We,"A",{id:!0,class:!0,href:!0});var Tt=s(u);b=a(Tt,"SPAN",{});var Mt=s(b);k(l.$$.fragment,Mt),Mt.forEach(o),Tt.forEach(o),f=m(We),I=a(We,"SPAN",{});var $t=s(I);Yt=i($t,"CPMAnt"),$t.forEach(o),We.forEach(o),At=m(t),W=a(t,"H2",{class:!0});var Ue=s(W);D=a(Ue,"A",{id:!0,class:!0,href:!0});var Ln=s(D);rt=a(Ln,"SPAN",{});var Nn=s(rt);k(pe.$$.fragment,Nn),Nn.forEach(o),Ln.forEach(o),Kt=m(Ue),it=a(Ue,"SPAN",{});var Sn=s(it);eo=i(Sn,"Overview"),Sn.forEach(o),Ue.forEach(o),Et=m(t),me=a(t,"P",{});var Fn=s(me);to=i(Fn,"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=a(Fn,"A",{href:!0,rel:!0});var Gn=s(he);oo=i(Gn,"See more"),Gn.forEach(o),Fn.forEach(o),zt=m(t),je=a(t,"P",{});var Zn=s(je);no=i(Zn,"Tips:"),Zn.forEach(o),Pt=m(t),B=a(t,"P",{});var Xe=s(B);ao=i(Xe,"This model was contributed by "),ue=a(Xe,"A",{href:!0,rel:!0});var Vn=s(ue);so=i(Vn,"OpenBMB"),Vn.forEach(o),ro=i(Xe,". The original code can be found "),fe=a(Xe,"A",{href:!0,rel:!0});var On=s(fe);io=i(On,"here"),On.forEach(o),lo=i(Xe,"."),Xe.forEach(o),xt=m(t),Le=a(t,"P",{});var Rn=s(Le);co=i(Rn,"\u2699\uFE0F Training & Inference"),Rn.forEach(o),qt=m(t),Ne=a(t,"UL",{});var Dn=s(Ne);ge=a(Dn,"LI",{});var St=s(ge);po=i(St,"A tutorial on "),_e=a(St,"A",{href:!0,rel:!0});var Qn=s(_e);mo=i(Qn,"CPM-Live"),Qn.forEach(o),ho=i(St,"."),St.forEach(o),Dn.forEach(o),It=m(t),U=a(t,"H2",{class:!0});var Gt=s(U);Q=a(Gt,"A",{id:!0,class:!0,href:!0});var Hn=s(Q);lt=a(Hn,"SPAN",{});var Xn=s(lt);k(be.$$.fragment,Xn),Xn.forEach(o),Hn.forEach(o),uo=m(Gt),dt=a(Gt,"SPAN",{});var Yn=s(dt);fo=i(Yn,"CpmAntConfig"),Yn.forEach(o),Gt.forEach(o),Bt=m(t),A=a(t,"DIV",{class:!0});var se=s(A);k(ve.$$.fragment,se),go=m(se),j=a(se,"P",{});var Ye=s(j);_o=i(Ye,"This is the configuration class to store the configuration of a "),Se=a(Ye,"A",{href:!0});var Kn=s(Se);bo=i(Kn,"CpmAntModel"),Kn.forEach(o),vo=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=a(Ye,"A",{href:!0,rel:!0});var ea=s(ye);yo=i(ea,"openbmb/cpm-ant-10b"),ea.forEach(o),ko=i(Ye," architecture."),Ye.forEach(o),wo=m(se),L=a(se,"P",{});var Ke=s(L);Co=i(Ke,"Configuration objects inherit from "),Ge=a(Ke,"A",{href:!0});var ta=s(Ge);To=i(ta,"PretrainedConfig"),ta.forEach(o),Mo=i(Ke,` and can be used to control the model outputs. Read the
documentation from `),Ze=a(Ke,"A",{href:!0});var oa=s(Ze);$o=i(oa,"PretrainedConfig"),oa.forEach(o),Ao=i(Ke," for more information."),Ke.forEach(o),Eo=m(se),k(H.$$.fragment,se),se.forEach(o),Jt=m(t),N=a(t,"H2",{class:!0});var Zt=s(N);X=a(Zt,"A",{id:!0,class:!0,href:!0});var na=s(X);ct=a(na,"SPAN",{});var aa=s(ct);k(ke.$$.fragment,aa),aa.forEach(o),na.forEach(o),zo=m(Zt),pt=a(Zt,"SPAN",{});var sa=s(pt);Po=i(sa,"CpmAntTokenizer"),sa.forEach(o),Zt.forEach(o),Ft=m(t),E=a(t,"DIV",{class:!0});var re=s(E);k(we.$$.fragment,re),xo=m(re),mt=a(re,"P",{});var ra=s(mt);qo=i(ra,"Construct a CPMAnt tokenizer. Based on byte-level Byte-Pair-Encoding."),ra.forEach(o),Io=m(re),J=a(re,"DIV",{class:!0});var et=s(J);k(Ce.$$.fragment,et),Bo=m(et),ht=a(et,"P",{});var ia=s(ht);Jo=i(ia,`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:`),ia.forEach(o),Fo=m(et),ut=a(et,"UL",{});var la=s(ut);Te=a(la,"LI",{});var Vt=s(Te);Wo=i(Vt,"single sequence: "),ft=a(Vt,"CODE",{});var da=s(ft);Uo=i(da,"[BOS] Sequence"),da.forEach(o),jo=i(Vt,"."),Vt.forEach(o),la.forEach(o),et.forEach(o),Lo=m(re),Y=a(re,"DIV",{class:!0});var Ot=s(Y);k(Me.$$.fragment,Ot),No=m(Ot),$e=a(Ot,"P",{});var Rt=s($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=a(Rt,"CODE",{});var ca=s(gt);Go=i(ca,"prepare_for_model"),ca.forEach(o),Zo=i(Rt," method."),Rt.forEach(o),Ot.forEach(o),re.forEach(o),Wt=m(t),S=a(t,"H2",{class:!0});var Dt=s(S);K=a(Dt,"A",{id:!0,class:!0,href:!0});var pa=s(K);_t=a(pa,"SPAN",{});var ma=s(_t);k(Ae.$$.fragment,ma),ma.forEach(o),pa.forEach(o),Vo=m(Dt),bt=a(Dt,"SPAN",{});var ha=s(bt);Oo=i(ha,"CpmAntModel"),ha.forEach(o),Dt.forEach(o),Ut=m(t),z=a(t,"DIV",{class:!0});var ie=s(z);k(Ee.$$.fragment,ie),Ro=m(ie),ze=a(ie,"P",{});var Qt=s(ze);Do=i(Qt,`The bare CPMAnt Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Pe=a(Qt,"A",{href:!0,rel:!0});var ua=s(Pe);Qo=i(ua,"torch.nn.Module"),ua.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=a(ie,"P",{});var tt=s(G);Yo=i(tt,`Parameters
config (`),Ve=a(tt,"A",{href:!0});var fa=s(Ve);Ko=i(fa,"~CpmAntConfig"),fa.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=a(tt,"A",{href:!0});var ga=s(Oe);tn=i(ga,"from_pretrained()"),ga.forEach(o),on=i(tt," method to load the model weights."),tt.forEach(o),nn=m(ie),x=a(ie,"DIV",{class:!0});var le=s(x);k(xe.$$.fragment,le),an=m(le),Z=a(le,"P",{});var ot=s(Z);sn=i(ot,"The "),Re=a(ot,"A",{href:!0});var _a=s(Re);rn=i(_a,"CpmAntModel"),_a.forEach(o),ln=i(ot," forward method, overrides the "),vt=a(ot,"CODE",{});var ba=s(vt);dn=i(ba,"__call__"),ba.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),jt=m(t),V=a(t,"H2",{class:!0});var Ht=s(V);oe=a(Ht,"A",{id:!0,class:!0,href:!0});var va=s(oe);yt=a(va,"SPAN",{});var ya=s(yt);k(qe.$$.fragment,ya),ya.forEach(o),va.forEach(o),hn=m(Ht),kt=a(Ht,"SPAN",{});var ka=s(kt);un=i(ka,"CpmAntForCausalLM"),ka.forEach(o),Ht.forEach(o),Lt=m(t),$=a(t,"DIV",{class:!0});var F=s($);k(Ie.$$.fragment,F),fn=m(F),wt=a(F,"P",{});var wa=s(wt);gn=i(wa,"The CPMAnt Model with a language modeling head on top (linear layer with weights tied to the input embeddings)."),wa.forEach(o),_n=m(F),Be=a(F,"P",{});var Xt=s(Be);bn=i(Xt,"This model is a PyTorch "),Je=a(Xt,"A",{href:!0,rel:!0});var Ca=s(Je);vn=i(Ca,"torch.nn.Module"),Ca.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(F),O=a(F,"P",{});var nt=s(O);wn=i(nt,`Parameters
config (`),De=a(nt,"A",{href:!0});var Ta=s(De);Cn=i(Ta,"~CpmAntConfig"),Ta.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=a(nt,"A",{href:!0});var Ma=s(Qe);Mn=i(Ma,"from_pretrained()"),Ma.forEach(o),$n=i(nt," method to load the model weights."),nt.forEach(o),An=m(F),q=a(F,"DIV",{class:!0});var de=s(q);k(Fe.$$.fragment,de),En=m(de),R=a(de,"P",{});var at=s(R);zn=i(at,"The "),He=a(at,"A",{href:!0});var $a=s(He);Pn=i($a,"CpmAntForCausalLM"),$a.forEach(o),xn=i(at," forward method, overrides the "),Ct=a(at,"CODE",{});var Aa=s(Ct);qn=i(Aa,"__call__"),Aa.forEach(o),In=i(at," special method."),at.forEach(o),Bn=m(de),k(ne.$$.fragment,de),Jn=m(de),k(ae.$$.fragment,de),de.forEach(o),F.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(La)),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(W,"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(U,"class","relative group"),d(Se,"href","/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ze,"href","/docs/transformers/main/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/main/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Oe,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(Re,"href","/docs/transformers/main/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/main/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Qe,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(He,"href","/docs/transformers/main/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,v,h),g(t,_,h),e(_,u),e(u,b),w(l,b,null),e(_,f),e(_,I),e(I,Yt),g(t,At,h),g(t,W,h),e(W,D),e(D,rt),w(pe,rt,null),e(W,Kt),e(W,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,je,h),e(je,no),g(t,Pt,h),g(t,B,h),e(B,ao),e(B,ue),e(ue,so),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,U,h),e(U,Q),e(Q,lt),w(be,lt,null),e(U,uo),e(U,dt),e(dt,fo),g(t,Bt,h),g(t,A,h),w(ve,A,null),e(A,go),e(A,j),e(j,_o),e(j,Se),e(Se,bo),e(j,vo),e(j,ye),e(ye,yo),e(j,ko),e(A,wo),e(A,L),e(L,Co),e(L,Ge),e(Ge,To),e(L,Mo),e(L,Ze),e(Ze,$o),e(L,Ao),e(A,Eo),w(H,A,null),g(t,Jt,h),g(t,N,h),e(N,X),e(X,ct),w(ke,ct,null),e(N,zo),e(N,pt),e(pt,Po),g(t,Ft,h),g(t,E,h),w(we,E,null),e(E,xo),e(E,mt),e(mt,qo),e(E,Io),e(E,J),w(Ce,J,null),e(J,Bo),e(J,ht),e(ht,Jo),e(J,Fo),e(J,ut),e(ut,Te),e(Te,Wo),e(Te,ft),e(ft,Uo),e(Te,jo),e(E,Lo),e(E,Y),w(Me,Y,null),e(Y,No),e(Y,$e),e($e,So),e($e,gt),e(gt,Go),e($e,Zo),g(t,Wt,h),g(t,S,h),e(S,K),e(K,_t),w(Ae,_t,null),e(S,Vo),e(S,bt),e(bt,Oo),g(t,Ut,h),g(t,z,h),w(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),w(xe,x,null),e(x,an),e(x,Z),e(Z,sn),e(Z,Re),e(Re,rn),e(Z,ln),e(Z,vt),e(vt,dn),e(Z,cn),e(x,pn),w(ee,x,null),e(x,mn),w(te,x,null),g(t,jt,h),g(t,V,h),e(V,oe),e(oe,yt),w(qe,yt,null),e(V,hn),e(V,kt),e(kt,un),g(t,Lt,h),g(t,$,h),w(Ie,$,null),e($,fn),e($,wt),e(wt,gn),e($,_n),e($,Be),e(Be,bn),e(Be,Je),e(Je,vn),e(Be,yn),e($,kn),e($,O),e(O,wn),e(O,De),e(De,Cn),e(O,Tn),e(O,Qe),e(Qe,Mn),e(O,$n),e($,An),e($,q),w(Fe,q,null),e(q,En),e(q,R),e(R,zn),e(R,He),e(He,Pn),e(R,xn),e(R,Ct),e(Ct,qn),e(R,In),e(q,Bn),w(ne,q,null),e(q,Jn),w(ae,q,null),Nt=!0},p(t,[h]){const We={};h&2&&(We.$$scope={dirty:h,ctx:t}),H.$set(We);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 Ue={};h&2&&(Ue.$$scope={dirty:h,ctx:t}),ae.$set(Ue)},i(t){Nt||(C(l.$$.fragment,t),C(pe.$$.fragment,t),C(be.$$.fragment,t),C(ve.$$.fragment,t),C(H.$$.fragment,t),C(ke.$$.fragment,t),C(we.$$.fragment,t),C(Ce.$$.fragment,t),C(Me.$$.fragment,t),C(Ae.$$.fragment,t),C(Ee.$$.fragment,t),C(xe.$$.fragment,t),C(ee.$$.fragment,t),C(te.$$.fragment,t),C(qe.$$.fragment,t),C(Ie.$$.fragment,t),C(Fe.$$.fragment,t),C(ne.$$.fragment,t),C(ae.$$.fragment,t),Nt=!0)},o(t){T(l.$$.fragment,t),T(pe.$$.fragment,t),T(be.$$.fragment,t),T(ve.$$.fragment,t),T(H.$$.fragment,t),T(ke.$$.fragment,t),T(we.$$.fragment,t),T(Ce.$$.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(Fe.$$.fragment,t),T(ne.$$.fragment,t),T(ae.$$.fragment,t),Nt=!1},d(t){o(c),t&&o(v),t&&o(_),M(l),t&&o(At),t&&o(W),M(pe),t&&o(Et),t&&o(me),t&&o(zt),t&&o(je),t&&o(Pt),t&&o(B),t&&o(xt),t&&o(Le),t&&o(qt),t&&o(Ne),t&&o(It),t&&o(U),M(be),t&&o(Bt),t&&o(A),M(ve),M(H),t&&o(Jt),t&&o(N),M(ke),t&&o(Ft),t&&o(E),M(we),M(Ce),M(Me),t&&o(Wt),t&&o(S),M(Ae),t&&o(Ut),t&&o(z),M(Ee),M(xe),M(ee),M(te),t&&o(jt),t&&o(V),M(qe),t&&o(Lt),t&&o($),M(Ie),M(Fe),M(ne),M(ae)}}}const La={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 Na(P){return Ia(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Da extends za{constructor(c){super();Pa(this,c,Na,ja,xa,{})}}export{Da as default,La as metadata};
