示例#1
0
import sys

import torch
from torch.backends import cudnn

from processor.processor import Processor

torch.backends.cudnn.deterministic = False
cudnn.benchmark = True  # https://discuss.pytorch.org/t/what-does-torch-backends-cudnn-benchmark-do/5936
torch.cuda.empty_cache()  # release cache

if __name__ == '__main__':
    proc = Processor(sys.argv[1:])
    proc.start()
示例#2
0
文件: main.py 项目: zqylen/MAGCN
    parser.add_argument('--num_of_vertices',
                        type=int,
                        default=358,
                        help='The number of vertices')
    parser.add_argument('--gen_config_args',
                        type=dict,
                        default=dict(),
                        help='The config of data generate')
    return parser


if __name__ == '__main__':
    parser = get_parser()

    # load arg form config file
    p = parser.parse_args()
    if p.config is not None:
        with open(p.config, 'r') as f:
            default_arg = yaml.load(f)
        key = vars(p).keys()
        for k in default_arg.keys():
            if k not in key:
                print('WRONG ARG: {}'.format(k))
                assert (k in key)
        parser.set_defaults(**default_arg)

    arg = parser.parse_args()
    init_seed(0)
    processor = Processor(arg)
    processor.start()