1919import torch
2020from torch .utils .data import DataLoader
2121
22- from pytorch_lightning import _logger as log
2322from pytorch_lightning .callbacks import GradientAccumulationScheduler
2423from pytorch_lightning .core .lightning import LightningModule
2524from pytorch_lightning .overrides .base import _LightningModuleWrapperBase
@@ -67,7 +66,6 @@ def __init__(
6766 device_iterations : int = 1 ,
6867 autoreport : bool = True ,
6968 autoreport_dir : Optional [str ] = None ,
70- convert_model_to_half : bool = False ,
7169 parallel_devices : Optional [List [torch .device ]] = None ,
7270 cluster_environment : Optional [ClusterEnvironment ] = None ,
7371 training_opts : Optional ['poptorch.Options' ] = None ,
@@ -82,7 +80,6 @@ def __init__(
8280 autoreport: Enable auto-reporting for IPUs using PopVision
8381 https://docs.graphcore.ai/projects/graphcore-popvision-user-guide/en/latest/graph/graph.html
8482 autoreport_dir: Optional directory to store autoReport output.
85- convert_model_to_half: Converts the model to half precision, which can be used for pure FP16 training.
8683 training_opts: Optional ``poptorch.Options`` to override the default created options for training.
8784 inference_opts: Optional ``poptorch.Options`` to override the default
8885 created options for validation/testing and predicting.
@@ -94,7 +91,6 @@ def __init__(
9491 "Learn more or get started with IPUs at https://www.graphcore.ai/getstarted"
9592 )
9693
97- self .convert_model_to_half = convert_model_to_half
9894 self .device_iterations = device_iterations
9995 self .autoreport = autoreport
10096 self .autoreport_dir = autoreport_dir
@@ -113,12 +109,7 @@ def __init__(
113109
114110 def pre_dispatch (self ) -> None :
115111 self ._handle_gradient_accumulation_steps ()
116- if self .convert_model_to_half :
117- log .info ('Using full 16bit precision, converting LightningModule weights to FP16.' )
118- self .model = self .model .half ()
119112 precision = self .lightning_module .trainer .precision
120- precision = 16 if self .convert_model_to_half else precision
121-
122113 model = LightningIPUModule (self .lightning_module , precision )
123114 self .model = model
124115
0 commit comments