Giter Club home page Giter Club logo

Comments (6)

pseudo-rnd-thoughts avatar pseudo-rnd-thoughts commented on June 15, 2024

Thanks for reporting this, what is the difference between a substrate and a scenario?

@elliottower should be able to advise on updating the environment

Could you post the follow up pickle error?

from shimmy.

s-a-barnett avatar s-a-barnett commented on June 15, 2024

Broadly speaking, a scenario is a substrate with a background population controlling some of the player roles. More formally, it is an instance of a substrate (the underlying substrate can be recovered with the _substrate property, as with the above code, but with various modifications made to it. The following code reproduces the error:

from shimmy import MeltingPotCompatibilityV0
import supersuit as ss
from meltingpot import scenario

mp_env = scenario.build_from_config(scenario.get_config('clean_up_0'))
env = MeltingPotCompatibilityV0(env=mp_env)
env = ss.observation_lambda_v0(env, lambda x, _: x["RGB"], lambda s: s["RGB"])
env = ss.frame_stack_v1(env, 4)
env = ss.pettingzoo_env_to_vec_env_v1(env)
env = ss.concat_vec_envs_v1(env, num_vec_envs=1, num_cpus=1, base_class="stable_baselines3")

And this is the error once the adjustments to meltingpot_compatibility.py above are made:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/supersuit/vector/vector_constructors.py", line 64, in concat_vec_envs_v1
    vec_env = MakeCPUAsyncConstructor(num_cpus)(*vec_env_args(vec_env, num_vec_envs))
  File "/usr/local/lib/python3.10/dist-packages/supersuit/vector/concat_vec_env.py", line 23, in __init__
    self.vec_envs = vec_envs = [vec_env_fn() for vec_env_fn in vec_env_fns]
  File "/usr/local/lib/python3.10/dist-packages/supersuit/vector/concat_vec_env.py", line 23, in <listcomp>
    self.vec_envs = vec_envs = [vec_env_fn() for vec_env_fn in vec_env_fns]
  File "/usr/local/lib/python3.10/dist-packages/supersuit/vector/vector_constructors.py", line 12, in env_fn
    env_copy = cloudpickle.loads(cloudpickle.dumps(env))
  File "/usr/local/lib/python3.10/dist-packages/cloudpickle/cloudpickle_fast.py", line 73, in dumps
    cp.dump(obj)
  File "/usr/local/lib/python3.10/dist-packages/cloudpickle/cloudpickle_fast.py", line 632, in dump
    return Pickler.dump(self, obj)
TypeError: cannot pickle 'dmlab2d.dmlab2d_pybind.Lab2d' object

from shimmy.

elliottower avatar elliottower commented on June 15, 2024

Thanks for pointing this out, not sure exactly how we would get around the pickling error—I remember running pickle errors previously as well, the lab2d objects don’t seem to be able to be serialized easily via pickle at least.

If it’s not possible to fix the pickling problem I wouldn’t be against adding support for scenarios and just having a disclaimer about the inability to pickle it.

from shimmy.

s-a-barnett avatar s-a-barnett commented on June 15, 2024

Is there a quick way to circumvent the pickling steps and make the code run?

from shimmy.

pseudo-rnd-thoughts avatar pseudo-rnd-thoughts commented on June 15, 2024

Is there a quick way to circumvent the pickling steps and make the code run?

I suspect not using supersuit

from shimmy.

elliottower avatar elliottower commented on June 15, 2024

Yeah unfortunately the supersuit vec env wrapper I believe uses pickling for the multi processing, so can’t really get away from that problem. Maybe if you set number of cpus to one it won’t actually do the pickling?

from shimmy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.