Ekko-zn / AIGCDetectBenchmark

189 stars 17 forks source link

The .pth file saved by the train.py during reproducing for Gramnet seems incorrect for the eval_all.py #19

Open AnnicePlayer opened 4 months ago

AnnicePlayer commented 4 months ago

Hi, and thanks for your incredible work! I encountered an issue while attempting to replicate the training and testing steps of Gram. I used the following commands:

However, I ran into the following error at the beginning of testing: "[ERROR] model.load_state_dict() error". After reviewing eval_all.py, it turns out that the script encounters a problem with the line of model.load_state_dict(state_dict['netC'], strict=True). Actually, the 'netC' parameters are present in the pretrained weights files ./weights/Gram.pth provided in your project. Yet, the auto-saved model_epoch_best.pth during GramNet's training phrase only generates keys listed as ['model', 'optimizer', 'total_steps'], where 'netC' is absent from the 'model' dictionary.

Is there anything wrong with the commands I used, or is there any modification needed in my opts to resolve this discrepancy?