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