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

Integration with fragile v0.0.44 #36

Closed
Guillemdb opened this issue Apr 4, 2020 · 7 comments · Fixed by #39
Closed

Integration with fragile v0.0.44 #36

Guillemdb opened this issue Apr 4, 2020 · 7 comments · Fixed by #39
Labels
enhancement New feature or request released

Comments

@Guillemdb
Copy link

Something came up and I cannot make the PR till at least Monday, but here you have a gist with the code to get rid of plangym as a dependence.

I didn't have time to test is properly but I am 95% sure it should work. If it doesn't please write me here and I will help you fix it.

https://gist.github.com/Guillemdb/405b03f4dd885b0f46018f0f190df6f9

@justindujardin
Copy link
Owner

Thanks for the gist example! Based on it I was able to get the new style code working without a plangym dependency! 👏

I had to open a PR to fragile because it was pulling in the plangym dependency in the core library (and with it pillow-simd)

Here's the PR that implements your gist: #39

@justindujardin
Copy link
Owner

@all-contributors please add @Guillemdb for code

@allcontributors
Copy link
Contributor

@justindujardin

I've put up a pull request to add @Guillemdb! 🎉

@justindujardin
Copy link
Owner

Thanks for your help @Guillemdb!

I had some trouble with the ParallelEnv wrapper, so I removed it for now. When I used it I got an error about FragileEnvironment doesn't have a __call__ method:

def swarm_solve(problem: str, config: SwarmConfig):
    env_callable = lambda: FragileMathyEnv(
        name="mathy_v0", problem=problem, repeat_problem=True
    )
    mathy_env: MathyEnv = env_callable()._env._env.mathy
    if config.use_mp:
        env_callable = ParallelEnv(env_callable=env_callable)
    swarm = Swarm(
        model=lambda env: DiscreteMasked(env=env),
        env=env_callable,
        reward_limit=EnvRewards.WIN,
        n_walkers=config.n_walkers,
        max_epochs=config.max_iters,
        reward_scale=1,
        distance_scale=3,
        distance_function=mathy_dist,
        show_pbar=False,
    )

If it's helpful for you I can reproduce the error again, otherwise, I'll just leave the Parallel runner out for the moment since I'm short on time.

I also had the all-contributors bot add you to the contributor list because of your fragile and gist contributions. This means you'll show up on the site and in the GitHub readme:

@github-actions
Copy link

github-actions bot commented Apr 5, 2020

🎉 This issue has been resolved in version 0.7.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Guillemdb
Copy link
Author

Guillemdb commented Apr 6, 2020

@justindujardin this is my fault, I made a mistake gist where I showed you how to define the parallel environment.

It should also be passed as an env_callable just like a regular environment with lambda: ParallelEnv(env_callable=env_callable), but I will be adding a __call__ method to avoid having to create a lambda function. Thanks fot the idea.

@justindujardin

I've put up a pull request to add @Guillemdb! tada

Thank you man! I really appreciate it. I am sorry I couldn't help you more this weekend.

@justindujardin
Copy link
Owner

Thanks for the mp fix! I restored the functionality in #42 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants