File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 78
78
79
79
HIP_FP8_E4M3_FNUZ_MAX = 224.0
80
80
81
+ _warned_bool_env_var_keys = set ()
82
+
81
83
82
84
def get_bool_env_var (name : str , default : str = "false" ) -> bool :
83
85
value = os .getenv (name , default )
84
- return value .lower () in ("true" , "1" )
86
+ value = value .lower ()
87
+
88
+ truthy_values = ("true" , "1" )
89
+ falsy_values = ("false" , "0" )
90
+
91
+ if (value not in truthy_values ) and (value not in falsy_values ):
92
+ if value not in _warned_bool_env_var_keys :
93
+ logger .warning (
94
+ f"get_bool_env_var({ name } ) see non-understandable value={ value } and treat as false"
95
+ )
96
+ _warned_bool_env_var_keys .add (value )
97
+
98
+ return value in truthy_values
85
99
86
100
87
101
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
You can’t perform that action at this time.
0 commit comments