File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,7 +251,8 @@ def train(
251251 output : str = "out.json" ,
252252) -> None :
253253 log .info ("Configuration path: %s" , input_file )
254- env .CUSTOM_OP_USE_JIT = True
254+ if not env .COMPILE :
255+ env .CUSTOM_OP_USE_JIT = True
255256 if LOCAL_RANK == 0 :
256257 SummaryPrinter ()()
257258 with open (input_file ) as fin :
Original file line number Diff line number Diff line change 5353 get_sampler_from_params ,
5454)
5555from deepmd .pt .utils .env import (
56+ COMPILE ,
5657 DEVICE ,
5758 JIT ,
5859 LOCAL_RANK ,
@@ -413,9 +414,13 @@ def get_lr(lr_params):
413414 self .lr_exp = get_lr (config ["learning_rate" ])
414415
415416 # JIT
416- if JIT :
417+ if JIT or COMPILE :
417418 self .model = torch .jit .script (self .model )
418-
419+ if COMPILE :
420+ self .model = torch .compile (
421+ self .model ,
422+ dynamic = True ,
423+ )
419424 # Model Wrapper
420425 self .wrapper = ModelWrapper (self .model , self .loss , model_params = model_params )
421426 self .start_step = 0
Original file line number Diff line number Diff line change 4646CACHE_PER_SYS = 5 # keep at most so many sets per sys in memory
4747ENERGY_BIAS_TRAINABLE = True
4848CUSTOM_OP_USE_JIT = False
49+ COMPILE = True
4950
5051PRECISION_DICT = {
5152 "float16" : torch .float16 ,
You can’t perform that action at this time.
0 commit comments