microsoft / Graphormer

Graphormer is a general-purpose deep learning backbone for molecular modeling.
MIT License
2.08k stars 334 forks source link

Binary pretrained model can't train a multi-class classifier? #172

Open Bai1026 opened 1 year ago

Bai1026 commented 1 year ago

I use model_checkpoint = "clefourrier/graphormer-base-pcqm4mv2" # pre-trained model from which to fine-tune to be my pretrained model, and my dataset is here. I follow the code in this website. But change the

model = GraphormerForGraphClassification.from_pretrained(
    model_checkpoint, 

    # We have 167 attack patterns and 1 benign
    num_classes=168, 

    # provide this in case you're planning to fine-tune an already fine-tuned checkpoint
    ignore_mismatched_sizes = True, 

Since I have 168 class to be classified. Then when I run the python script, I encountered:

Some weights of GraphormerForGraphClassification were not initialized from the model checkpoint at clefourrier/graphormer-base-pcqm4mv2 and are newly initialized because the shapes did not match:
- classifier.classifier.weight: found shape torch.Size([1, 768]) in the checkpoint and torch.Size([168, 768]) in the model instantiated
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
  0%|                                                                                                                                                                                                                                          | 0/23120 [00:00<?, ?it/s]

For about 20 min, the log didn't move at all.