-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphormer multi label classification label input format #23697
Comments
Hi! It's basically a list of ints. You can see an example of a graph with multiple labels with the ogbg-molcpba dataset. There is a detailed explanation of the types needed as inputs of graph classification in the blog post on graph classification using transformers. Can you please tell me what added information you need? |
While trying to train, I'm getting the error message of TypeError: _stack_dispatcher() got an unexpected keyword argument 'dim'. At the same time, It is working for regression/Binary classification/multi class classification usecases. |
Hi! |
Please find below stack trace: /usr/local/lib/python3.10/dist-packages/transformers/optimization.py:407: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set |
Hi @techthiyanes , |
Hi @clefourrier , Thank you for your time and response. -- coding: utf-8 --"""Untitled334.ipynb Automatically generated by Colaboratory. Original file is located at !pip install -q -U datasets transformers Cython accelerate !pip install -q -U matplotlib networkx from transformers.utils import is_cython_available from datasets import load_dataset We want to plot the first train graphgraph = dataset["train"][0] Conversion to networkx formatG = nx.Graph() Plotnx.draw(G) dataset from transformers.models.graphormer.collating_graphormer import preprocess_item, GraphormerDataCollator split up training into training + validationtrain_ds = dataset_processed['train'] from transformers import GraphormerForGraphClassification model_checkpoint = "clefourrier/graphormer-base-pcqm4mv2" # pre-trained model from which to fine-tune model = GraphormerForGraphClassification.from_pretrained( from transformers import TrainingArguments, Trainer trainer.train() !pip install -q -U datasets transformers Cython accelerate !pip install -q -U matplotlib networkx from transformers.utils import is_cython_available from datasets import load_dataset We want to plot the first train graphgraph = dataset["train"][0] Conversion to networkx formatG = nx.Graph() Plotnx.draw(G) dataset from transformers.models.graphormer.collating_graphormer import preprocess_item, GraphormerDataCollator split up training into training + validationtrain_ds = dataset_processed['train'] from transformers import GraphormerForGraphClassification model_checkpoint = "clefourrier/graphormer-base-pcqm4mv2" # pre-trained model from which to fine-tune model = GraphormerForGraphClassification.from_pretrained( from transformers import TrainingArguments, Trainer trainer.train() Thanks |
Ok, thank you very much for reporting! I can reproduce your issue, I'll fix it asap |
I fixed this problem in the PR above (now we need to wait for the fix to be merged, which will not be instantaneous). Thank you very much for reporting! 🤗 Note that for multi-label classification, you will also need to provide the correct number of labels (in this case 128) to model_checkpoint = "clefourrier/graphormer-base-pcqm4mv2" # pre-trained model from which to fine-tune
model = GraphormerForGraphClassification.from_pretrained(
model_checkpoint,
num_classes=128, # HERE
ignore_mismatched_sizes = True, # provide this in case you're planning to fine-tune an already fine-tuned checkpoint
) |
System Info
NA
Who can help?
@clefourrier
Kindly share the input format for multi label classification specially on the label side.
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
NA
Expected behavior
NA
The text was updated successfully, but these errors were encountered: