Spaces:
Running
Running
Commit
·
e3e2116
1
Parent(s):
269706f
Query terminal size in more compatible way
Browse files- pysr/sr.py +5 -1
pysr/sr.py
CHANGED
|
@@ -418,6 +418,10 @@ def _make_hyperparams_julia_str(X, alpha, annealing, batchSize, batching, binary
|
|
| 418 |
ncyclesperiteration, fractionReplaced, topn, verbosity, progress, loss,
|
| 419 |
weightDeleteNode, weightDoNothing, weightInsertNode, weightMutateConstant,
|
| 420 |
weightMutateOperator, weightRandomize, weightSimplify, weights, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
def tuple_fix(ops):
|
| 422 |
if len(ops) > 1:
|
| 423 |
return ', '.join(ops)
|
|
@@ -483,7 +487,7 @@ fractionReplaced={fractionReplaced:f}f0,
|
|
| 483 |
topn={topn:d},
|
| 484 |
verbosity=round(Int32, {verbosity:f}),
|
| 485 |
progress={'true' if progress else 'false'},
|
| 486 |
-
terminal_width={
|
| 487 |
"""
|
| 488 |
|
| 489 |
def_hyperparams += '\n)'
|
|
|
|
| 418 |
ncyclesperiteration, fractionReplaced, topn, verbosity, progress, loss,
|
| 419 |
weightDeleteNode, weightDoNothing, weightInsertNode, weightMutateConstant,
|
| 420 |
weightMutateOperator, weightRandomize, weightSimplify, weights, **kwargs):
|
| 421 |
+
try:
|
| 422 |
+
term_width = shutil.get_terminal_size().columns
|
| 423 |
+
except:
|
| 424 |
+
_, term_width = subprocess.check_output(['stty', 'size']).split()
|
| 425 |
def tuple_fix(ops):
|
| 426 |
if len(ops) > 1:
|
| 427 |
return ', '.join(ops)
|
|
|
|
| 487 |
topn={topn:d},
|
| 488 |
verbosity=round(Int32, {verbosity:f}),
|
| 489 |
progress={'true' if progress else 'false'},
|
| 490 |
+
terminal_width={term_width:d}
|
| 491 |
"""
|
| 492 |
|
| 493 |
def_hyperparams += '\n)'
|