We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2badf6e commit 0cbadd7Copy full SHA for 0cbadd7
PyTorch/Segmentation/MaskRCNN/pytorch/tools/test_net.py
@@ -96,13 +96,14 @@ def main():
96
model = build_detection_model(cfg)
97
model.to(cfg.MODEL.DEVICE)
98
99
- # Initialize mixed-precision if necessary
+ # Initialize mixed-precision
100
if args.fp16:
101
use_mixed_precision = True
102
else:
103
use_mixed_precision = cfg.DTYPE == "float16"
104
- amp_handle = amp.init(enabled=use_mixed_precision, verbose=cfg.AMP_VERBOSE)
105
-
+ amp_opt_level = 'O1' if use_mixed_precision else 'O0'
+ model = amp.initialize(model, opt_level=amp_opt_level)
106
+
107
output_dir = cfg.OUTPUT_DIR
108
checkpointer = DetectronCheckpointer(cfg, model, save_dir=output_dir)
109
_ = checkpointer.load(cfg.MODEL.WEIGHT)
0 commit comments