File tree 2 files changed +10
-8
lines changed
src/transformers/models/modernbert 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -671,10 +671,11 @@ def _maybe_set_compile(self):
671
671
self .config .reference_compile = False
672
672
673
673
if self .device .type == "cpu" :
674
- logger .warning_once (
675
- "Compiling the model with `torch.compile` and using a `torch.cpu` device is not supported. "
676
- "Falling back to non-compiled mode."
677
- )
674
+ if self .config .reference_compile :
675
+ logger .warning_once (
676
+ "Compiling the model with `torch.compile` and using a `torch.cpu` device is not supported. "
677
+ "Falling back to non-compiled mode."
678
+ )
678
679
self .config .reference_compile = False
679
680
680
681
if self .config .reference_compile is None :
Original file line number Diff line number Diff line change @@ -901,10 +901,11 @@ def _maybe_set_compile(self):
901
901
self .config .reference_compile = False
902
902
903
903
if self .device .type == "cpu" :
904
- logger .warning_once (
905
- "Compiling the model with `torch.compile` and using a `torch.cpu` device is not supported. "
906
- "Falling back to non-compiled mode."
907
- )
904
+ if self .config .reference_compile :
905
+ logger .warning_once (
906
+ "Compiling the model with `torch.compile` and using a `torch.cpu` device is not supported. "
907
+ "Falling back to non-compiled mode."
908
+ )
908
909
self .config .reference_compile = False
909
910
910
911
if self .config .reference_compile is None :
You can’t perform that action at this time.
0 commit comments