MilesCranmer commited on
Commit
f7b43ed
1 Parent(s): c134e5e

Dont warn user if already turned off progress bar

Browse files
Files changed (1) hide show
  1. pysr/sr.py +8 -4
pysr/sr.py CHANGED
@@ -1271,9 +1271,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1271
  f"PySR currently only supports the following optimizer algorithms: {VALID_OPTIMIZER_ALGORITHMS}"
1272
  )
1273
 
 
1274
  # 'Mutable' parameter validation
1275
- buffer_available = "buffer" in sys.stdout.__dir__()
1276
- # Params and their default values, if None is given:
1277
  default_param_mapping = {
1278
  "binary_operators": "+ * - /".split(" "),
1279
  "unary_operators": [],
@@ -1282,7 +1282,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1282
  "multithreading": self.procs != 0 and self.cluster_manager is None,
1283
  "batch_size": 1,
1284
  "update_verbosity": int(self.verbosity),
1285
- "progress": buffer_available,
1286
  }
1287
  packed_modified_params = {}
1288
  for parameter, default_value in default_param_mapping.items():
@@ -1301,7 +1301,11 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1301
  "`batch_size` has been increased to equal one."
1302
  )
1303
  parameter_value = 1
1304
- elif parameter == "progress" and not buffer_available:
 
 
 
 
1305
  warnings.warn(
1306
  "Note: it looks like you are running in Jupyter. "
1307
  "The progress bar will be turned off."
 
1271
  f"PySR currently only supports the following optimizer algorithms: {VALID_OPTIMIZER_ALGORITHMS}"
1272
  )
1273
 
1274
+ progress = self.progress
1275
  # 'Mutable' parameter validation
1276
+ # (Params and their default values, if None is given:)
 
1277
  default_param_mapping = {
1278
  "binary_operators": "+ * - /".split(" "),
1279
  "unary_operators": [],
 
1282
  "multithreading": self.procs != 0 and self.cluster_manager is None,
1283
  "batch_size": 1,
1284
  "update_verbosity": int(self.verbosity),
1285
+ "progress": progress,
1286
  }
1287
  packed_modified_params = {}
1288
  for parameter, default_value in default_param_mapping.items():
 
1301
  "`batch_size` has been increased to equal one."
1302
  )
1303
  parameter_value = 1
1304
+ elif (
1305
+ parameter == "progress"
1306
+ and parameter_value
1307
+ and "buffer" not in sys.stdout.__dir__()
1308
+ ):
1309
  warnings.warn(
1310
  "Note: it looks like you are running in Jupyter. "
1311
  "The progress bar will be turned off."