Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Compatibility issues with model loading and TensorBoard #779

Closed
jackeuylov opened this issue Dec 12, 2024 · 2 comments · Fixed by #780
Closed

[BUG]: Compatibility issues with model loading and TensorBoard #779

jackeuylov opened this issue Dec 12, 2024 · 2 comments · Fixed by #780
Assignees
Labels
bug Something isn't working

Comments

@jackeuylov
Copy link

What happened?

A bug happened!
When I am using model loading and TensorBoard simultaneously, I get the following error:
888cde09aa6eb3d5025f862fbcffae9
The case used is the code in Examples:
first, Using a model with TensorBoard to generate hall_of_fame:

import numpy as np
from pysr import PySRRegressor, TensorBoardLoggerSpec
rstate = np.random.RandomState(42)
X = rstate.uniform(-3, 3, (1000, 2))
y = np.exp(X[:, 0]) + X[:, 1]
logger_spec = TensorBoardLoggerSpec(
    log_dir="logs/run",
    log_interval=10,  # Log every 10 iterations
)
model = PySRRegressor(
    binary_operators=["+", "*", "-", "/"],
    logger_spec=logger_spec,
)
model.fit(X, y)

then, Using the model loading function to optimize the hall_of_fame.

import numpy as np
from pysr import PySRRegressor, TensorBoardLoggerSpec
rstate = np.random.RandomState(42)
X = rstate.uniform(-3, 3, (1000, 2))
y = np.exp(X[:, 0]) + X[:, 1]
model = PySRRegressor.from_file(run_directory="outputs/20241212_222454_uKch8W")
model.fit(X, y)

Then there will be the above error.

Version

1.1.0

Operating System

No response

Package Manager

None

Interface

IPython Terminal

Relevant log output

No response

Extra Info

No response

@MilesCranmer
Copy link
Owner

Thinking out loud, I think I know the issue. It’s the fact we don’t remove the logger from the state saved to the pickle file. Basically, we can’t pickle Julia objects. This new feature needs to be masked from the pickle

@MilesCranmer
Copy link
Owner

#780 should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants