phdymz / ProteinMAE

Official PyTorch implementation of "ProteinMAE: Masked Autoencoder for Protein Surface Self-supervised Learning".
9 stars 0 forks source link

wrong boolean actions in arguments.py #2

Open rubenalv opened 3 months ago

rubenalv commented 3 months ago

Arguments.py seems taken from the dMaSIF code, which had the same issue. In Argsparse, setting type=bool and default=True does not give what you initially expect. Eg, you cannot turn off the search using --search False. This could have implications on how the model was trained too?

Example:

args.py

import argparse
parser = argparse.ArgumentParser(description="Network parameters")  
parser.add_argument(
    "--search_wrong",
    type=bool,
    default=True,
    help="Predict matching between two partners",
)  
parser.add_argument(
    "--search_wrongFalse",
    type=bool,
    default=False,
    help="Predict matching between two partners",
)
parser.add_argument('--search_right', action=argparse.BooleanOptionalAction)  

test.py

from args import parser

# Parse the arguments
args = parser.parse_args()
print('search wrong, set to True in args.py')
print(args.search_wrong)
print('search_right, set as boolean action in args.py')
print(args.search_right)

Run python test.py search wrong, set to True in args.py True search wrongFalse, set to False in args.py False search_right, set as boolean action in args.py None

Run python test.py --search_wrong False --search_wrongFalse True --search_right search wrong, set to True in args.py True search wrongFalse, set to False in args.py True search_right, set as boolean action in args.py True

Run python test.py --search_wrong False --search_wrongFalse True --no-search_right search wrong, set to True in args.py True search wrongFalse, set to False in args.py True search_right, set as boolean action in args.py False

The only flag that gives exactly what you think it would is --search_right vs --no-search_right. It also works if you set the flag as boolean with False as default, but that is not the case in the current Arguments.py.

phdymz commented 3 months ago

In fact, many contents in Argsparse will not affect the operation of the program, such as True/False of search or site, because we have already calculated and stored the point cloud offline for the sake of convenience, and there is no need to change True/False to decide which task to perform as in dmasif.

phdymz commented 3 months ago

To perform each downstream task, just go to the folder of each downstream task and follow the instructions in the readme. Use the default value for search or site.

rubenalv commented 3 months ago

Ah, thank you. Inference would be OK, but if the flags do not work as expected, would that affect re-training? Eg the original dMaSIF had an AUROC that I substantially improved when retraining with a larger protein pair database (https://github.com/BioinfoMachineLearning/DIPS-Plus).

phdymz commented 3 months ago

The parameters related to training may only be network parameters, and parameters such as site/search should not be related to training. It is worth noting that if you plan to use a larger dataset, you need to preprocess the dataset into a point cloud. It should be fine to process it in the same format as the point cloud I uploaded.