Skip to content

[BUG]: PySRRegressor.from_file throws AttributeError #700

Open
@tbuckworth

Description

@tbuckworth

What happened?

When loading a saved model with from_file, an AttributeError is thrown:

AttributeError: 'PySRRegressor' object has no attribute 'dimensionless_constants_only'

I am using version 0.18.4 and it is possible that the model I am loading was saved under an older version (0.17.2 maybe) - could that be the problem?

Version

0.18.4

Operating System

Linux

Package Manager

pip

Interface

Script (i.e., python my_script.py)

Relevant log output

msg_model = PySRRegressor.from_file(pickle_filename, extra_torch_mappings=get_extra_torch_mappings())
Checking if logs/train/cartpole/2024-07-11__04-48-25__seed_6033/symbreg/2024-07-22__04-36-52/msg/2024-07-22__04-36-55/symb_reg.pkl exists...
Loading model from logs/train/cartpole/2024-07-11__04-48-25__seed_6033/symbreg/2024-07-22__04-36-52/msg/2024-07-22__04-36-55/symb_reg.pkl
Traceback (most recent call last):
  File "/home/titus/PycharmProjects/train-procgen-pytorch/venv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-fec4b34b7d62>", line 1, in <module>
    msg_model = PySRRegressor.from_file(pickle_filename, extra_torch_mappings=get_extra_torch_mappings())
  File "/home/titus/PycharmProjects/train-procgen-pytorch/venv/lib/python3.8/site-packages/pysr/sr.py", line 969, in from_file
    model.set_params(**pysr_kwargs)
  File "/home/titus/PycharmProjects/train-procgen-pytorch/venv/lib/python3.8/site-packages/sklearn/base.py", line 223, in set_params
    valid_params = self.get_params(deep=True)
  File "/home/titus/PycharmProjects/train-procgen-pytorch/venv/lib/python3.8/site-packages/sklearn/base.py", line 195, in get_params
    value = getattr(self, key)
AttributeError: 'PySRRegressor' object has no attribute 'dimensionless_constants_only'

Extra Info

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions