Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
754d7db
1
Parent(s):
f72e324
Only activate env on first run
Browse files- pysr/sr.py +18 -17
pysr/sr.py
CHANGED
@@ -423,23 +423,24 @@ def pysr(
|
|
423 |
except:
|
424 |
_, term_width = subprocess.check_output(["stty", "size"]).split()
|
425 |
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
|
|
443 |
|
444 |
Main.custom_loss = Main.eval(loss)
|
445 |
|
|
|
423 |
except:
|
424 |
_, term_width = subprocess.check_output(["stty", "size"]).split()
|
425 |
|
426 |
+
if not already_ran:
|
427 |
+
from julia import Pkg
|
428 |
+
|
429 |
+
Pkg.activate(f"{_escape_filename(julia_project)}")
|
430 |
+
if need_install:
|
431 |
+
Pkg.instantiate()
|
432 |
+
Pkg.update()
|
433 |
+
Pkg.precompile()
|
434 |
+
elif update:
|
435 |
+
Pkg.update()
|
436 |
+
|
437 |
+
Main.eval("using SymbolicRegression")
|
438 |
+
|
439 |
+
Main.plus = Main.eval("(+)")
|
440 |
+
Main.sub = Main.eval("(-)")
|
441 |
+
Main.mult = Main.eval("(*)")
|
442 |
+
Main.pow = Main.eval("(^)")
|
443 |
+
Main.div = Main.eval("(/)")
|
444 |
|
445 |
Main.custom_loss = Main.eval(loss)
|
446 |
|