MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / main

Function main

examples/pytorch/vit/ViT-quantization/eval_engine.py:530–568  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

528
529
530def main():
531
532 args, config = parse_option()
533 # print(config.dump())
534
535 # Setup CUDA, GPU & distributed training
536 if args.local_rank == -1:
537 device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
538 args.n_gpu = torch.cuda.device_count()
539 else: # Initializes the distributed backend which will take care of sychronizing nodes/GPUs
540 torch.cuda.set_device(args.local_rank)
541 device = torch.device("cuda", args.local_rank)
542 torch.distributed.init_process_group(backend='nccl',
543 timeout=timedelta(minutes=60))
544 args.n_gpu = 1
545 args.device = device
546
547 # Setup logging
548 logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
549 datefmt='%m/%d/%Y %H:%M:%S',
550 level=logging.INFO if args.local_rank in [-1, 0] else logging.WARN)
551 logger.warning("Process rank: %s, device: %s, n_gpu: %s, distributed training: %s, 16-bits training: %s" %
552 (args.local_rank, args.device, args.n_gpu, bool(args.local_rank != -1), args.fp16))
553
554 # Set seed
555 set_seed(args)
556
557 if args.engine:
558 validate_trt(args, config)
559
560 # Calibration
561 if args.calib:
562 args, model = setup(args)
563 calib(args, config, model)
564
565 # Quantization-Aware Training
566 if args.train:
567 # args, model = setup(args)
568 train(args, config)
569
570
571if __name__ == "__main__":

Callers 1

eval_engine.pyFile · 0.70

Calls 7

parse_optionFunction · 0.70
set_seedFunction · 0.70
validate_trtFunction · 0.70
setupFunction · 0.70
calibFunction · 0.70
trainFunction · 0.70
deviceMethod · 0.45

Tested by

no test coverage detected