import{S as Bo,i as Ho,s as Uo,e as t,k as d,w as v,t as i,M as Vo,c as a,d as o,m as p,a as n,x as b,h as l,b as s,G as r,g as h,y,L as jo,q as w,o as G,B as x,v as Ko}from"../../chunks/vendor-hf-doc-builder.js";import{D as Fe}from"../../chunks/Docstring-hf-doc-builder.js";import{I as Se}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Qo(ao){let $,Ie,C,q,ue,R,nr,ge,sr,De,E,F,_e,Y,ir,ve,lr,Le,S,mr,B,dr,pr,Me,re,hr,Oe,oe,be,fr,Re,te,cr,Ye,I,ur,ye,gr,_r,Be,ae,vr,He,g,br,H,yr,wr,U,Gr,xr,Ue,k,D,we,V,$r,Ge,Cr,Ve,u,j,Er,T,kr,ne,Tr,Nr,K,Ar,Pr,zr,N,qr,se,Fr,Sr,ie,Ir,Dr,je,A,L,xe,Q,Lr,$e,Mr,Ke,c,W,Or,Ce,Rr,Yr,Ee,Br,Hr,le,Z,Qe,P,M,ke,J,Ur,Te,Vr,We,f,X,jr,Ne,Kr,Qr,Ae,Wr,Zr,z,Pe,Jr,Xr,ze,eo,ro,qe,oo,to,me,ee,Ze;return R=new Se({}),Y=new Se({}),V=new Se({}),j=new Fe({props:{name:"class transformers.GraphormerConfig",anchor:"transformers.GraphormerConfig",parameters:[{name:"num_classes",val:": int = 1"},{name:"num_atoms",val:": int = 4608"},{name:"num_edges",val:": int = 1536"},{name:"num_in_degree",val:": int = 512"},{name:"num_out_degree",val:": int = 512"},{name:"num_spatial",val:": int = 512"},{name:"num_edge_dis",val:": int = 128"},{name:"multi_hop_max_dist",val:": int = 5"},{name:"spatial_pos_max",val:": int = 1024"},{name:"edge_type",val:": str = 'multi_hop'"},{name:"max_nodes",val:": int = 512"},{name:"share_input_output_embed",val:": bool = False"},{name:"num_hidden_layers",val:": int = 12"},{name:"embedding_dim",val:": int = 768"},{name:"ffn_embedding_dim",val:": int = 768"},{name:"num_attention_heads",val:": int = 32"},{name:"dropout",val:": float = 0.1"},{name:"attention_dropout",val:": float = 0.1"},{name:"layerdrop",val:": float = 0.0"},{name:"encoder_normalize_before",val:": bool = False"},{name:"pre_layernorm",val:": bool = False"},{name:"apply_graphormer_init",val:": bool = False"},{name:"activation_fn",val:": str = 'gelu'"},{name:"embed_scale",val:": float = None"},{name:"freeze_embeddings",val:": bool = False"},{name:"num_trans_layers_to_freeze",val:": int = 0"},{name:"traceable",val:": bool = False"},{name:"q_noise",val:": float = 0.0"},{name:"qn_block_size",val:": int = 8"},{name:"kdim",val:": int = None"},{name:"vdim",val:": int = None"},{name:"bias",val:": bool = True"},{name:"self_attention",val:": bool = True"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GraphormerConfig.num_classes",description:`<strong>num_classes</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of target classes or labels, set to n for binary classification of n tasks.`,name:"num_classes"},{anchor:"transformers.GraphormerConfig.num_atoms",description:`<strong>num_atoms</strong> (<code>int</code>, <em>optional</em>, defaults to 512*9) &#x2014;
Number of node types in the graphs.`,name:"num_atoms"},{anchor:"transformers.GraphormerConfig.num_edges",description:`<strong>num_edges</strong> (<code>int</code>, <em>optional</em>, defaults to 512*3) &#x2014;
Number of edges types in the graph.`,name:"num_edges"},{anchor:"transformers.GraphormerConfig.num_in_degree",description:`<strong>num_in_degree</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Number of in degrees types in the input graphs.`,name:"num_in_degree"},{anchor:"transformers.GraphormerConfig.num_out_degree",description:`<strong>num_out_degree</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Number of out degrees types in the input graphs.`,name:"num_out_degree"},{anchor:"transformers.GraphormerConfig.num_edge_dis",description:`<strong>num_edge_dis</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of edge dis in the input graphs.`,name:"num_edge_dis"},{anchor:"transformers.GraphormerConfig.multi_hop_max_dist",description:`<strong>multi_hop_max_dist</strong> (<code>int</code>, <em>optional</em>, defaults to 20) &#x2014;
Maximum distance of multi hop edges between two nodes.`,name:"multi_hop_max_dist"},{anchor:"transformers.GraphormerConfig.spatial_pos_max",description:`<strong>spatial_pos_max</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Maximum distance between nodes in the graph attention bias matrices, used during preprocessing and
collation.`,name:"spatial_pos_max"},{anchor:"transformers.GraphormerConfig.edge_type",description:`<strong>edge_type</strong> (<code>str</code>, <em>optional</em>, defaults to multihop) &#x2014;
Type of edge relation chosen.`,name:"edge_type"},{anchor:"transformers.GraphormerConfig.max_nodes",description:`<strong>max_nodes</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Maximum number of nodes which can be parsed for the input graphs.`,name:"max_nodes"},{anchor:"transformers.GraphormerConfig.share_input_output_embed",description:`<strong>share_input_output_embed</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Shares the embedding layer between encoder and decoder - careful, True is not implemented.`,name:"share_input_output_embed"},{anchor:"transformers.GraphormerConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of layers.`,name:"num_layers"},{anchor:"transformers.GraphormerConfig.embedding_dim",description:`<strong>embedding_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the embedding layer in encoder.`,name:"embedding_dim"},{anchor:"transformers.GraphormerConfig.ffn_embedding_dim",description:`<strong>ffn_embedding_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in encoder.`,name:"ffn_embedding_dim"},{anchor:"transformers.GraphormerConfig.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 encoder.`,name:"num_attention_heads"},{anchor:"transformers.GraphormerConfig.self_attention",description:`<strong>self_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Model is self attentive (False not implemented).`,name:"self_attention"},{anchor:"transformers.GraphormerConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.GraphormerConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.GraphormerConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for the attention weights.`,name:"attention_dropout"},{anchor:"transformers.GraphormerConfig.layerdrop",description:`<strong>layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the encoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"layerdrop"},{anchor:"transformers.GraphormerConfig.bias",description:`<strong>bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Uses bias in the attention module - unsupported at the moment.`,name:"bias"},{anchor:"transformers.GraphormerConfig.embed_scale(float,",description:`<strong>embed_scale(<code>float</code>,</strong> <em>optional</em>, defaults to None) &#x2014;
Scaling factor for the node embeddings.`,name:"embed_scale(float,"},{anchor:"transformers.GraphormerConfig.num_trans_layers_to_freeze",description:`<strong>num_trans_layers_to_freeze</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of transformer layers to freeze.`,name:"num_trans_layers_to_freeze"},{anchor:"transformers.GraphormerConfig.encoder_normalize_before",description:`<strong>encoder_normalize_before</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Normalize features before encoding the graph.`,name:"encoder_normalize_before"},{anchor:"transformers.GraphormerConfig.pre_layernorm",description:`<strong>pre_layernorm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Apply layernorm before self attention and the feed forward network. Without this, post layernorm will be
used.`,name:"pre_layernorm"},{anchor:"transformers.GraphormerConfig.apply_graphormer_init",description:`<strong>apply_graphormer_init</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Apply a custom graphormer initialisation to the model before training.`,name:"apply_graphormer_init"},{anchor:"transformers.GraphormerConfig.freeze_embeddings",description:`<strong>freeze_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Freeze the embedding layer, or train it along the model.`,name:"freeze_embeddings"},{anchor:"transformers.GraphormerConfig.encoder_normalize_before",description:`<strong>encoder_normalize_before</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Apply the layer norm before each encoder block.`,name:"encoder_normalize_before"},{anchor:"transformers.GraphormerConfig.q_noise",description:`<strong>q_noise</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Amount of quantization noise (see &#x201C;Training with Quantization Noise for Extreme Model Compression&#x201D;). (For
more detail, see fairseq&#x2019;s documentation on quant_noise).`,name:"q_noise"},{anchor:"transformers.GraphormerConfig.qn_block_size",description:`<strong>qn_block_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Size of the blocks for subsequent quantization with iPQ (see q_noise).`,name:"qn_block_size"},{anchor:"transformers.GraphormerConfig.kdim",description:`<strong>kdim</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Dimension of the key in the attention, if different from the other values.`,name:"kdim"},{anchor:"transformers.GraphormerConfig.vdim",description:`<strong>vdim</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Dimension of the value in the attention, if different from the other values.`,name:"vdim"},{anchor:"transformers.GraphormerConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.GraphormerConfig.traceable",description:`<strong>traceable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Changes return value of the encoder&#x2019;s inner_state to stacked tensors.</p>
<p>Example &#x2014;`,name:"traceable"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/graphormer/configuration_graphormer.py#L30"}}),Q=new Se({}),W=new Fe({props:{name:"class transformers.GraphormerModel",anchor:"transformers.GraphormerModel",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/graphormer/modeling_graphormer.py#L761"}}),Z=new Fe({props:{name:"forward",anchor:"transformers.GraphormerModel.forward",parameters:[{name:"input_nodes",val:""},{name:"input_edges",val:""},{name:"attn_bias",val:""},{name:"in_degree",val:""},{name:"out_degree",val:""},{name:"spatial_pos",val:""},{name:"attn_edge_type",val:""},{name:"perturb",val:" = None"},{name:"masked_tokens",val:" = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**unused",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/graphormer/modeling_graphormer.py#L790"}}),J=new Se({}),X=new Fe({props:{name:"class transformers.GraphormerForGraphClassification",anchor:"transformers.GraphormerForGraphClassification",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/graphormer/modeling_graphormer.py#L832"}}),ee=new Fe({props:{name:"forward",anchor:"transformers.GraphormerForGraphClassification.forward",parameters:[{name:"input_nodes",val:""},{name:"input_edges",val:""},{name:"attn_bias",val:""},{name:"in_degree",val:""},{name:"out_degree",val:""},{name:"spatial_pos",val:""},{name:"attn_edge_type",val:""},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**unused",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/graphormer/modeling_graphormer.py#L855"}}),{c(){$=t("meta"),Ie=d(),C=t("h1"),q=t("a"),ue=t("span"),v(R.$$.fragment),nr=d(),ge=t("span"),sr=i("Graphormer"),De=d(),E=t("h2"),F=t("a"),_e=t("span"),v(Y.$$.fragment),ir=d(),ve=t("span"),lr=i("Overview"),Le=d(),S=t("p"),mr=i("The Graphormer model was proposed in "),B=t("a"),dr=i("Do Transformers Really Perform Bad for Graph Representation?"),pr=i(`  by
Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen and Tie-Yan Liu. It is a Graph Transformer model, modified to allow computations on graphs instead of text sequences by generating embeddings and features of interest during preprocessign and collation, then using a modified attention.`),Me=d(),re=t("p"),hr=i("The abstract from the paper is the following:"),Oe=d(),oe=t("p"),be=t("em"),fr=i("The Transformer architecture has become a dominant choice in many domains, such as natural language processing and computer vision. Yet, it has not achieved competitive performance on popular leaderboards of graph-level prediction compared to mainstream GNN variants. Therefore, it remains a mystery how Transformers could perform well for graph representation learning. In this paper, we solve this mystery by presenting Graphormer, which is built upon the standard Transformer architecture, and could attain excellent results on a broad range of graph representation learning tasks, especially on the recent OGB Large-Scale Challenge. Our key insight to utilizing Transformer in the graph is the necessity of effectively encoding the structural information of a graph into the model. To this end, we propose several simple yet effective structural encoding methods to help Graphormer better model graph-structured data. Besides, we mathematically characterize the expressive power of Graphormer and exhibit that with our ways of encoding the structural information of graphs, many popular GNN variants could be covered as the special cases of Graphormer."),Re=d(),te=t("p"),cr=i("Tips:"),Ye=d(),I=t("p"),ur=i(`This model will not work well on large graphs (more than 100 nodes/edges), as it will make the memory explode.
You can reduce the batch size, increase your RAM, or decrease the `),ye=t("code"),gr=i("UNREACHABLE_NODE_DISTANCE"),_r=i(" parameter in algos_graphormer.pyx, but it will be hard to go above 700 nodes/edges."),Be=d(),ae=t("p"),vr=i("This model does not use a tokenizer, but instead a special collator during training."),He=d(),g=t("p"),br=i("This model was contributed by "),H=t("a"),yr=i("clefourrier"),wr=i(". The original code can be found "),U=t("a"),Gr=i("here"),xr=i("."),Ue=d(),k=t("h2"),D=t("a"),we=t("span"),v(V.$$.fragment),$r=d(),Ge=t("span"),Cr=i("GraphormerConfig"),Ve=d(),u=t("div"),v(j.$$.fragment),Er=d(),T=t("p"),kr=i("This is the configuration class to store the configuration of a "),ne=t("a"),Tr=i("~GraphormerModel"),Nr=i(`. It is used to instantiate an
Graphormer 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 Graphormer
`),K=t("a"),Ar=i("graphormer-base-pcqm4mv1"),Pr=i(" architecture."),zr=d(),N=t("p"),qr=i("Configuration objects inherit from "),se=t("a"),Fr=i("PretrainedConfig"),Sr=i(` and can be used to control the model outputs. Read the
documentation from `),ie=t("a"),Ir=i("PretrainedConfig"),Dr=i(" for more information."),je=d(),A=t("h2"),L=t("a"),xe=t("span"),v(Q.$$.fragment),Lr=d(),$e=t("span"),Mr=i("GraphormerModel"),Ke=d(),c=t("div"),v(W.$$.fragment),Or=d(),Ce=t("p"),Rr=i("The Graphormer model is a graph-encoder model."),Yr=d(),Ee=t("p"),Br=i(`It goes from a graph to its representation. If you want to use the model for a downstream classification task, use
GraphormerForGraphClassification instead. For any other downstream task, feel free to add a new class, or combine
this model with a downstream model of your choice, following the example in GraphormerForGraphClassification.`),Hr=d(),le=t("div"),v(Z.$$.fragment),Qe=d(),P=t("h2"),M=t("a"),ke=t("span"),v(J.$$.fragment),Ur=d(),Te=t("span"),Vr=i("GraphormerForGraphClassification"),We=d(),f=t("div"),v(X.$$.fragment),jr=d(),Ne=t("p"),Kr=i("This model can be used for graph-level classification or regression tasks."),Qr=d(),Ae=t("p"),Wr=i("It can be trained on"),Zr=d(),z=t("ul"),Pe=t("li"),Jr=i("regression (by setting config.num_classes to 1); there should be one float-type label per graph"),Xr=d(),ze=t("li"),eo=i(`one task classification (by setting config.num_classes to the number of classes); there should be one integer
label per graph`),ro=d(),qe=t("li"),oo=i(`binary multi-task classification (by setting config.num_classes to the number of labels); there should be a list
of integer labels for each graph.`),to=d(),me=t("div"),v(ee.$$.fragment),this.h()},l(e){const m=Vo('[data-svelte="svelte-1phssyn"]',document.head);$=a(m,"META",{name:!0,content:!0}),m.forEach(o),Ie=p(e),C=a(e,"H1",{class:!0});var Je=n(C);q=a(Je,"A",{id:!0,class:!0,href:!0});var no=n(q);ue=a(no,"SPAN",{});var so=n(ue);b(R.$$.fragment,so),so.forEach(o),no.forEach(o),nr=p(Je),ge=a(Je,"SPAN",{});var io=n(ge);sr=l(io,"Graphormer"),io.forEach(o),Je.forEach(o),De=p(e),E=a(e,"H2",{class:!0});var Xe=n(E);F=a(Xe,"A",{id:!0,class:!0,href:!0});var lo=n(F);_e=a(lo,"SPAN",{});var mo=n(_e);b(Y.$$.fragment,mo),mo.forEach(o),lo.forEach(o),ir=p(Xe),ve=a(Xe,"SPAN",{});var po=n(ve);lr=l(po,"Overview"),po.forEach(o),Xe.forEach(o),Le=p(e),S=a(e,"P",{});var er=n(S);mr=l(er,"The Graphormer model was proposed in "),B=a(er,"A",{href:!0,rel:!0});var ho=n(B);dr=l(ho,"Do Transformers Really Perform Bad for Graph Representation?"),ho.forEach(o),pr=l(er,`  by
Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen and Tie-Yan Liu. It is a Graph Transformer model, modified to allow computations on graphs instead of text sequences by generating embeddings and features of interest during preprocessign and collation, then using a modified attention.`),er.forEach(o),Me=p(e),re=a(e,"P",{});var fo=n(re);hr=l(fo,"The abstract from the paper is the following:"),fo.forEach(o),Oe=p(e),oe=a(e,"P",{});var co=n(oe);be=a(co,"EM",{});var uo=n(be);fr=l(uo,"The Transformer architecture has become a dominant choice in many domains, such as natural language processing and computer vision. Yet, it has not achieved competitive performance on popular leaderboards of graph-level prediction compared to mainstream GNN variants. Therefore, it remains a mystery how Transformers could perform well for graph representation learning. In this paper, we solve this mystery by presenting Graphormer, which is built upon the standard Transformer architecture, and could attain excellent results on a broad range of graph representation learning tasks, especially on the recent OGB Large-Scale Challenge. Our key insight to utilizing Transformer in the graph is the necessity of effectively encoding the structural information of a graph into the model. To this end, we propose several simple yet effective structural encoding methods to help Graphormer better model graph-structured data. Besides, we mathematically characterize the expressive power of Graphormer and exhibit that with our ways of encoding the structural information of graphs, many popular GNN variants could be covered as the special cases of Graphormer."),uo.forEach(o),co.forEach(o),Re=p(e),te=a(e,"P",{});var go=n(te);cr=l(go,"Tips:"),go.forEach(o),Ye=p(e),I=a(e,"P",{});var rr=n(I);ur=l(rr,`This model will not work well on large graphs (more than 100 nodes/edges), as it will make the memory explode.
You can reduce the batch size, increase your RAM, or decrease the `),ye=a(rr,"CODE",{});var _o=n(ye);gr=l(_o,"UNREACHABLE_NODE_DISTANCE"),_o.forEach(o),_r=l(rr," parameter in algos_graphormer.pyx, but it will be hard to go above 700 nodes/edges."),rr.forEach(o),Be=p(e),ae=a(e,"P",{});var vo=n(ae);vr=l(vo,"This model does not use a tokenizer, but instead a special collator during training."),vo.forEach(o),He=p(e),g=a(e,"P",{});var de=n(g);br=l(de,"This model was contributed by "),H=a(de,"A",{href:!0,rel:!0});var bo=n(H);yr=l(bo,"clefourrier"),bo.forEach(o),wr=l(de,". The original code can be found "),U=a(de,"A",{href:!0,rel:!0});var yo=n(U);Gr=l(yo,"here"),yo.forEach(o),xr=l(de,"."),de.forEach(o),Ue=p(e),k=a(e,"H2",{class:!0});var or=n(k);D=a(or,"A",{id:!0,class:!0,href:!0});var wo=n(D);we=a(wo,"SPAN",{});var Go=n(we);b(V.$$.fragment,Go),Go.forEach(o),wo.forEach(o),$r=p(or),Ge=a(or,"SPAN",{});var xo=n(Ge);Cr=l(xo,"GraphormerConfig"),xo.forEach(o),or.forEach(o),Ve=p(e),u=a(e,"DIV",{class:!0});var pe=n(u);b(j.$$.fragment,pe),Er=p(pe),T=a(pe,"P",{});var he=n(T);kr=l(he,"This is the configuration class to store the configuration of a "),ne=a(he,"A",{href:!0});var $o=n(ne);Tr=l($o,"~GraphormerModel"),$o.forEach(o),Nr=l(he,`. It is used to instantiate an
Graphormer 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 Graphormer
`),K=a(he,"A",{href:!0,rel:!0});var Co=n(K);Ar=l(Co,"graphormer-base-pcqm4mv1"),Co.forEach(o),Pr=l(he," architecture."),he.forEach(o),zr=p(pe),N=a(pe,"P",{});var fe=n(N);qr=l(fe,"Configuration objects inherit from "),se=a(fe,"A",{href:!0});var Eo=n(se);Fr=l(Eo,"PretrainedConfig"),Eo.forEach(o),Sr=l(fe,` and can be used to control the model outputs. Read the
documentation from `),ie=a(fe,"A",{href:!0});var ko=n(ie);Ir=l(ko,"PretrainedConfig"),ko.forEach(o),Dr=l(fe," for more information."),fe.forEach(o),pe.forEach(o),je=p(e),A=a(e,"H2",{class:!0});var tr=n(A);L=a(tr,"A",{id:!0,class:!0,href:!0});var To=n(L);xe=a(To,"SPAN",{});var No=n(xe);b(Q.$$.fragment,No),No.forEach(o),To.forEach(o),Lr=p(tr),$e=a(tr,"SPAN",{});var Ao=n($e);Mr=l(Ao,"GraphormerModel"),Ao.forEach(o),tr.forEach(o),Ke=p(e),c=a(e,"DIV",{class:!0});var O=n(c);b(W.$$.fragment,O),Or=p(O),Ce=a(O,"P",{});var Po=n(Ce);Rr=l(Po,"The Graphormer model is a graph-encoder model."),Po.forEach(o),Yr=p(O),Ee=a(O,"P",{});var zo=n(Ee);Br=l(zo,`It goes from a graph to its representation. If you want to use the model for a downstream classification task, use
GraphormerForGraphClassification instead. For any other downstream task, feel free to add a new class, or combine
this model with a downstream model of your choice, following the example in GraphormerForGraphClassification.`),zo.forEach(o),Hr=p(O),le=a(O,"DIV",{class:!0});var qo=n(le);b(Z.$$.fragment,qo),qo.forEach(o),O.forEach(o),Qe=p(e),P=a(e,"H2",{class:!0});var ar=n(P);M=a(ar,"A",{id:!0,class:!0,href:!0});var Fo=n(M);ke=a(Fo,"SPAN",{});var So=n(ke);b(J.$$.fragment,So),So.forEach(o),Fo.forEach(o),Ur=p(ar),Te=a(ar,"SPAN",{});var Io=n(Te);Vr=l(Io,"GraphormerForGraphClassification"),Io.forEach(o),ar.forEach(o),We=p(e),f=a(e,"DIV",{class:!0});var _=n(f);b(X.$$.fragment,_),jr=p(_),Ne=a(_,"P",{});var Do=n(Ne);Kr=l(Do,"This model can be used for graph-level classification or regression tasks."),Do.forEach(o),Qr=p(_),Ae=a(_,"P",{});var Lo=n(Ae);Wr=l(Lo,"It can be trained on"),Lo.forEach(o),Zr=p(_),z=a(_,"UL",{});var ce=n(z);Pe=a(ce,"LI",{});var Mo=n(Pe);Jr=l(Mo,"regression (by setting config.num_classes to 1); there should be one float-type label per graph"),Mo.forEach(o),Xr=p(ce),ze=a(ce,"LI",{});var Oo=n(ze);eo=l(Oo,`one task classification (by setting config.num_classes to the number of classes); there should be one integer
label per graph`),Oo.forEach(o),ro=p(ce),qe=a(ce,"LI",{});var Ro=n(qe);oo=l(Ro,`binary multi-task classification (by setting config.num_classes to the number of labels); there should be a list
of integer labels for each graph.`),Ro.forEach(o),ce.forEach(o),to=p(_),me=a(_,"DIV",{class:!0});var Yo=n(me);b(ee.$$.fragment,Yo),Yo.forEach(o),_.forEach(o),this.h()},h(){s($,"name","hf:doc:metadata"),s($,"content",JSON.stringify(Wo)),s(q,"id","graphormer"),s(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"),s(q,"href","#graphormer"),s(C,"class","relative group"),s(F,"id","overview"),s(F,"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"),s(F,"href","#overview"),s(E,"class","relative group"),s(B,"href","https://arxiv.org/abs/2106.05234"),s(B,"rel","nofollow"),s(H,"href","https://huggingface.co/clefourrier"),s(H,"rel","nofollow"),s(U,"href","https://github.com/microsoft/Graphormer"),s(U,"rel","nofollow"),s(D,"id","transformers.GraphormerConfig"),s(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"),s(D,"href","#transformers.GraphormerConfig"),s(k,"class","relative group"),s(ne,"href","/docs/transformers/v4.27.1/en/model_doc/graphormer#transformers.GraphormerModel"),s(K,"href","https://huggingface.co/graphormer-base-pcqm4mv1"),s(K,"rel","nofollow"),s(se,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),s(ie,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),s(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(L,"id","transformers.GraphormerModel"),s(L,"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"),s(L,"href","#transformers.GraphormerModel"),s(A,"class","relative group"),s(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(M,"id","transformers.GraphormerForGraphClassification"),s(M,"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"),s(M,"href","#transformers.GraphormerForGraphClassification"),s(P,"class","relative group"),s(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,m){r(document.head,$),h(e,Ie,m),h(e,C,m),r(C,q),r(q,ue),y(R,ue,null),r(C,nr),r(C,ge),r(ge,sr),h(e,De,m),h(e,E,m),r(E,F),r(F,_e),y(Y,_e,null),r(E,ir),r(E,ve),r(ve,lr),h(e,Le,m),h(e,S,m),r(S,mr),r(S,B),r(B,dr),r(S,pr),h(e,Me,m),h(e,re,m),r(re,hr),h(e,Oe,m),h(e,oe,m),r(oe,be),r(be,fr),h(e,Re,m),h(e,te,m),r(te,cr),h(e,Ye,m),h(e,I,m),r(I,ur),r(I,ye),r(ye,gr),r(I,_r),h(e,Be,m),h(e,ae,m),r(ae,vr),h(e,He,m),h(e,g,m),r(g,br),r(g,H),r(H,yr),r(g,wr),r(g,U),r(U,Gr),r(g,xr),h(e,Ue,m),h(e,k,m),r(k,D),r(D,we),y(V,we,null),r(k,$r),r(k,Ge),r(Ge,Cr),h(e,Ve,m),h(e,u,m),y(j,u,null),r(u,Er),r(u,T),r(T,kr),r(T,ne),r(ne,Tr),r(T,Nr),r(T,K),r(K,Ar),r(T,Pr),r(u,zr),r(u,N),r(N,qr),r(N,se),r(se,Fr),r(N,Sr),r(N,ie),r(ie,Ir),r(N,Dr),h(e,je,m),h(e,A,m),r(A,L),r(L,xe),y(Q,xe,null),r(A,Lr),r(A,$e),r($e,Mr),h(e,Ke,m),h(e,c,m),y(W,c,null),r(c,Or),r(c,Ce),r(Ce,Rr),r(c,Yr),r(c,Ee),r(Ee,Br),r(c,Hr),r(c,le),y(Z,le,null),h(e,Qe,m),h(e,P,m),r(P,M),r(M,ke),y(J,ke,null),r(P,Ur),r(P,Te),r(Te,Vr),h(e,We,m),h(e,f,m),y(X,f,null),r(f,jr),r(f,Ne),r(Ne,Kr),r(f,Qr),r(f,Ae),r(Ae,Wr),r(f,Zr),r(f,z),r(z,Pe),r(Pe,Jr),r(z,Xr),r(z,ze),r(ze,eo),r(z,ro),r(z,qe),r(qe,oo),r(f,to),r(f,me),y(ee,me,null),Ze=!0},p:jo,i(e){Ze||(w(R.$$.fragment,e),w(Y.$$.fragment,e),w(V.$$.fragment,e),w(j.$$.fragment,e),w(Q.$$.fragment,e),w(W.$$.fragment,e),w(Z.$$.fragment,e),w(J.$$.fragment,e),w(X.$$.fragment,e),w(ee.$$.fragment,e),Ze=!0)},o(e){G(R.$$.fragment,e),G(Y.$$.fragment,e),G(V.$$.fragment,e),G(j.$$.fragment,e),G(Q.$$.fragment,e),G(W.$$.fragment,e),G(Z.$$.fragment,e),G(J.$$.fragment,e),G(X.$$.fragment,e),G(ee.$$.fragment,e),Ze=!1},d(e){o($),e&&o(Ie),e&&o(C),x(R),e&&o(De),e&&o(E),x(Y),e&&o(Le),e&&o(S),e&&o(Me),e&&o(re),e&&o(Oe),e&&o(oe),e&&o(Re),e&&o(te),e&&o(Ye),e&&o(I),e&&o(Be),e&&o(ae),e&&o(He),e&&o(g),e&&o(Ue),e&&o(k),x(V),e&&o(Ve),e&&o(u),x(j),e&&o(je),e&&o(A),x(Q),e&&o(Ke),e&&o(c),x(W),x(Z),e&&o(Qe),e&&o(P),x(J),e&&o(We),e&&o(f),x(X),x(ee)}}}const Wo={local:"graphormer",sections:[{local:"overview",title:"Overview"},{local:"transformers.GraphormerConfig",title:"GraphormerConfig"},{local:"transformers.GraphormerModel",title:"GraphormerModel"},{local:"transformers.GraphormerForGraphClassification",title:"GraphormerForGraphClassification"}],title:"Graphormer"};function Zo(ao){return Ko(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends Bo{constructor($){super();Ho(this,$,Zo,Qo,Uo,{})}}export{rt as default,Wo as metadata};
