Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
e8478b2
1
Parent(s):
8d810c2
Fix `from_file` when loading pkl + csv from subdir
Browse files- pysr/sr.py +5 -0
pysr/sr.py
CHANGED
@@ -878,6 +878,11 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
878 |
assert n_features_in is None
|
879 |
with open(pkl_filename, "rb") as f:
|
880 |
model = pkl.load(f)
|
|
|
|
|
|
|
|
|
|
|
881 |
# Update any parameters if necessary, such as
|
882 |
# extra_sympy_mappings:
|
883 |
model.set_params(**pysr_kwargs)
|
|
|
878 |
assert n_features_in is None
|
879 |
with open(pkl_filename, "rb") as f:
|
880 |
model = pkl.load(f)
|
881 |
+
# Change equation_file_ to be in the same dir as the pickle file
|
882 |
+
base_dir = os.path.dirname(pkl_filename)
|
883 |
+
base_equation_file = os.path.basename(model.equation_file_)
|
884 |
+
model.equation_file_ = os.path.join(base_dir, base_equation_file)
|
885 |
+
|
886 |
# Update any parameters if necessary, such as
|
887 |
# extra_sympy_mappings:
|
888 |
model.set_params(**pysr_kwargs)
|