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 qe}from"../../chunks/Docstring-hf-doc-builder.js";import{I as Fe}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Qo(ao){let C,Se,$,z,ue,R,nr,ge,sr,Ie,T,q,_e,Y,ir,ve,lr,De,F,mr,B,dr,pr,Me,re,hr,Oe,oe,be,fr,Re,te,cr,Ye,S,ur,ye,gr,_r,Be,ae,vr,He,g,br,H,yr,wr,U,Gr,xr,Ue,E,I,we,V,Cr,Ge,$r,Ve,u,j,Tr,k,Er,ne,kr,Nr,K,Ar,Lr,Pr,N,zr,se,qr,Fr,ie,Sr,Ir,je,A,D,xe,Q,Dr,Ce,Mr,Ke,c,W,Or,$e,Rr,Yr,Te,Br,Hr,le,Z,Qe,L,M,Ee,J,Ur,ke,Vr,We,f,X,jr,Ne,Kr,Qr,Ae,Wr,Zr,P,Le,Jr,Xr,Pe,eo,ro,ze,oo,to,me,ee,Ze;return R=new Fe({}),Y=new Fe({}),V=new Fe({}),j=new qe({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.33.0/src/transformers/models/graphormer/configuration_graphormer.py#L30"}}),Q=new Fe({}),W=new qe({props:{name:"class transformers.GraphormerModel",anchor:"transformers.GraphormerModel",parameters:[{name:"config",val:": GraphormerConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/graphormer/modeling_graphormer.py#L781"}}),Z=new qe({props:{name:"forward",anchor:"transformers.GraphormerModel.forward",parameters:[{name:"input_nodes",val:": LongTensor"},{name:"input_edges",val:": LongTensor"},{name:"attn_bias",val:": Tensor"},{name:"in_degree",val:": LongTensor"},{name:"out_degree",val:": LongTensor"},{name:"spatial_pos",val:": LongTensor"},{name:"attn_edge_type",val:": LongTensor"},{name:"perturb",val:": typing.Optional[torch.FloatTensor] = None"},{name:"masked_tokens",val:": None = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**unused",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/graphormer/modeling_graphormer.py#L810"}}),J=new Fe({}),X=new qe({props:{name:"class transformers.GraphormerForGraphClassification",anchor:"transformers.GraphormerForGraphClassification",parameters:[{name:"config",val:": GraphormerConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/graphormer/modeling_graphormer.py#L852"}}),ee=new qe({props:{name:"forward",anchor:"transformers.GraphormerForGraphClassification.forward",parameters:[{name:"input_nodes",val:": LongTensor"},{name:"input_edges",val:": LongTensor"},{name:"attn_bias",val:": Tensor"},{name:"in_degree",val:": LongTensor"},{name:"out_degree",val:": LongTensor"},{name:"spatial_pos",val:": LongTensor"},{name:"attn_edge_type",val:": LongTensor"},{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.33.0/src/transformers/models/graphormer/modeling_graphormer.py#L875"}}),{c(){C=t("meta"),Se=d(),$=t("h1"),z=t("a"),ue=t("span"),v(R.$$.fragment),nr=d(),ge=t("span"),sr=i("Graphormer"),Ie=d(),T=t("h2"),q=t("a"),_e=t("span"),v(Y.$$.fragment),ir=d(),ve=t("span"),lr=i("Overview"),De=d(),F=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 preprocessing 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(),S=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(),E=t("h2"),I=t("a"),we=t("span"),v(V.$$.fragment),Cr=d(),Ge=t("span"),$r=i("GraphormerConfig"),Ve=d(),u=t("div"),v(j.$$.fragment),Tr=d(),k=t("p"),Er=i("This is the configuration class to store the configuration of a "),ne=t("a"),kr=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"),Lr=i(" architecture."),Pr=d(),N=t("p"),zr=i("Configuration objects inherit from "),se=t("a"),qr=i("PretrainedConfig"),Fr=i(` and can be used to control the model outputs. Read the
documentation from `),ie=t("a"),Sr=i("PretrainedConfig"),Ir=i(" for more information."),je=d(),A=t("h2"),D=t("a"),xe=t("span"),v(Q.$$.fragment),Dr=d(),Ce=t("span"),Mr=i("GraphormerModel"),Ke=d(),c=t("div"),v(W.$$.fragment),Or=d(),$e=t("p"),Rr=i("The Graphormer model is a graph-encoder model."),Yr=d(),Te=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(),L=t("h2"),M=t("a"),Ee=t("span"),v(J.$$.fragment),Ur=d(),ke=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(),P=t("ul"),Le=t("li"),Jr=i("regression (by setting config.num_classes to 1); there should be one float-type label per graph"),Xr=d(),Pe=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(),ze=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);C=a(m,"META",{name:!0,content:!0}),m.forEach(o),Se=p(e),$=a(e,"H1",{class:!0});var Je=n($);z=a(Je,"A",{id:!0,class:!0,href:!0});var no=n(z);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),Ie=p(e),T=a(e,"H2",{class:!0});var Xe=n(T);q=a(Xe,"A",{id:!0,class:!0,href:!0});var lo=n(q);_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),De=p(e),F=a(e,"P",{});var er=n(F);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 preprocessing 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),S=a(e,"P",{});var rr=n(S);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),E=a(e,"H2",{class:!0});var or=n(E);I=a(or,"A",{id:!0,class:!0,href:!0});var wo=n(I);we=a(wo,"SPAN",{});var Go=n(we);b(V.$$.fragment,Go),Go.forEach(o),wo.forEach(o),Cr=p(or),Ge=a(or,"SPAN",{});var xo=n(Ge);$r=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),Tr=p(pe),k=a(pe,"P",{});var he=n(k);Er=l(he,"This is the configuration class to store the configuration of a "),ne=a(he,"A",{href:!0});var Co=n(ne);kr=l(Co,"~GraphormerModel"),Co.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 $o=n(K);Ar=l($o,"graphormer-base-pcqm4mv1"),$o.forEach(o),Lr=l(he," architecture."),he.forEach(o),Pr=p(pe),N=a(pe,"P",{});var fe=n(N);zr=l(fe,"Configuration objects inherit from "),se=a(fe,"A",{href:!0});var To=n(se);qr=l(To,"PretrainedConfig"),To.forEach(o),Fr=l(fe,` and can be used to control the model outputs. Read the
documentation from `),ie=a(fe,"A",{href:!0});var Eo=n(ie);Sr=l(Eo,"PretrainedConfig"),Eo.forEach(o),Ir=l(fe," for more information."),fe.forEach(o),pe.forEach(o),je=p(e),A=a(e,"H2",{class:!0});var tr=n(A);D=a(tr,"A",{id:!0,class:!0,href:!0});var ko=n(D);xe=a(ko,"SPAN",{});var No=n(xe);b(Q.$$.fragment,No),No.forEach(o),ko.forEach(o),Dr=p(tr),Ce=a(tr,"SPAN",{});var Ao=n(Ce);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),$e=a(O,"P",{});var Lo=n($e);Rr=l(Lo,"The Graphormer model is a graph-encoder model."),Lo.forEach(o),Yr=p(O),Te=a(O,"P",{});var Po=n(Te);Br=l(Po,`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.`),Po.forEach(o),Hr=p(O),le=a(O,"DIV",{class:!0});var zo=n(le);b(Z.$$.fragment,zo),zo.forEach(o),O.forEach(o),Qe=p(e),L=a(e,"H2",{class:!0});var ar=n(L);M=a(ar,"A",{id:!0,class:!0,href:!0});var qo=n(M);Ee=a(qo,"SPAN",{});var Fo=n(Ee);b(J.$$.fragment,Fo),Fo.forEach(o),qo.forEach(o),Ur=p(ar),ke=a(ar,"SPAN",{});var So=n(ke);Vr=l(So,"GraphormerForGraphClassification"),So.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 Io=n(Ne);Kr=l(Io,"This model can be used for graph-level classification or regression tasks."),Io.forEach(o),Qr=p(_),Ae=a(_,"P",{});var Do=n(Ae);Wr=l(Do,"It can be trained on"),Do.forEach(o),Zr=p(_),P=a(_,"UL",{});var ce=n(P);Le=a(ce,"LI",{});var Mo=n(Le);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),Pe=a(ce,"LI",{});var Oo=n(Pe);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),ze=a(ce,"LI",{});var Ro=n(ze);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(C,"name","hf:doc:metadata"),s(C,"content",JSON.stringify(Wo)),s(z,"id","graphormer"),s(z,"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(z,"href","#graphormer"),s($,"class","relative group"),s(q,"id","overview"),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","#overview"),s(T,"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(I,"id","transformers.GraphormerConfig"),s(I,"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(I,"href","#transformers.GraphormerConfig"),s(E,"class","relative group"),s(ne,"href","/docs/transformers/v4.33.0/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.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),s(ie,"href","/docs/transformers/v4.33.0/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(D,"id","transformers.GraphormerModel"),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.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(L,"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,C),h(e,Se,m),h(e,$,m),r($,z),r(z,ue),y(R,ue,null),r($,nr),r($,ge),r(ge,sr),h(e,Ie,m),h(e,T,m),r(T,q),r(q,_e),y(Y,_e,null),r(T,ir),r(T,ve),r(ve,lr),h(e,De,m),h(e,F,m),r(F,mr),r(F,B),r(B,dr),r(F,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,S,m),r(S,ur),r(S,ye),r(ye,gr),r(S,_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,E,m),r(E,I),r(I,we),y(V,we,null),r(E,Cr),r(E,Ge),r(Ge,$r),h(e,Ve,m),h(e,u,m),y(j,u,null),r(u,Tr),r(u,k),r(k,Er),r(k,ne),r(ne,kr),r(k,Nr),r(k,K),r(K,Ar),r(k,Lr),r(u,Pr),r(u,N),r(N,zr),r(N,se),r(se,qr),r(N,Fr),r(N,ie),r(ie,Sr),r(N,Ir),h(e,je,m),h(e,A,m),r(A,D),r(D,xe),y(Q,xe,null),r(A,Dr),r(A,Ce),r(Ce,Mr),h(e,Ke,m),h(e,c,m),y(W,c,null),r(c,Or),r(c,$e),r($e,Rr),r(c,Yr),r(c,Te),r(Te,Br),r(c,Hr),r(c,le),y(Z,le,null),h(e,Qe,m),h(e,L,m),r(L,M),r(M,Ee),y(J,Ee,null),r(L,Ur),r(L,ke),r(ke,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,P),r(P,Le),r(Le,Jr),r(P,Xr),r(P,Pe),r(Pe,eo),r(P,ro),r(P,ze),r(ze,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(C),e&&o(Se),e&&o($),x(R),e&&o(Ie),e&&o(T),x(Y),e&&o(De),e&&o(F),e&&o(Me),e&&o(re),e&&o(Oe),e&&o(oe),e&&o(Re),e&&o(te),e&&o(Ye),e&&o(S),e&&o(Be),e&&o(ae),e&&o(He),e&&o(g),e&&o(Ue),e&&o(E),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(L),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(C){super();Ho(this,C,Zo,Qo,Uo,{})}}export{rt as default,Wo as metadata};
