File tree Expand file tree Collapse file tree
paddleformers/transformers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1395,7 +1395,7 @@ def __new__(cls, config):
13951395 model_provider_class = GLMMoEModelProvider
13961396 model_provider = model_provider_class .from_config (config )
13971397 loss_fn = None
1398- if hasattr (config , "dpo_config" ):
1398+ if getattr (config , "dpo_config" , None ):
13991399 loss_fn = CriterionLayerPipe (config , use_infohub = True )
14001400 gpt_model = model_provider .provide (loss_fn = loss_fn )
14011401 gpt_model ._gen_aoa_config = cls ._gen_aoa_config
@@ -1569,7 +1569,7 @@ def __new__(cls, config):
15691569 model_provider_class = GLMMoEModelProvider
15701570 model_provider = model_provider_class .from_config (config )
15711571 loss_fn = None
1572- if hasattr (config , "dpo_config" ):
1572+ if getattr (config , "dpo_config" , None ):
15731573 loss_fn = CriterionLayerPipe (config , use_infohub = True )
15741574 gpt_model = model_provider .provide (loss_fn = loss_fn )
15751575 gpt_model ._gen_aoa_config = cls ._gen_aoa_config
Original file line number Diff line number Diff line change @@ -1218,7 +1218,7 @@ def __new__(cls, config):
12181218 model_provider_class = Qwen3MoEModelProvider
12191219 model_provider = model_provider_class .from_config (config )
12201220 loss_fn = None
1221- if hasattr (config , "dpo_config" ):
1221+ if getattr (config , "dpo_config" , None ):
12221222 loss_fn = CriterionLayerPipe (config , use_infohub = True )
12231223 gpt_model = model_provider .provide (loss_fn = loss_fn )
12241224 gpt_model ._gen_aoa_config = cls ._gen_aoa_config
@@ -1372,7 +1372,7 @@ def __new__(cls, config):
13721372 model_provider_class = Qwen3MoEModelProvider
13731373 model_provider = model_provider_class .from_config (config )
13741374 loss_fn = None
1375- if hasattr (config , "dpo_config" ):
1375+ if getattr (config , "dpo_config" , None ):
13761376 loss_fn = CriterionLayerPipe (config , use_infohub = True )
13771377 gpt_model = model_provider .provide (loss_fn = loss_fn )
13781378 gpt_model ._gen_aoa_config = cls ._gen_aoa_config
You can’t perform that action at this time.
0 commit comments